fix config creation collisions (#239)

This commit is contained in:
minenice55 2023-01-25 10:28:51 -05:00 committed by GitHub
parent a8b6f345a2
commit 669588ab68
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View file

@ -171,7 +171,6 @@ namespace HeavenStudio
{ {
MasterVolume = value; MasterVolume = value;
AudioListener.volume = MasterVolume; AudioListener.volume = MasterVolume;
PersistentDataManager.gameSettings.masterVolume = MasterVolume;
} }
void OnApplicationQuit() void OnApplicationQuit()

View file

@ -4,6 +4,7 @@ using UnityEngine.UI;
using TMPro; using TMPro;
using HeavenStudio.Common;
namespace HeavenStudio.Editor namespace HeavenStudio.Editor
{ {
public class DispAudioSettings : TabsContent public class DispAudioSettings : TabsContent
@ -26,7 +27,6 @@ namespace HeavenStudio.Editor
dropDownData.Add(optionData); dropDownData.Add(optionData);
} }
resolutionsDropdown.AddOptions(dropDownData); resolutionsDropdown.AddOptions(dropDownData);
resolutionsDropdown.value = GlobalGameManager.ScreenSizeIndex;
resolutionsDropdown.onValueChanged.AddListener(delegate resolutionsDropdown.onValueChanged.AddListener(delegate
{ {
@ -46,6 +46,8 @@ namespace HeavenStudio.Editor
heightInputField.text = GlobalGameManager.CustomScreenHeight.ToString(); heightInputField.text = GlobalGameManager.CustomScreenHeight.ToString();
}); });
resolutionsDropdown.value = GlobalGameManager.ScreenSizeIndex;
widthInputField.text = GlobalGameManager.CustomScreenWidth.ToString(); widthInputField.text = GlobalGameManager.CustomScreenWidth.ToString();
heightInputField.text = GlobalGameManager.CustomScreenHeight.ToString(); heightInputField.text = GlobalGameManager.CustomScreenHeight.ToString();
@ -67,16 +69,25 @@ namespace HeavenStudio.Editor
{ {
GlobalGameManager.ChangeMasterVolume(volSlider.value); GlobalGameManager.ChangeMasterVolume(volSlider.value);
volLabel.text = System.Math.Round(volSlider.value * 100, 2).ToString(); volLabel.text = System.Math.Round(volSlider.value * 100, 2).ToString();
PersistentDataManager.gameSettings.masterVolume = volSlider.value;
} }
public void OnVolLabelChanged() public void OnVolLabelChanged()
{ {
volSlider.value = (float)System.Math.Round(System.Convert.ToSingle(volLabel.text) / 100f, 2); volSlider.value = (float)System.Math.Round(System.Convert.ToSingle(volLabel.text) / 100f, 2);
GlobalGameManager.ChangeMasterVolume(volSlider.value); GlobalGameManager.ChangeMasterVolume(volSlider.value);
PersistentDataManager.gameSettings.masterVolume = volSlider.value;
} }
public override void OnOpenTab() 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() public override void OnCloseTab()