Skip to content

Commit

Permalink
-Added OnClose() Function to ModSetingsMenu
Browse files Browse the repository at this point in the history
-Fixed an index out of range exception
  • Loading branch information
Nagord committed Jan 14, 2022
1 parent 2c4a0dc commit e039609
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
17 changes: 10 additions & 7 deletions PulsarModLoader/CustomGUI/GUIMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,24 +126,27 @@ void WindowFunction(int WindowID)
{
if (selectedSettings == ushort.MaxValue)
{
var length = settings.Count;
for (ushort msm = 0; msm < length; msm++)
for (ushort msm = 0; msm < settings.Count; msm++)
{
var FSettings = settings[msm];
if (Button(FSettings.Name()))
if (Button(settings[msm].Name()))
{
selectedSettings = msm;
settings[msm].OnOpen();
selectedSettings = msm;
break;
}
}
}
else
{
if (Button("Back"))
{
settings[selectedSettings].OnClose();
selectedSettings = ushort.MaxValue;

settings[selectedSettings].Draw();
}
else
{
settings[selectedSettings].Draw();
}
}
}
EndScrollView();
Expand Down
1 change: 1 addition & 0 deletions PulsarModLoader/CustomGUI/ModSettingsMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ public abstract class ModSettingsMenu
public abstract string Name();
public abstract void Draw();
public virtual void OnOpen() { }
public virtual void OnClose() { }
}
}

0 comments on commit e039609

Please sign in to comment.