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

110 lines
1.9 KiB
C#

using System;
using UnityEngine;
[AddComponentMenu("NGUI/Tween/Tween Scale")]
public class TweenScale : UITweener
{
public Vector3 from = Vector3.one;
public Vector3 to = Vector3.one;
public bool updateTable;
private Transform mTrans;
private UITable mTable;
public Transform cachedTransform
{
get
{
if (mTrans == null)
{
mTrans = base.transform;
}
return mTrans;
}
}
public Vector3 value
{
get
{
return cachedTransform.localScale;
}
set
{
cachedTransform.localScale = value;
}
}
[Obsolete("Use 'value' instead")]
public Vector3 scale
{
get
{
return value;
}
set
{
this.value = value;
}
}
protected override void OnUpdate(float factor, bool isFinished)
{
value = from * (1f - factor) + to * factor;
if (!updateTable)
{
return;
}
if (mTable == null)
{
mTable = NGUITools.FindInParents<UITable>(base.gameObject);
if (mTable == null)
{
updateTable = false;
return;
}
}
mTable.repositionNow = true;
}
public static TweenScale Begin(GameObject go, float duration, Vector3 scale)
{
TweenScale tweenScale = UITweener.Begin<TweenScale>(go, duration);
tweenScale.from = tweenScale.value;
tweenScale.to = scale;
if (duration <= 0f)
{
tweenScale.Sample(1f, isFinished: true);
tweenScale.enabled = false;
}
return tweenScale;
}
[ContextMenu("Set 'From' to current value")]
public override void SetStartToCurrentValue()
{
from = value;
}
[ContextMenu("Set 'To' to current value")]
public override void SetEndToCurrentValue()
{
to = value;
}
[ContextMenu("Assume value of 'From'")]
private void SetCurrentValueToStart()
{
value = from;
}
[ContextMenu("Assume value of 'To'")]
private void SetCurrentValueToEnd()
{
value = to;
}
}