From cfe2a2d5bc6fe9a85488542597d4f73dddbfeee8 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期日, 26 十月 2025 14:54:36 +0800
Subject: [PATCH] 285 【公会】公会行商(砍价)
---
Main/System/Sound/SoundPlayer.cs | 30 ++++++++++++++++++++----------
1 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/Main/System/Sound/SoundPlayer.cs b/Main/System/Sound/SoundPlayer.cs
index 3315f86..ad7e910 100644
--- a/Main/System/Sound/SoundPlayer.cs
+++ b/Main/System/Sound/SoundPlayer.cs
@@ -11,8 +11,18 @@
static readonly List<int> commonUseAudioSet = new List<int>() { defaultClickPositiveAudio, defaultClickNegativeAudio, 3, 4 };
- public static SoundPlayer Instance {
- get; set;
+ static SoundPlayer m_Instance = null;
+ public static SoundPlayer Instance
+ {
+ get
+ {
+ if (m_Instance == null)
+ {
+ CreateSoundPlayer();
+ }
+ return m_Instance;
+ }
+
}
[SerializeField] AudioSource m_MusicAudioSource;
@@ -45,9 +55,9 @@
public static void CreateSoundPlayer()
{
var gameObject = GameObject.Instantiate(BuiltInLoader.LoadPrefab("SoundPlayer"));
- Instance = gameObject.GetComponent<SoundPlayer>();
- Instance.name = "SoundPlayer";
- Instance.SetActive(true);
+ m_Instance = gameObject.GetComponent<SoundPlayer>();
+ m_Instance.name = "SoundPlayer";
+ m_Instance.SetActive(true);
DontDestroyOnLoad(gameObject);
}
@@ -312,11 +322,11 @@
//}
//private void LateUpdate()
- //{
- // if (CameraController.Instance != null && CameraController.Instance.CameraObject != null)
- // {
- // this.transform.position = CameraController.Instance.transform.position + new Vector3(0, 5, 0);
- // this.transform.rotation = CameraController.Instance.CameraObject.transform.rotation;
+ //{
+ // if (CameraController.Instance != null && CameraController.Instance.CameraObject != null)
+ // {
+ // this.transform.position = CameraController.Instance.transform.position + new Vector3(0, 5, 0);
+ // this.transform.rotation = CameraController.Instance.CameraObject.transform.rotation;
// }
//}
--
Gitblit v1.8.0