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:
76
SVSim.BattleEngine/Engine/Wizard/ParameterOverwriterBase.cs
Normal file
76
SVSim.BattleEngine/Engine/Wizard/ParameterOverwriterBase.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Wizard;
|
||||
|
||||
public abstract class ParameterOverwriterBase : MonoBehaviour
|
||||
{
|
||||
private enum State
|
||||
{
|
||||
None,
|
||||
RequestOverwrite,
|
||||
Overwrote
|
||||
}
|
||||
|
||||
private State _state;
|
||||
|
||||
protected abstract GameObject TargetObject { get; }
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
SaveOriginalParameters();
|
||||
_state = State.None;
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
_state = State.RequestOverwrite;
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
if (_state == State.Overwrote)
|
||||
{
|
||||
UndoParameters();
|
||||
}
|
||||
_state = State.None;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (_state == State.RequestOverwrite && NGUITools.GetActive(TargetObject))
|
||||
{
|
||||
OverwriteParameters();
|
||||
_state = State.Overwrote;
|
||||
}
|
||||
}
|
||||
|
||||
protected void RequestOverwrite()
|
||||
{
|
||||
if (base.enabled)
|
||||
{
|
||||
_state = State.RequestOverwrite;
|
||||
}
|
||||
}
|
||||
|
||||
protected bool ColorTryParse(string strColorCodeId, out Color color)
|
||||
{
|
||||
color = Color.red;
|
||||
if (string.IsNullOrEmpty(strColorCodeId))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (Enum.TryParse<eColorCodeId>(strColorCodeId, out var result))
|
||||
{
|
||||
color = ColorCode.Get(result);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected abstract void SaveOriginalParameters();
|
||||
|
||||
protected abstract void UndoParameters();
|
||||
|
||||
protected abstract void OverwriteParameters();
|
||||
}
|
||||
Reference in New Issue
Block a user