scripts
This commit is contained in:
@@ -0,0 +1,166 @@
|
||||
using System;
|
||||
using UnityEngine.Events;
|
||||
|
||||
namespace UnityEngine.UI.CoroutineTween
|
||||
{
|
||||
// Token: 0x02000033 RID: 51
|
||||
internal struct ColorTween : ITweenValue
|
||||
{
|
||||
// Token: 0x1700005B RID: 91
|
||||
// (get) Token: 0x06000155 RID: 341 RVA: 0x00006614 File Offset: 0x00004A14
|
||||
// (set) Token: 0x06000156 RID: 342 RVA: 0x0000662F File Offset: 0x00004A2F
|
||||
public Color startColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_StartColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_StartColor = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700005C RID: 92
|
||||
// (get) Token: 0x06000157 RID: 343 RVA: 0x0000663C File Offset: 0x00004A3C
|
||||
// (set) Token: 0x06000158 RID: 344 RVA: 0x00006657 File Offset: 0x00004A57
|
||||
public Color targetColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_TargetColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_TargetColor = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700005D RID: 93
|
||||
// (get) Token: 0x06000159 RID: 345 RVA: 0x00006664 File Offset: 0x00004A64
|
||||
// (set) Token: 0x0600015A RID: 346 RVA: 0x0000667F File Offset: 0x00004A7F
|
||||
public ColorTween.ColorTweenMode tweenMode
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_TweenMode;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_TweenMode = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700005E RID: 94
|
||||
// (get) Token: 0x0600015B RID: 347 RVA: 0x0000668C File Offset: 0x00004A8C
|
||||
// (set) Token: 0x0600015C RID: 348 RVA: 0x000066A7 File Offset: 0x00004AA7
|
||||
public float duration
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Duration;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_Duration = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700005F RID: 95
|
||||
// (get) Token: 0x0600015D RID: 349 RVA: 0x000066B4 File Offset: 0x00004AB4
|
||||
// (set) Token: 0x0600015E RID: 350 RVA: 0x000066CF File Offset: 0x00004ACF
|
||||
public bool ignoreTimeScale
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_IgnoreTimeScale;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_IgnoreTimeScale = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600015F RID: 351 RVA: 0x000066DC File Offset: 0x00004ADC
|
||||
public void TweenValue(float floatPercentage)
|
||||
{
|
||||
if (this.ValidTarget())
|
||||
{
|
||||
Color color = Color.Lerp(this.m_StartColor, this.m_TargetColor, floatPercentage);
|
||||
if (this.m_TweenMode == ColorTween.ColorTweenMode.Alpha)
|
||||
{
|
||||
color.r = this.m_StartColor.r;
|
||||
color.g = this.m_StartColor.g;
|
||||
color.b = this.m_StartColor.b;
|
||||
}
|
||||
else if (this.m_TweenMode == ColorTween.ColorTweenMode.RGB)
|
||||
{
|
||||
color.a = this.m_StartColor.a;
|
||||
}
|
||||
this.m_Target.Invoke(color);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000160 RID: 352 RVA: 0x00006782 File Offset: 0x00004B82
|
||||
public void AddOnChangedCallback(UnityAction<Color> callback)
|
||||
{
|
||||
if (this.m_Target == null)
|
||||
{
|
||||
this.m_Target = new ColorTween.ColorTweenCallback();
|
||||
}
|
||||
this.m_Target.AddListener(callback);
|
||||
}
|
||||
|
||||
// Token: 0x06000161 RID: 353 RVA: 0x000067A8 File Offset: 0x00004BA8
|
||||
public bool GetIgnoreTimescale()
|
||||
{
|
||||
return this.m_IgnoreTimeScale;
|
||||
}
|
||||
|
||||
// Token: 0x06000162 RID: 354 RVA: 0x000067C4 File Offset: 0x00004BC4
|
||||
public float GetDuration()
|
||||
{
|
||||
return this.m_Duration;
|
||||
}
|
||||
|
||||
// Token: 0x06000163 RID: 355 RVA: 0x000067E0 File Offset: 0x00004BE0
|
||||
public bool ValidTarget()
|
||||
{
|
||||
return this.m_Target != null;
|
||||
}
|
||||
|
||||
// Token: 0x040000A5 RID: 165
|
||||
private ColorTween.ColorTweenCallback m_Target;
|
||||
|
||||
// Token: 0x040000A6 RID: 166
|
||||
private Color m_StartColor;
|
||||
|
||||
// Token: 0x040000A7 RID: 167
|
||||
private Color m_TargetColor;
|
||||
|
||||
// Token: 0x040000A8 RID: 168
|
||||
private ColorTween.ColorTweenMode m_TweenMode;
|
||||
|
||||
// Token: 0x040000A9 RID: 169
|
||||
private float m_Duration;
|
||||
|
||||
// Token: 0x040000AA RID: 170
|
||||
private bool m_IgnoreTimeScale;
|
||||
|
||||
// Token: 0x02000034 RID: 52
|
||||
public enum ColorTweenMode
|
||||
{
|
||||
// Token: 0x040000AC RID: 172
|
||||
All,
|
||||
// Token: 0x040000AD RID: 173
|
||||
RGB,
|
||||
// Token: 0x040000AE RID: 174
|
||||
Alpha
|
||||
}
|
||||
|
||||
// Token: 0x02000035 RID: 53
|
||||
public class ColorTweenCallback : UnityEvent<Color>
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
using System;
|
||||
using UnityEngine.Events;
|
||||
|
||||
namespace UnityEngine.UI.CoroutineTween
|
||||
{
|
||||
// Token: 0x02000036 RID: 54
|
||||
internal struct FloatTween : ITweenValue
|
||||
{
|
||||
// Token: 0x17000060 RID: 96
|
||||
// (get) Token: 0x06000165 RID: 357 RVA: 0x0000680C File Offset: 0x00004C0C
|
||||
// (set) Token: 0x06000166 RID: 358 RVA: 0x00006827 File Offset: 0x00004C27
|
||||
public float startValue
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_StartValue;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_StartValue = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000061 RID: 97
|
||||
// (get) Token: 0x06000167 RID: 359 RVA: 0x00006834 File Offset: 0x00004C34
|
||||
// (set) Token: 0x06000168 RID: 360 RVA: 0x0000684F File Offset: 0x00004C4F
|
||||
public float targetValue
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_TargetValue;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_TargetValue = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000062 RID: 98
|
||||
// (get) Token: 0x06000169 RID: 361 RVA: 0x0000685C File Offset: 0x00004C5C
|
||||
// (set) Token: 0x0600016A RID: 362 RVA: 0x00006877 File Offset: 0x00004C77
|
||||
public float duration
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Duration;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_Duration = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000063 RID: 99
|
||||
// (get) Token: 0x0600016B RID: 363 RVA: 0x00006884 File Offset: 0x00004C84
|
||||
// (set) Token: 0x0600016C RID: 364 RVA: 0x0000689F File Offset: 0x00004C9F
|
||||
public bool ignoreTimeScale
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_IgnoreTimeScale;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_IgnoreTimeScale = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600016D RID: 365 RVA: 0x000068AC File Offset: 0x00004CAC
|
||||
public void TweenValue(float floatPercentage)
|
||||
{
|
||||
if (this.ValidTarget())
|
||||
{
|
||||
float num = Mathf.Lerp(this.m_StartValue, this.m_TargetValue, floatPercentage);
|
||||
this.m_Target.Invoke(num);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600016E RID: 366 RVA: 0x000068E9 File Offset: 0x00004CE9
|
||||
public void AddOnChangedCallback(UnityAction<float> callback)
|
||||
{
|
||||
if (this.m_Target == null)
|
||||
{
|
||||
this.m_Target = new FloatTween.FloatTweenCallback();
|
||||
}
|
||||
this.m_Target.AddListener(callback);
|
||||
}
|
||||
|
||||
// Token: 0x0600016F RID: 367 RVA: 0x00006910 File Offset: 0x00004D10
|
||||
public bool GetIgnoreTimescale()
|
||||
{
|
||||
return this.m_IgnoreTimeScale;
|
||||
}
|
||||
|
||||
// Token: 0x06000170 RID: 368 RVA: 0x0000692C File Offset: 0x00004D2C
|
||||
public float GetDuration()
|
||||
{
|
||||
return this.m_Duration;
|
||||
}
|
||||
|
||||
// Token: 0x06000171 RID: 369 RVA: 0x00006948 File Offset: 0x00004D48
|
||||
public bool ValidTarget()
|
||||
{
|
||||
return this.m_Target != null;
|
||||
}
|
||||
|
||||
// Token: 0x040000AF RID: 175
|
||||
private FloatTween.FloatTweenCallback m_Target;
|
||||
|
||||
// Token: 0x040000B0 RID: 176
|
||||
private float m_StartValue;
|
||||
|
||||
// Token: 0x040000B1 RID: 177
|
||||
private float m_TargetValue;
|
||||
|
||||
// Token: 0x040000B2 RID: 178
|
||||
private float m_Duration;
|
||||
|
||||
// Token: 0x040000B3 RID: 179
|
||||
private bool m_IgnoreTimeScale;
|
||||
|
||||
// Token: 0x02000037 RID: 55
|
||||
public class FloatTweenCallback : UnityEvent<float>
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
|
||||
namespace UnityEngine.UI.CoroutineTween
|
||||
{
|
||||
// Token: 0x02000032 RID: 50
|
||||
internal interface ITweenValue
|
||||
{
|
||||
// Token: 0x06000151 RID: 337
|
||||
void TweenValue(float floatPercentage);
|
||||
|
||||
// Token: 0x17000059 RID: 89
|
||||
// (get) Token: 0x06000152 RID: 338
|
||||
bool ignoreTimeScale { get; }
|
||||
|
||||
// Token: 0x1700005A RID: 90
|
||||
// (get) Token: 0x06000153 RID: 339
|
||||
float duration { get; }
|
||||
|
||||
// Token: 0x06000154 RID: 340
|
||||
bool ValidTarget();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace UnityEngine.UI.CoroutineTween
|
||||
{
|
||||
// Token: 0x02000038 RID: 56
|
||||
internal class TweenRunner<T> where T : struct, ITweenValue
|
||||
{
|
||||
// Token: 0x06000174 RID: 372 RVA: 0x0000697C File Offset: 0x00004D7C
|
||||
private static IEnumerator Start(T tweenInfo)
|
||||
{
|
||||
if (!tweenInfo.ValidTarget())
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
float elapsedTime = 0f;
|
||||
while (elapsedTime < tweenInfo.duration)
|
||||
{
|
||||
elapsedTime += ((!tweenInfo.ignoreTimeScale) ? Time.deltaTime : Time.unscaledDeltaTime);
|
||||
float percentage = Mathf.Clamp01(elapsedTime / tweenInfo.duration);
|
||||
tweenInfo.TweenValue(percentage);
|
||||
yield return null;
|
||||
}
|
||||
tweenInfo.TweenValue(1f);
|
||||
yield break;
|
||||
}
|
||||
|
||||
// Token: 0x06000175 RID: 373 RVA: 0x0000699E File Offset: 0x00004D9E
|
||||
public void Init(MonoBehaviour coroutineContainer)
|
||||
{
|
||||
this.m_CoroutineContainer = coroutineContainer;
|
||||
}
|
||||
|
||||
// Token: 0x06000176 RID: 374 RVA: 0x000069A8 File Offset: 0x00004DA8
|
||||
public void StartTween(T info)
|
||||
{
|
||||
if (this.m_CoroutineContainer == null)
|
||||
{
|
||||
Debug.LogWarning("Coroutine container not configured... did you forget to call Init?");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.StopTween();
|
||||
if (!this.m_CoroutineContainer.gameObject.activeInHierarchy)
|
||||
{
|
||||
info.TweenValue(1f);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.m_Tween = TweenRunner<T>.Start(info);
|
||||
this.m_CoroutineContainer.StartCoroutine(this.m_Tween);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000177 RID: 375 RVA: 0x00006A28 File Offset: 0x00004E28
|
||||
public void StopTween()
|
||||
{
|
||||
if (this.m_Tween != null)
|
||||
{
|
||||
this.m_CoroutineContainer.StopCoroutine(this.m_Tween);
|
||||
this.m_Tween = null;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x040000B4 RID: 180
|
||||
protected MonoBehaviour m_CoroutineContainer;
|
||||
|
||||
// Token: 0x040000B5 RID: 181
|
||||
protected IEnumerator m_Tween;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user