hch
2025-10-17 cb653cf75b17b9bdca0b5b9e6b88edf1ca72e90c
Main/Component/UI/Common/UIPlaySound.cs
@@ -1,50 +1,47 @@
//--------------------------------------------------------
//    [Author]:           第二世界
//    [Author]:           玩个游戏
//    [  Date ]:           Thursday, December 07, 2017
//--------------------------------------------------------
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
namespace vnxbqy.UI
public class UIPlaySound : MonoBehaviour
{
    [SerializeField] TriggerType m_TriggerType = TriggerType.Manual;
    [SerializeField] int m_Audio = 1;
    public class UIPlaySound : MonoBehaviour
    public void Play()
    {
        [SerializeField] TriggerType m_TriggerType = TriggerType.Manual;
        [SerializeField] int m_Audio = 1;
        SoundPlayer.Instance.PlayUIAudio(m_Audio);
    }
        public void Play()
    private void OnEnable()
    {
        if (m_TriggerType == TriggerType.OnEnable)
        {
            SoundPlayer.Instance.PlayUIAudio(m_Audio);
            Play();
        }
    }
        private void OnEnable()
    private void Start()
    {
        if (m_TriggerType == TriggerType.OnStart)
        {
            if (m_TriggerType == TriggerType.OnEnable)
            {
                Play();
            }
            Play();
        }
    }
        private void Start()
        {
            if (m_TriggerType == TriggerType.OnStart)
            {
                Play();
            }
        }
        public enum TriggerType
        {
            OnEnable,
            OnStart,
            Manual
        }
    public enum TriggerType
    {
        OnEnable,
        OnStart,
        Manual
    }
}