Skip to content

Commit

Permalink
Fixed settings menu not setting groups properly when loading into the…
Browse files Browse the repository at this point in the history
… lyric editor settings directly before initialisation. Fixed exception when trying to parse raw decimal point as float.
  • Loading branch information
FireFox2000000 committed Oct 29, 2022
1 parent bd9228b commit a1912af
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,8 @@ protected override void Awake()
menuContextArea = settingsMenuContentArea;
}

protected override void Start()
protected void Start()
{
base.Start();

sustainGapInput.onValidateInput = Step.validateStepVal;
sustainGapInput.text = Globals.gameSettings.sustainGap.ToString();
sustainGapTimeInput.text = Globals.gameSettings.sustainGapTimeMs.ToString();
Expand All @@ -90,9 +88,13 @@ protected override void Update()
sustainGapTimeInput.text = Globals.gameSettings.sustainGapTimeMs.ToString();
}

if (!string.IsNullOrEmpty(lyricEditorPhaseEndTimeInput.text) && float.Parse(lyricEditorPhaseEndTimeInput.text) != Globals.gameSettings.lyricEditorSettings.phaseEndThreashold)
{
lyricEditorPhaseEndTimeInput.text = Globals.gameSettings.lyricEditorSettings.phaseEndThreashold.ToString();
float phaseEndTimeInput = 0;
bool parseSuccess = float.TryParse(lyricEditorPhaseEndTimeInput.text, out phaseEndTimeInput);
if (!string.IsNullOrEmpty(lyricEditorPhaseEndTimeInput.text) && (phaseEndTimeInput != Globals.gameSettings.lyricEditorSettings.phaseEndThreashold || lyricEditorPhaseEndTimeInput.text.StartsWith(".")))
{
lyricEditorPhaseEndTimeInput.text = Globals.gameSettings.lyricEditorSettings.phaseEndThreashold.ToString();
}
}

// Set all variables' values based on the UI
Expand Down Expand Up @@ -492,7 +494,6 @@ public void UnmuteAllStems()
public void OpenLyricEditorSettings()
{
lyricEditorButton.onClick.Invoke();
initialMenuItemSet = true;
}

public void SetLyricEditorStepSnappingEnabled(bool value)
Expand All @@ -503,9 +504,9 @@ public void SetLyricEditorStepSnappingEnabled(bool value)
public void OnLyricEditorPhaseEndTimeInputUpdated(string value)
{
float timeVal = 0;
if (!string.IsNullOrEmpty(value))
if (!string.IsNullOrEmpty(value) && !float.TryParse(value, out timeVal))
{
timeVal = float.Parse(value);
return;
}

Globals.gameSettings.lyricEditorSettings.phaseEndThreashold = timeVal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ public class SongPropertiesPanelController : TabMenu
Dictionary<Song.AudioInstrument, Text> m_audioStreamTextLookup;
readonly string[] INI_SECTION_HEADER = { "Song", "song" };

protected override void Start()
protected void Start()
{
base.Start();
offset.onValidateInput = LocalesManager.ValidateDecimalInput;

songName.onValidateInput = ValidateStringMetadataInput;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ public class TabMenu : DisplayMenu
protected RectTransform menuContextArea = null;
protected bool initialMenuItemSet = false;

protected virtual void Start()
protected override void Awake()
{
base.Awake();

if (!initialMenuItemSet)
{
ResetToInitialMenuItem();
Expand Down

0 comments on commit a1912af

Please sign in to comment.