harmnum.ts 879 B

123456789101112131415161718192021222324252627
  1. const {ccclass, property} = cc._decorator;
  2. @ccclass
  3. export default class HarmNum extends cc.Component {
  4. /*===========================自动绑定组件开始===========================*/
  5. /*自动生成*/
  6. @property({type:cc.Label, displayName:""})
  7. private $text_lb:cc.Label = null;
  8. /*===========================自动绑定组件结束===========================*/
  9. /*===========================自动生成按钮事件开始==========================*/
  10. /*===========================自动生成按钮事件结束==========================*/
  11. protected onLoad(): void {
  12. let ani = this.$text_lb.getComponent(cc.Animation);
  13. ani.once(cc.Animation.EventType.FINISHED, ()=>{
  14. this.node.destroy();
  15. });
  16. }
  17. setHarm(harm: number){
  18. this.$text_lb.string = harm.toString();
  19. }
  20. }