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.
117 lines
2.2 KiB
C#
117 lines
2.2 KiB
C#
using UnityEngine;
|
|
|
|
namespace Wizard;
|
|
|
|
[RequireComponent(typeof(UILabel))]
|
|
public class UILabelGradientOverwriter : ParameterOverwriterBase
|
|
{
|
|
private class GradientParameters
|
|
{
|
|
public bool ApplyGradient { get; }
|
|
|
|
public Color GradientTop { get; }
|
|
|
|
public Color GradientBottom { get; }
|
|
|
|
public GradientParameters(UILabel label)
|
|
{
|
|
ApplyGradient = label.applyGradient;
|
|
GradientTop = label.gradientTop;
|
|
GradientBottom = label.gradientBottom;
|
|
}
|
|
|
|
public void Apply(UILabel label)
|
|
{
|
|
label.applyGradient = ApplyGradient;
|
|
label.gradientTop = GradientTop;
|
|
label.gradientBottom = GradientBottom;
|
|
}
|
|
}
|
|
|
|
[SerializeField]
|
|
private UILabel _targetLabel;
|
|
|
|
[SerializeField]
|
|
private bool _applyGradient;
|
|
|
|
[SerializeField]
|
|
private string _gradientTopColorId;
|
|
|
|
[SerializeField]
|
|
private string _gradientBottomColorId;
|
|
|
|
private GradientParameters _originalParameters;
|
|
|
|
public bool ApplyGradient
|
|
{
|
|
set
|
|
{
|
|
_applyGradient = value;
|
|
RequestOverwrite();
|
|
}
|
|
}
|
|
|
|
public eColorCodeId GradientTopColorId
|
|
{
|
|
set
|
|
{
|
|
_gradientTopColorId = value.ToString();
|
|
RequestOverwrite();
|
|
}
|
|
}
|
|
|
|
public eColorCodeId GradientBottomColorId
|
|
{
|
|
set
|
|
{
|
|
_gradientBottomColorId = value.ToString();
|
|
RequestOverwrite();
|
|
}
|
|
}
|
|
|
|
protected override GameObject TargetObject => _targetLabel.gameObject;
|
|
|
|
private void Reset()
|
|
{
|
|
_targetLabel = GetComponent<UILabel>();
|
|
}
|
|
|
|
protected override void SaveOriginalParameters()
|
|
{
|
|
_originalParameters = new GradientParameters(_targetLabel);
|
|
}
|
|
|
|
protected override void UndoParameters()
|
|
{
|
|
_originalParameters.Apply(_targetLabel);
|
|
}
|
|
|
|
protected override void OverwriteParameters()
|
|
{
|
|
OverwriteApplyGradient();
|
|
OverwriteGradientTop();
|
|
OverwriteGradientBottom();
|
|
}
|
|
|
|
private void OverwriteApplyGradient()
|
|
{
|
|
_targetLabel.applyGradient = _applyGradient;
|
|
}
|
|
|
|
private void OverwriteGradientTop()
|
|
{
|
|
if (ColorTryParse(_gradientTopColorId, out var color))
|
|
{
|
|
_targetLabel.gradientTop = color;
|
|
}
|
|
}
|
|
|
|
private void OverwriteGradientBottom()
|
|
{
|
|
if (ColorTryParse(_gradientBottomColorId, out var color))
|
|
{
|
|
_targetLabel.gradientBottom = color;
|
|
}
|
|
}
|
|
}
|