diff --git a/Assets/ButtonSound.cs b/Assets/ButtonSound.cs new file mode 100644 index 0000000..e2976b8 --- /dev/null +++ b/Assets/ButtonSound.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Lean.Gui; +using Raindrop; +using Raindrop.ServiceLocator; +using UnityEngine; + +public class ButtonSound : MonoBehaviour +{ + + public RaindropInstance Instance => ServiceLocator.Instance.Get(); + + private LeanButton btn; + void Awake() + { + try + { + btn = this.GetComponent(); + + if (btn) + { + this.GetComponent().OnClick.AddListener(OnClick); + } + } + catch (Exception e) + { + OpenMetaverse.Logger.DebugLog(e.ToString()); + } + } + + private void OnClick() + { + if (btn.interactable) + { + Instance.MediaManager.PlayUISound(UISounds.Click); + } + } +} diff --git a/Assets/ButtonSound.cs.meta b/Assets/ButtonSound.cs.meta new file mode 100644 index 0000000..f5613ae --- /dev/null +++ b/Assets/ButtonSound.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f1c31a79c3a650b4188b15f08d11da71 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: