音效微调

This commit is contained in:
lishuo 2021-12-16 18:27:50 +08:00
parent b9d14a590c
commit 77989384fc

View File

@ -912,7 +912,12 @@ public class UIManager : MonoBehaviour
{ {
return; return;
} }
if (eventTriggerType == EventTriggerType.PointerClick)
{
var audioSource = gameObject.GetComponent<AudioSource>();
if (audioSource != null)
audioSource.PlayOneShot(buttonClip);
}
call(e); call(e);
}); });
@ -927,18 +932,18 @@ public class UIManager : MonoBehaviour
//设置点击音效 //设置点击音效
if (buttonClip == null) if (buttonClip == null)
{ {
buttonClip = Resources.Load<AudioClip>("audio/dundundun"); buttonClip = Resources.Load<AudioClip>("audio/高科技UI点击触控警告提示反馈APP菜单UI-很酷的应用程序_爱给网_aigei_com");
} }
var audioSource = gameObject.GetComponent<AudioSource>(); var audioSource = gameObject.GetComponent<AudioSource>();
if (audioSource == null) if (audioSource == null)
{ {
audioSource = gameObject.AddComponent<AudioSource>(); audioSource = gameObject.AddComponent<AudioSource>();
} }
audioSource.volume = 0.5f;
UIManager.AddEvent(gameObject, EventTriggerType.PointerEnter, (e) => UIManager.AddEvent(gameObject, EventTriggerType.PointerEnter, (e) =>
{ {
//if (!gameObject.activeInHierarchy) return; //if (!gameObject.activeInHierarchy) return;
audioSource.PlayOneShot(buttonClip);
Cursor.SetCursor(cursor, Vector2.zero, CursorMode.Auto); Cursor.SetCursor(cursor, Vector2.zero, CursorMode.Auto);
}); });
UIManager.AddEvent(gameObject, EventTriggerType.PointerUp, (e) => UIManager.AddEvent(gameObject, EventTriggerType.PointerUp, (e) =>