/// #pkgName FGUI包名 /// #prefabName ui预制名字 /// #viewName uiview名字 /// #UIName ui的名字,prefabName首字母转大写 /// ui逻辑处理类 /// created by chenwb 2024 import { ResCollector } from "../../../../frameWork/compment/ResCollector"; import FguiMgr from "../../../../frameWork/fgui/FguiMgr"; import { FguiViewCtrl } from "../../../../frameWork/fgui/mvc/FguiViewCtrl"; import EventMng from "../../../../manager/EventMng"; import { FightBase } from "../../../../shared/base"; import AssetMgr from "../../../../utils/AssetMgr"; import UEBattleView from "../../../battle/UEBattleView"; import UESubHp from "../../../battle/UESubHp"; import { BattleMainVM } from "./BattleMainVM"; import { BattleMainView } from "./BattleMainView"; export interface I_BattleData { fightInfo: FightBase, closeCb?: Function } export class BattleMainCtrl extends FguiViewCtrl { ueBattle: UEBattleView; uiData: I_BattleData; onCollectRes(resCollector: ResCollector, param: any): void { resCollector.AddUEClass([UEBattleView, UESubHp]) } OnInited(): void { this.ueBattle = AssetMgr.instantiateUE(UEBattleView); this.VM.BattleCom.node.addChild(this.ueBattle.node); this.ueBattle.Init(); } OnShow(intent?: I_BattleData): void { this.uiData = intent; this.AddListeners(); this.ueBattle.onStartFight(intent?.fightInfo); } OnHide(): void { this.RemoveListeners(); this.ueBattle.onDisable(); } //#region UI事件 private AddListeners(): void { this.RegisterClick(this.VM.MaskBgBtn, this.OnClickMaskBgBtn); } private RemoveListeners(): void { // <#UIEventsRemoveArea> } private OnClickMaskBgBtn(): void { this.Close(); } private Close(): void { FguiMgr.Instance.closeUI(BattleMainView, true); this.uiData.closeCb && this.uiData.closeCb(); } //#endregion }