From 605c4b1adae19e2a0bdc50152dd2f56dd52fe217 Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Wed, 22 Jan 2025 12:58:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Item/Point3DItem.cs | 12 ++++++++++-- Assets/Scripts/UI/UISetting.cs | 6 ++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/Item/Point3DItem.cs b/Assets/Scripts/Item/Point3DItem.cs index d8ca8442..8acfd894 100644 --- a/Assets/Scripts/Item/Point3DItem.cs +++ b/Assets/Scripts/Item/Point3DItem.cs @@ -37,7 +37,7 @@ public class Point3DItem : MonoBehaviour } rotSpeed = data.rotateSpeed; gameObject.GetComponent().sortingOrder = data.order; - TypeEventSystem.Global.Register(OnObjDestroy).UnRegisterWhenGameObjectDestroyed(gameObject); + TypeEventSystem.Global.Register(OnObjDestroy); TypeEventSystem.Global.Register(OnStepChanged); } @@ -49,8 +49,16 @@ public class Point3DItem : MonoBehaviour private void OnObjDestroy(OnPoint3DQuestionDestroy destroy) { + if (gameObject != null) + { + GameObject.Destroy(gameObject); + } + } + private void OnDestroy() + { + TypeEventSystem.Global.UnRegister(OnStepChanged); - GameObject.Destroy(gameObject); + TypeEventSystem.Global.UnRegister(OnObjDestroy); } private void OnMouseUpAsButton() diff --git a/Assets/Scripts/UI/UISetting.cs b/Assets/Scripts/UI/UISetting.cs index 1e4199b8..c64c3346 100644 --- a/Assets/Scripts/UI/UISetting.cs +++ b/Assets/Scripts/UI/UISetting.cs @@ -15,9 +15,11 @@ namespace QFramework.Example mData = uiData as UISettingData ?? new UISettingData(); AudioKit.Settings.MusicVolume.RegisterWithInitValue(v => VoiceSlider.value = v).UnRegisterWhenGameObjectDestroyed(this); + AudioKit.Settings.VoiceVolume.RegisterWithInitValue(v => VoiceSlider.value = v).UnRegisterWhenGameObjectDestroyed(this); VoiceSlider.onValueChanged.AddListener(volume => { AudioKit.Settings.MusicVolume.Value = volume; + AudioKit.Settings.VoiceVolume.Value = volume; }); Global.appSetting.MouseMoveSpeed.RegisterWithInitValue(v => MouseSlider.value = v).UnRegisterWhenGameObjectDestroyed(this); @@ -48,6 +50,10 @@ namespace QFramework.Example { AudioKit.Settings.MusicVolume.Value += value; } + if (AudioKit.Settings.VoiceVolume.Value > 0.1f && AudioKit.Settings.VoiceVolume.Value < 1f) + { + AudioKit.Settings.VoiceVolume.Value += value; + } }