Files
SVSimServer/SVSim.BattleEngine/Engine/UnityEventAgent.cs
gamer147 0d9d8acae0 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.
2026-06-05 16:57:20 -04:00

89 lines
1.7 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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;
}
}