summaryrefslogtreecommitdiff
path: root/Client/Assembly-CSharp/ButtonRolloverHandler.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Client/Assembly-CSharp/ButtonRolloverHandler.cs')
-rw-r--r--Client/Assembly-CSharp/ButtonRolloverHandler.cs35
1 files changed, 35 insertions, 0 deletions
diff --git a/Client/Assembly-CSharp/ButtonRolloverHandler.cs b/Client/Assembly-CSharp/ButtonRolloverHandler.cs
new file mode 100644
index 0000000..963058d
--- /dev/null
+++ b/Client/Assembly-CSharp/ButtonRolloverHandler.cs
@@ -0,0 +1,35 @@
+using System;
+using UnityEngine;
+using UnityEngine.Events;
+
+public class ButtonRolloverHandler : MonoBehaviour
+{
+ public SpriteRenderer Target;
+
+ public Color OverColor = Color.green;
+
+ public Color OutColor = Color.white;
+
+ public AudioClip HoverSound;
+
+ public void Start()
+ {
+ PassiveButton component = base.GetComponent<PassiveButton>();
+ component.OnMouseOver.AddListener(new UnityAction(this.DoMouseOver));
+ component.OnMouseOut.AddListener(new UnityAction(this.DoMouseOut));
+ }
+
+ public void DoMouseOver()
+ {
+ this.Target.color = this.OverColor;
+ if (this.HoverSound)
+ {
+ SoundManager.Instance.PlaySound(this.HoverSound, false, 1f);
+ }
+ }
+
+ public void DoMouseOut()
+ {
+ this.Target.color = this.OutColor;
+ }
+}