summaryrefslogtreecommitdiff
path: root/Client/Assembly-CSharp/TransitionOpen.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Client/Assembly-CSharp/TransitionOpen.cs')
-rw-r--r--Client/Assembly-CSharp/TransitionOpen.cs54
1 files changed, 54 insertions, 0 deletions
diff --git a/Client/Assembly-CSharp/TransitionOpen.cs b/Client/Assembly-CSharp/TransitionOpen.cs
new file mode 100644
index 0000000..b846e44
--- /dev/null
+++ b/Client/Assembly-CSharp/TransitionOpen.cs
@@ -0,0 +1,54 @@
+using System;
+using System.Collections;
+using UnityEngine;
+using UnityEngine.UI;
+
+public class TransitionOpen : MonoBehaviour
+{
+ public float duration = 0.2f;
+
+ public Button.ButtonClickedEvent OnClose = new Button.ButtonClickedEvent();
+
+ public void OnEnable()
+ {
+ base.StartCoroutine(this.AnimateOpen());
+ }
+
+ public void Close()
+ {
+ base.StartCoroutine(this.AnimateClose());
+ }
+
+ private IEnumerator AnimateClose()
+ {
+ Vector3 vec = default(Vector3);
+ for (float t = 0f; t < this.duration; t += Time.deltaTime)
+ {
+ float t2 = t / this.duration;
+ float num = Mathf.SmoothStep(1f, 0f, t2);
+ vec.Set(num, num, num);
+ base.transform.localScale = vec;
+ yield return null;
+ }
+ vec.Set(0f, 0f, 0f);
+ base.transform.localScale = vec;
+ this.OnClose.Invoke();
+ yield break;
+ }
+
+ private IEnumerator AnimateOpen()
+ {
+ Vector3 vec = default(Vector3);
+ for (float t = 0f; t < this.duration; t += Time.deltaTime)
+ {
+ float t2 = t / this.duration;
+ float num = Mathf.SmoothStep(0f, 1f, t2);
+ vec.Set(num, num, num);
+ base.transform.localScale = vec;
+ yield return null;
+ }
+ vec.Set(1f, 1f, 1f);
+ base.transform.localScale = vec;
+ yield break;
+ }
+}