SmallPanel.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { BaseView } from "../../../lightMVC/core/base/BaseView";
  2. import { App } from "../../Manager/App";
  3. import { Sex } from "../../Framework/Const/EnumDefine";
  4. import NotifyModel from "../../model/NotifyModel";
  5. import hallModel from "../../model/hallModel";
  6. import player from "../../player";
  7. const { ccclass, property } = cc._decorator;
  8. @ccclass
  9. export default class SmallPanel extends BaseView {
  10. private progressBar: cc.ProgressBar = null;
  11. private currentTime: number = 0;
  12. public drawView(): void {
  13. console.log('SmallPanel~~~~~~~~~~');
  14. let progress = this.ui.getNode("progress");
  15. this.progressBar = progress.getComponent(cc.ProgressBar);
  16. this.currentTime = App.DataManager.SmallTime;
  17. let label = this.ui.getNode("label");
  18. let action = cc.sequence(cc.scaleTo(0.5, 1.2), cc.scaleTo(0.5, 1));
  19. action.repeatForever();
  20. label.runAction(action);
  21. }
  22. update(dt) {
  23. if (!this.progressBar || this.currentTime <= 0) return;
  24. this.currentTime -= dt;
  25. let progress = this.currentTime / App.DataManager.SmallTime;
  26. this.progressBar.progress = (progress < 0) ? 0 : progress;
  27. if (progress <= 0) {
  28. player.getInstance().SetSmallBack();
  29. this.closeView();
  30. }
  31. }
  32. public static path(): string {
  33. return "prefabs/SmallPanel";
  34. }
  35. }