endlessRoundPanel.ts 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import EventMgr from "../game/EventMgr";
  2. import { GameEvent } from "../game/GameEvent";
  3. import Main from "../game/Main";
  4. const {ccclass, property} = cc._decorator;
  5. @ccclass
  6. export default class endlessRoundPanel extends cc.Component {
  7. @property(cc.Label)
  8. lbRound: cc.Label = null;
  9. // LIFE-CYCLE CALLBACKS:
  10. // onLoad () {}
  11. protected onLoad(): void {
  12. EventMgr.Instance.add_event_listenner(GameEvent.EndlessGameNewRound,this,this.OnEndlessGameNewRound);
  13. this.node.active = false;
  14. }
  15. OnEndlessGameNewRound() {
  16. let me = this;
  17. this.lbRound.string = "第"+Main.Ins.Round+"波";
  18. this.node.active = true;
  19. this.node.scaleY=0;
  20. let tween = cc.tween(this.node);
  21. tween.to(0.3,{opacity:255,scaleY:1}).delay(1).to(0.3,{opacity:0,scaleY:0}).call(function(){me.node.active = false}).start();
  22. }
  23. protected onDestroy(): void {
  24. EventMgr.Instance.remove_event_listenner(GameEvent.EndlessGameNewRound,this,this.OnEndlessGameNewRound);
  25. }
  26. // update (dt) {}
  27. }