From 77989384fcf3daa6f57d5ff9a65939d196b57e51 Mon Sep 17 00:00:00 2001 From: lishuo Date: Thu, 16 Dec 2021 18:27:50 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9F=B3=E6=95=88=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/UIManager.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Assets/Scripts/UIManager.cs b/Assets/Scripts/UIManager.cs index 621b2785..b092a411 100644 --- a/Assets/Scripts/UIManager.cs +++ b/Assets/Scripts/UIManager.cs @@ -912,7 +912,12 @@ public class UIManager : MonoBehaviour { return; } - + if (eventTriggerType == EventTriggerType.PointerClick) + { + var audioSource = gameObject.GetComponent(); + if (audioSource != null) + audioSource.PlayOneShot(buttonClip); + } call(e); }); @@ -927,18 +932,18 @@ public class UIManager : MonoBehaviour //设置点击音效 if (buttonClip == null) { - buttonClip = Resources.Load("audio/dundundun"); + buttonClip = Resources.Load("audio/高科技UI点击触控警告提示反馈APP菜单UI-很酷的应用程序_爱给网_aigei_com"); } var audioSource = gameObject.GetComponent(); if (audioSource == null) { audioSource = gameObject.AddComponent(); - } + audioSource.volume = 0.5f; + UIManager.AddEvent(gameObject, EventTriggerType.PointerEnter, (e) => { //if (!gameObject.activeInHierarchy) return; - audioSource.PlayOneShot(buttonClip); Cursor.SetCursor(cursor, Vector2.zero, CursorMode.Auto); }); UIManager.AddEvent(gameObject, EventTriggerType.PointerUp, (e) =>