MissionBanner.ts 1.0 KB

1234567891011121314151617181920212223242526272829
  1. import { _decorator, Component, Node, Animation, systemEvent, SystemEvent, Label, Sprite } from 'cc';
  2. import { DataSystem } from '../../core/data/DataSystem';
  3. import { BattleUIData } from './BattleUIData';
  4. const { ccclass, property } = _decorator;
  5. @ccclass('MissionBanner')
  6. export class MissionBanner extends Component {
  7. @property({ type: Animation, tooltip: "banner动画" }) animation: Animation;
  8. @property({ type: Label, tooltip: "关卡文本" }) missionLabel: Label;
  9. @property({ type: Node, tooltip: "Boss图标" }) bossIcon: Node;
  10. start() {
  11. this.animation.on(Animation.EventType.FINISHED, () => {
  12. this.node.destroy();
  13. }, this);
  14. }
  15. public setData(mission: number, isBoss: boolean): void {
  16. this.bossIcon.active = isBoss;
  17. this.missionLabel.string = `第${mission}关`;
  18. this.animation.play();
  19. this.animation.on(Animation.EventType.FINISHED, this.onFinsih, this);
  20. }
  21. public onFinsih(): void {
  22. DataSystem.getData(BattleUIData)._bannerRunOver = true;
  23. }
  24. }