| | |
| | | static readonly List<int> commonUseAudioSet = new List<int>() { defaultClickPositiveAudio, defaultClickNegativeAudio, 3, 4 }; |
| | | |
| | | static SoundPlayer m_Instance = null; |
| | | private static readonly object m_Lock = new object(); |
| | | public static SoundPlayer Instance |
| | | { |
| | | get |
| | | { |
| | | if (m_Instance == null) |
| | | { |
| | | lock (m_Lock) |
| | | { |
| | | if (m_Instance == null) |
| | | { |
| | | CreateSoundPlayer(); |
| | | } |
| | | } |
| | | } |
| | | return m_Instance; |
| | | } |
| | | |
| | | } |
| | | |
| | | [SerializeField] AudioSource m_MusicAudioSource; |
| | |
| | | |
| | | Dictionary<int, AudioClip> commonUseAudioClipDict = new Dictionary<int, AudioClip>(); |
| | | Dictionary<int, AudioClip> musicAudioClipDict = new Dictionary<int, AudioClip>(); |
| | | |
| | | void Awake() |
| | | { |
| | | if (m_Instance == null) |
| | | { |
| | | m_Instance = this; |
| | | DontDestroyOnLoad(gameObject); |
| | | } |
| | | else if (m_Instance != this) |
| | | { |
| | | Destroy(gameObject); |
| | | } |
| | | } |
| | | |
| | | public event Action<bool> muteEvent; |
| | | bool m_Mute = false; |
| | |
| | | } |
| | | } |
| | | |
| | | public void Init() |
| | | { |
| | | //初始化用 |
| | | } |
| | | |
| | | public static void CreateSoundPlayer() |
| | | { |
| | | if (m_Instance != null) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | var gameObject = GameObject.Instantiate(BuiltInLoader.LoadPrefab("SoundPlayer")); |
| | | m_Instance = gameObject.GetComponent<SoundPlayer>(); |
| | | m_Instance.name = "SoundPlayer"; |