BattleSceneTop.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import { _decorator, } from 'cc';
  2. import { GameInfo } from '../../GameInfo';
  3. import { UIMgr } from '../../Frames/UIManager';
  4. import { ModulerBase } from '../GameFrameWork/ModulerBase';
  5. import { GameMgr } from '../GameFrameWork/GameMgr';
  6. import { SelectTroops } from './SelectTroops';
  7. const { ccclass, property } = _decorator;
  8. @ccclass('BattleSceneTop')
  9. export class BattleSceneTop extends ModulerBase {
  10. protected onStart() {
  11. this.onBtnClick("_btnReturn", this._btnReturn);
  12. this._gold(GameInfo.Instance.getGold());
  13. this._diamond(GameInfo.Instance.getDiamond());
  14. this.battleMode("战斗模式");
  15. SelectTroops
  16. //this.onMsg("BattleMode", this._battleMode)
  17. }
  18. protected start(): void {
  19. }
  20. //金币数量
  21. private _gold(goldAmound: number) {
  22. this.getLabel("_gold").string = String(goldAmound);
  23. }
  24. //钻石数量
  25. private _diamond(diamondAmound: number) {
  26. this.getLabel("_diamond").string = String(diamondAmound);
  27. }
  28. //返回按钮
  29. private _btnReturn() {
  30. if(!GameMgr.Instance.getModuler(SelectTroops).showing()){
  31. UIMgr.openUI("Start");
  32. } else {
  33. GameMgr.Instance.getModuler(SelectTroops).hide(false);
  34. }
  35. }
  36. battleMode(name: string) {
  37. this.getLabel("_battleMode").string = name;
  38. }
  39. }