From 669588ab688e1c2eec00fdfc2349491e1720ae94 Mon Sep 17 00:00:00 2001 From: minenice55 Date: Wed, 25 Jan 2023 10:28:51 -0500 Subject: [PATCH] fix config creation collisions (#239) --- Assets/Scripts/GlobalGameManager.cs | 1 - .../SettingsDialog/Tabs/DispAudioSettings.cs | 13 ++++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/GlobalGameManager.cs b/Assets/Scripts/GlobalGameManager.cs index 552d72c8..01a28699 100644 --- a/Assets/Scripts/GlobalGameManager.cs +++ b/Assets/Scripts/GlobalGameManager.cs @@ -171,7 +171,6 @@ namespace HeavenStudio { MasterVolume = value; AudioListener.volume = MasterVolume; - PersistentDataManager.gameSettings.masterVolume = MasterVolume; } void OnApplicationQuit() diff --git a/Assets/Scripts/LevelEditor/SettingsDialog/Tabs/DispAudioSettings.cs b/Assets/Scripts/LevelEditor/SettingsDialog/Tabs/DispAudioSettings.cs index 3527bf43..15654e92 100644 --- a/Assets/Scripts/LevelEditor/SettingsDialog/Tabs/DispAudioSettings.cs +++ b/Assets/Scripts/LevelEditor/SettingsDialog/Tabs/DispAudioSettings.cs @@ -4,6 +4,7 @@ using UnityEngine.UI; using TMPro; +using HeavenStudio.Common; namespace HeavenStudio.Editor { public class DispAudioSettings : TabsContent @@ -26,7 +27,6 @@ namespace HeavenStudio.Editor dropDownData.Add(optionData); } resolutionsDropdown.AddOptions(dropDownData); - resolutionsDropdown.value = GlobalGameManager.ScreenSizeIndex; resolutionsDropdown.onValueChanged.AddListener(delegate { @@ -46,6 +46,8 @@ namespace HeavenStudio.Editor heightInputField.text = GlobalGameManager.CustomScreenHeight.ToString(); }); + resolutionsDropdown.value = GlobalGameManager.ScreenSizeIndex; + widthInputField.text = GlobalGameManager.CustomScreenWidth.ToString(); heightInputField.text = GlobalGameManager.CustomScreenHeight.ToString(); @@ -67,16 +69,25 @@ namespace HeavenStudio.Editor { GlobalGameManager.ChangeMasterVolume(volSlider.value); volLabel.text = System.Math.Round(volSlider.value * 100, 2).ToString(); + PersistentDataManager.gameSettings.masterVolume = volSlider.value; } public void OnVolLabelChanged() { volSlider.value = (float)System.Math.Round(System.Convert.ToSingle(volLabel.text) / 100f, 2); GlobalGameManager.ChangeMasterVolume(volSlider.value); + PersistentDataManager.gameSettings.masterVolume = volSlider.value; } public override void OnOpenTab() { + resolutionsDropdown.value = GlobalGameManager.ScreenSizeIndex; + + widthInputField.text = GlobalGameManager.CustomScreenWidth.ToString(); + heightInputField.text = GlobalGameManager.CustomScreenHeight.ToString(); + + volSlider.value = GlobalGameManager.MasterVolume; + volLabel.text = System.Math.Round(volSlider.value * 100, 2).ToString(); } public override void OnCloseTab()