修改bug

This commit is contained in:
shenjianxing 2025-01-22 12:58:27 +08:00
parent 614b3e4425
commit 605c4b1ada
2 changed files with 16 additions and 2 deletions

View File

@ -37,7 +37,7 @@ public class Point3DItem : MonoBehaviour
} }
rotSpeed = data.rotateSpeed; rotSpeed = data.rotateSpeed;
gameObject.GetComponent<SpriteRenderer>().sortingOrder = data.order; gameObject.GetComponent<SpriteRenderer>().sortingOrder = data.order;
TypeEventSystem.Global.Register<OnPoint3DQuestionDestroy>(OnObjDestroy).UnRegisterWhenGameObjectDestroyed(gameObject); TypeEventSystem.Global.Register<OnPoint3DQuestionDestroy>(OnObjDestroy);
TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged); TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged);
} }
@ -49,9 +49,17 @@ public class Point3DItem : MonoBehaviour
private void OnObjDestroy(OnPoint3DQuestionDestroy destroy) private void OnObjDestroy(OnPoint3DQuestionDestroy destroy)
{ {
TypeEventSystem.Global.UnRegister<StepStatusOnChange>(OnStepChanged); if (gameObject != null)
{
GameObject.Destroy(gameObject); GameObject.Destroy(gameObject);
} }
}
private void OnDestroy()
{
TypeEventSystem.Global.UnRegister<StepStatusOnChange>(OnStepChanged);
TypeEventSystem.Global.UnRegister<OnPoint3DQuestionDestroy>(OnObjDestroy);
}
private void OnMouseUpAsButton() private void OnMouseUpAsButton()
{ {

View File

@ -15,9 +15,11 @@ namespace QFramework.Example
mData = uiData as UISettingData ?? new UISettingData(); mData = uiData as UISettingData ?? new UISettingData();
AudioKit.Settings.MusicVolume.RegisterWithInitValue(v => VoiceSlider.value = v).UnRegisterWhenGameObjectDestroyed(this); AudioKit.Settings.MusicVolume.RegisterWithInitValue(v => VoiceSlider.value = v).UnRegisterWhenGameObjectDestroyed(this);
AudioKit.Settings.VoiceVolume.RegisterWithInitValue(v => VoiceSlider.value = v).UnRegisterWhenGameObjectDestroyed(this);
VoiceSlider.onValueChanged.AddListener(volume => VoiceSlider.onValueChanged.AddListener(volume =>
{ {
AudioKit.Settings.MusicVolume.Value = volume; AudioKit.Settings.MusicVolume.Value = volume;
AudioKit.Settings.VoiceVolume.Value = volume;
}); });
Global.appSetting.MouseMoveSpeed.RegisterWithInitValue(v => MouseSlider.value = v).UnRegisterWhenGameObjectDestroyed(this); Global.appSetting.MouseMoveSpeed.RegisterWithInitValue(v => MouseSlider.value = v).UnRegisterWhenGameObjectDestroyed(this);
@ -48,6 +50,10 @@ namespace QFramework.Example
{ {
AudioKit.Settings.MusicVolume.Value += value; AudioKit.Settings.MusicVolume.Value += value;
} }
if (AudioKit.Settings.VoiceVolume.Value > 0.1f && AudioKit.Settings.VoiceVolume.Value < 1f)
{
AudioKit.Settings.VoiceVolume.Value += value;
}
} }