BattleMainCtrl.ts 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /// #pkgName FGUI包名
  2. /// #prefabName ui预制名字
  3. /// #viewName uiview名字
  4. /// #UIName ui的名字,prefabName首字母转大写
  5. /// ui逻辑处理类
  6. /// created by chenwb 2024
  7. import { ResCollector } from "../../../../frameWork/compment/ResCollector";
  8. import FguiMgr from "../../../../frameWork/fgui/FguiMgr";
  9. import { FguiViewCtrl } from "../../../../frameWork/fgui/mvc/FguiViewCtrl";
  10. import AssetMgr from "../../../../utils/AssetMgr";
  11. import UEBattleView from "../../../battle/UEBattleView";
  12. import { BattleMainVM } from "./BattleMainVM";
  13. import { BattleMainView } from "./BattleMainView";
  14. export class BattleMainCtrl extends FguiViewCtrl<BattleMainVM> {
  15. ueBattle: UEBattleView;
  16. onCollectRes(resCollector: ResCollector, param: any): void {
  17. resCollector.AddUEClass([UEBattleView])
  18. }
  19. OnInited(): void {
  20. this.ueBattle = AssetMgr.instantiateUE(UEBattleView);
  21. this.VM.BattleCom.node.addChild(this.ueBattle.node);
  22. this.ueBattle.node.setSiblingIndex(0);
  23. }
  24. OnShow(intent?: any): void {
  25. this.AddListeners();
  26. }
  27. OnHide(): void {
  28. this.RemoveListeners();
  29. }
  30. //#region UI事件
  31. private AddListeners() : void {
  32. this.RegisterClick(this.VM.MaskBgBtn, this.OnClickMaskBgBtn);
  33. }
  34. private RemoveListeners() : void {
  35. // <#UIEventsRemoveArea>
  36. }
  37. private OnClickMaskBgBtn(): void {
  38. this.Close();
  39. }
  40. private Close(): void{
  41. FguiMgr.Instance.closeUI(BattleMainView, true);
  42. }
  43. //#endregion
  44. }