From e9ea621b93fbb58d9edfca8375918791637bbd52 Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 30 Dec 2020 20:59:04 +0800 Subject: +init --- Client/Assembly-CSharp/PassiveButton.cs | 47 +++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Client/Assembly-CSharp/PassiveButton.cs (limited to 'Client/Assembly-CSharp/PassiveButton.cs') 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.Instance.RegisterOne(this); + if (this.Colliders == null || this.Colliders.Length == 0) + { + this.Colliders = base.GetComponents(); + } + } + + public void DoClick() + { + if (this.ClickSound) + { + SoundManager.Instance.PlaySound(this.ClickSound, false, 1f); + } + this.OnClick.Invoke(); + } + + public void OnDestroy() + { + if (DestroyableSingleton.InstanceExists) + { + DestroyableSingleton.Instance.RemoveOne(this); + } + } +} -- cgit v1.1-26-g67d0