summaryrefslogtreecommitdiff
path: root/Client/Assembly-CSharp/PassiveButton.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Client/Assembly-CSharp/PassiveButton.cs')
-rw-r--r--Client/Assembly-CSharp/PassiveButton.cs47
1 files changed, 47 insertions, 0 deletions
diff --git a/Client/Assembly-CSharp/PassiveButton.cs b/Client/Assembly-CSharp/PassiveButton.cs
new file mode 100644
index 0000000..f7e9337
--- /dev/null
+++ b/Client/Assembly-CSharp/PassiveButton.cs
@@ -0,0 +1,47 @@
+using System;
+using UnityEngine;
+using UnityEngine.Events;
+using UnityEngine.UI;
+
+public class PassiveButton : MonoBehaviour
+{
+ public bool OnUp = true;
+
+ public bool OnDown;
+
+ public Button.ButtonClickedEvent OnClick = new Button.ButtonClickedEvent();
+
+ public AudioClip ClickSound;
+
+ public UnityEvent OnMouseOver;
+
+ public UnityEvent OnMouseOut;
+
+ public Collider2D[] Colliders;
+
+ public void Start()
+ {
+ DestroyableSingleton<PassiveButtonManager>.Instance.RegisterOne(this);
+ if (this.Colliders == null || this.Colliders.Length == 0)
+ {
+ this.Colliders = base.GetComponents<Collider2D>();
+ }
+ }
+
+ public void DoClick()
+ {
+ if (this.ClickSound)
+ {
+ SoundManager.Instance.PlaySound(this.ClickSound, false, 1f);
+ }
+ this.OnClick.Invoke();
+ }
+
+ public void OnDestroy()
+ {
+ if (DestroyableSingleton<PassiveButtonManager>.InstanceExists)
+ {
+ DestroyableSingleton<PassiveButtonManager>.Instance.RemoveOne(this);
+ }
+ }
+}