DialogWindow.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { _decorator, Component, Node, Label, Sprite, SpriteFrame } from 'cc';
  2. import { ResourcesUtils } from '../core/resourceManager/ResourcesUtils';
  3. import { WindowManager } from '../core/ui/window/WindowManager';
  4. import { WindowSystem } from '../core/ui/window/WindowSystem';
  5. import { g } from '../Data/g';
  6. import { FsUtils } from '../FsUtils/FsUtils';
  7. const { ccclass, property } = _decorator;
  8. /**公共对话框 */
  9. @ccclass('DialogWindow')
  10. export class DialogWindow extends Component {
  11. @property({ type: Label, tooltip: "数量文本" })
  12. numLabel: Label;
  13. @property({ type: Label, tooltip: "内容文本" })
  14. contentLabel: Label;
  15. @property({ type: Sprite, tooltip: "icon图标" })
  16. iconSprite: Sprite;
  17. private type = 0;
  18. start() {
  19. }
  20. private async onOpenHandler(data: any) {
  21. this.type = data.type;
  22. this.contentLabel.string = data.content;
  23. this.numLabel.string = ' X' + FsUtils.moneyFormat(data.num);
  24. if (data.type == 2) {//
  25. this.iconSprite.node.active = false;
  26. this.numLabel.node.active = false;
  27. }
  28. }
  29. private async onButtonTouch() {
  30. if (this.type == 2) {
  31. g.battleData.hasBattleTimesUpdate = true;
  32. }
  33. }
  34. }