Files
SVSimServer/SVSim.BattleEngine/Engine/Wizard/UILabelEffectOverwriter.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

114 lines
2.1 KiB
C#

using UnityEngine;
namespace Wizard;
[RequireComponent(typeof(UILabel))]
public class UILabelEffectOverwriter : ParameterOverwriterBase
{
private class EffectParameters
{
public UILabel.Effect EffectStyle { get; }
public Color EffectColor { get; }
public Vector2 EffectDistance { get; }
public EffectParameters(UILabel label)
{
EffectStyle = label.effectStyle;
EffectColor = label.effectColor;
EffectDistance = label.effectDistance;
}
public void Apply(UILabel label)
{
label.effectStyle = EffectStyle;
label.effectColor = EffectColor;
label.effectDistance = EffectDistance;
}
}
[SerializeField]
private UILabel _targetLabel;
[SerializeField]
private UILabel.Effect _effectStyle;
[SerializeField]
private string _effectColorId;
[SerializeField]
private Vector2 _effectDistance = Vector2.one;
private EffectParameters _originalParameters;
public UILabel.Effect EffectStyle
{
set
{
_effectStyle = value;
RequestOverwrite();
}
}
public eColorCodeId EffectColorId
{
set
{
_effectColorId = value.ToString();
RequestOverwrite();
}
}
public Vector2 EffectDistance
{
set
{
_effectDistance = value;
RequestOverwrite();
}
}
protected override GameObject TargetObject => _targetLabel.gameObject;
private void Reset()
{
_targetLabel = GetComponent<UILabel>();
}
protected override void SaveOriginalParameters()
{
_originalParameters = new EffectParameters(_targetLabel);
}
protected override void UndoParameters()
{
_originalParameters.Apply(_targetLabel);
}
protected override void OverwriteParameters()
{
OverwriteEffectStyle();
OverwriteEffectColor();
OverwriteEffectDistance();
}
private void OverwriteEffectStyle()
{
_targetLabel.effectStyle = _effectStyle;
}
private void OverwriteEffectColor()
{
if (ColorTryParse(_effectColorId, out var color))
{
_targetLabel.effectColor = color;
}
}
private void OverwriteEffectDistance()
{
_targetLabel.effectDistance = _effectDistance;
}
}