Skip to content

Commit

Permalink
added newgame activator support
Browse files Browse the repository at this point in the history
  • Loading branch information
samjones246 committed Jun 21, 2022
1 parent dd4770b commit ca9dc3b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
3 changes: 2 additions & 1 deletion RPGMMV-LiveSplit-GUI/Activators/ActivatorPanel.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 23 additions & 5 deletions RPGMMV-LiveSplit-GUI/Activators/ActivatorPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public ActivatorPanel()

private void cbxType_SelectedIndexChanged(object sender, EventArgs e)
{
SetType(((string)cbxType.SelectedItem).ToLower());
SetType(((string)cbxType.SelectedItem).ToLower().Replace(" ", ""));
}

private void ActivatorPanel_Load(object sender, EventArgs e)
Expand All @@ -45,18 +45,30 @@ private void ActivatorPanel_Load(object sender, EventArgs e)

public Activator GetData()
{
return subPanel.GetData();
if (subPanel != null)
{
return subPanel.GetData();
}
else
{
Activator activator = new Activator();
activator.Type = ((string)cbxType.SelectedItem).ToLower().Replace(" ", "");
return activator;
}
}

public void SetData(Activator data)
{
SetType(data.Type);
subPanel.SetData(data);
if (subPanel != null)
{
subPanel.SetData(data);
}
}

private void SetType(string type)
{
cbxType.SelectedItem = type.Substring(0, 1).ToUpper() + type.Substring(1);
cbxType.SelectedItem = type == "newgame" ? "New Game" : type.Substring(0, 1).ToUpper() + type.Substring(1);
Controls.Remove(subPanel);
switch (type)
{
Expand All @@ -72,8 +84,14 @@ private void SetType(string type)
case "variable":
subPanel = subPanel_variable;
break;
case "newgame":
subPanel = null;
break;
}
if (subPanel != null)
{
Controls.Add(subPanel);
}
Controls.Add(subPanel);
}
}

Expand Down

0 comments on commit ca9dc3b

Please sign in to comment.