//回合开始:回调函数 protected virtual void OnTurnStart(T unit, bool isForce) { unit.OnTurnStart(isForce); if (unit.IsPlayer()) { BaseInputMgr.PushUnitSelect(true); } }
//回合结束:回调函数 protected virtual void OnTurnEnd(T unit) { unit.OnTurnEnd(); if (unit.IsPlayer()) { BaseInputMgr.PushUnitSelect(false); } }
protected virtual void OnClose() { IsHaveOpenedViewState.Push(false); if (IsBlockInput) { BaseInputMgr.PushPlayerInputState(true); } }
private void OnMouseUp() { if (BaseInputMgr.IsStayInUI) { return; } if (BaseInputMgr.IsSameMousePt(0)) { OnClicked(); } }
public override void OnUpdate() { base.OnUpdate(); if (BaseGlobal.DiffMgr.IsGMMode() || Application.isEditor) { if (BaseInputMgr.IsCanInput()) { OnGMUpdate(); } } }
protected virtual void OnOpen() { IsHaveOpenedViewState.Push(true); if (IsBlockInput) { BaseInputMgr.PushPlayerInputState(false); } if (IsOptionView) { foreach (var item in AllOptionUI) { if (item != this) { item.Close(); } } } }
// 卸载战场 IEnumerator <float> _unLoadBattle(Callback onDone) { IsLoadedScene = false; IsLoadingBattle = false; IsLoadBattleEnd = false; IsGameStartOver = false; IsInPauseLoadingView = false; CurData.OnBeRemoved(); CurData = null; //暂停一段时间 BaseGlobal.PauseGame(true); BaseInputMgr.ResetFullScreenState(); Callback_OnBattleUnLoad?.Invoke(); yield return(Timing.WaitForOneFrame); Callback_OnLoadingProgressChanged?.Invoke("Start to load", 0.01f); //延时一秒.防止UI卡住 yield return(Timing.WaitForSeconds(0.5f)); var wait = SceneManager.UnloadSceneAsync(SceneName); while (!wait.isDone) { yield return(Timing.WaitForOneFrame); Callback_OnLoadingProgressChanged?.Invoke("UnloadScene", wait.progress); } //卸载未使用的资源 GRMgr.UnloadScene(SceneAsset); Callback_OnLoadingProgressChanged?.Invoke("GC", 1.0f); yield return(Timing.WaitForOneFrame); Callback_OnBattleUnLoaded?.Invoke(); BaseGlobal.ResumeGame(); onDone?.Invoke(); }
public override void OnPointerExit(PointerEventData eventData) { base.OnPointerExit(eventData); BaseInputMgr.SetHoverHUDBar(null); }
public override void OnPointerEnter(PointerEventData eventData) { base.OnPointerEnter(eventData); BaseInputMgr.SetHoverHUDBar(this); }
// 加载战场 // readData:是否读取数据 IEnumerator <float> _loadBattle(bool readData = true) { BaseGlobal.ResumeGame(); BaseInputMgr.ResetFullScreenState(); Callback_OnBattleLoadStart?.Invoke(); yield return(Timing.WaitForOneFrame); float startTime = Time.realtimeSinceStartup; IsLoadedScene = false; IsLoadingBattle = true; IsLoadBattleEnd = false; IsGameStartOver = false; IsGameStart = false; IsInPauseLoadingView = false; //开始Tip BattleCoroutine.Run(_randTip()); //开始加载 Callback_OnBattleLoad?.Invoke(); yield return(Timing.WaitForOneFrame); OnLoadSceneStart(); Callback_OnLoadingProgressChanged?.Invoke(Util.GetStr("StartToLoad"), 0.0f); //演示几秒,给UI渐变的时间 yield return(Timing.WaitForSeconds(DelayLoadSceneTime)); //加载场景 SceneName = CurData.GetSceneName(); SceneAsset = GRMgr.LoadScene(SceneName); while (!SceneAsset.IsDone) { yield return(Timing.WaitForOneFrame); Callback_OnLoadingProgressChanged?.Invoke(Util.GetStr("LoadingScene"), SceneAsset.Progress * 0.8f); } //延时一帧 yield return(Timing.WaitForOneFrame); Scene = SceneManager.GetSceneByName(SceneName); SceneManager.SetActiveScene(Scene); IsLoadedScene = true; Callback_OnBattleLoadedScene?.Invoke(); if (BaseSceneObject == null) { CLog.Error("错误,场景里没有SceneObject"); } //这里必须延迟一帧,等待UI创建,注册事件 yield return(Timing.WaitForOneFrame); //读取数据前,资源加载 yield return(Timing.WaitUntilDone(BattleCoroutine.Run(BeforeReadData()))); Callback_OnLoadingProgressChanged?.Invoke(Util.GetStr("BeforeReadData"), 0.9f); if (readData) { BaseGlobal.IsUnReadData = false; //读取战场数据 BaseGlobal.DBMgr.ReadGameDBData(); BaseGlobal.IsUnReadData = true; } yield return(Timing.WaitForOneFrame); Callback_OnBattleReadDataEnd?.Invoke(); //增加加载战场次数 LoadBattleCount++; //读取数据后资源加载 yield return(Timing.WaitUntilDone(BattleCoroutine.Run(AffterReadData()))); Callback_OnLoadingProgressChanged?.Invoke(Util.GetStr("AffterReadData"), 0.95f); while (IsInCustomLoading) { yield return(Timing.WaitForOneFrame); } GC.Collect(); Callback_OnLoadingProgressChanged?.Invoke(Util.GetStr("GC"), 1.0f); IsLoadingBattle = false; //场景加载结束 Callback_OnBattleLoaded?.Invoke(); IsLoadBattleEnd = true; yield return(Timing.WaitForOneFrame); //游戏开始(预处理最后阶段) SelfBaseGlobal.OnGameStart1(); SelfBaseGlobal.OnGameStart2(); Callback_OnGameStart?.Invoke(); yield return(Timing.WaitForOneFrame); SelfBaseGlobal.OnGameStarted1(); SelfBaseGlobal.OnGameStarted2(); Callback_OnGameStarted?.Invoke(); IsGameStart = true; //暂停在加载界面 Callback_OnInPauseLoadingView?.Invoke(); IsInPauseLoadingView = NeedPauseLoading; while (IsInPauseLoadingView) { yield return(Timing.WaitForOneFrame); } SelfBaseGlobal.OnCloseLoadingView(); Callback_OnCloseLoadingView?.Invoke(); //锁定进入战场流程 while (IsLockBattleStartFlow) { yield return(Timing.WaitForOneFrame); } yield return(Timing.WaitUntilDone(BattleCoroutine.Run(BattleStart()))); //进入自定义流程的时候暂停 Callback_OnStartCustomBattleCoroutine?.Invoke(); if (PlotMgr != null) { PlotMgr?.SetPlotPause(true); yield return(Timing.WaitUntilDone(PlotMgr.CustomStartBattleCoroutine())); PlotMgr?.SetPlotPause(false); } Callback_OnEndCustomBattleCoroutine.Invoke(); //结尾部分 SelfBaseGlobal.OnGameStartOver(); Callback_OnGameStartOver?.Invoke(); IsGameStartOver = true; }