feat(battle-engine): M1 auto-copy closure (782 battle-logic files)
Compile-driven bulk-copy loop (tools/engine-port/m1_copy_loop.py) pulled the precise reference closure of the battle-core roots, stopping at the classify god-object/View-VFX-UI boundary. 782 files; no re-explosion (M0 had estimated ~order 1000). Residual frontier = 52 shim-classified + 80 external (Unity/BCL) types to author next.
This commit is contained in:
88
SVSim.BattleEngine/Engine/UnityEventAgent.cs
Normal file
88
SVSim.BattleEngine/Engine/UnityEventAgent.cs
Normal file
@@ -0,0 +1,88 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
using Wizard.Battle.Phase;
|
||||
|
||||
public class UnityEventAgent : MonoBehaviour
|
||||
{
|
||||
private BattleManagerBase m_battleMgr;
|
||||
|
||||
private Action ResetTouchable;
|
||||
|
||||
public bool HasFocus { get; private set; }
|
||||
|
||||
public UnityEventAgent()
|
||||
{
|
||||
HasFocus = true;
|
||||
}
|
||||
|
||||
public void SetBattleMgr(BattleManagerBase battleMgr)
|
||||
{
|
||||
m_battleMgr = battleMgr;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
m_battleMgr.Update(Time.deltaTime);
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
LocalLog.AccumulateLastTraceLog("【UnityEventAgent】Object is Disabled");
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
LocalLog.AccumulateLastTraceLog("【UnityEventAgent】Object is Enabled");
|
||||
}
|
||||
|
||||
private void OnApplicationPause(bool pause)
|
||||
{
|
||||
if (!IsSkipPause())
|
||||
{
|
||||
if (m_battleMgr != null)
|
||||
{
|
||||
LocalLog.AccumulateLastTraceLog("【UnityEventAgent】OnApplicationPause is called!! isPause:" + pause + "【Phase】:" + m_battleMgr.GetCurrentPhase());
|
||||
}
|
||||
HasFocus = !pause;
|
||||
if (pause)
|
||||
{
|
||||
m_battleMgr.Pause();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_battleMgr.Resume();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnApplicationFocus(bool focus)
|
||||
{
|
||||
if (!IsSkipPause())
|
||||
{
|
||||
if (m_battleMgr != null)
|
||||
{
|
||||
LocalLog.AccumulateLastTraceLog("【UnityEventAgent】OnApplicationFocus is called!! isFocus:" + focus + "【Phase】:" + m_battleMgr.GetCurrentPhase());
|
||||
}
|
||||
HasFocus = focus;
|
||||
if (focus)
|
||||
{
|
||||
m_battleMgr.Pause();
|
||||
m_battleMgr.Resume();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_battleMgr.Pause();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsSkipPause()
|
||||
{
|
||||
if (m_battleMgr != null && (m_battleMgr.GetCurrentPhase() is LoadingPhase || m_battleMgr.GetCurrentPhase() is OpeningPhase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user