Skip to content

Commit

Permalink
Update ModChoiceOption.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
MrPurple6411 committed Jan 19, 2023
1 parent e76e595 commit 187692b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions SMLHelper/Options/ModChoiceOption.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ public ChoiceChangedEventArgs(string id, int index, T value) : base(id, value)
/// </summary>
public class ModChoiceOption<T> : ModOption<T, ChoiceChangedEventArgs<T>>
{
/// <summary>
/// The actual <see cref="uGUI_Choice"/> when the menu is open.
/// </summary>
public uGUI_Choice Choice { get; private set; }

/// <summary>
/// The array of readable string options to choose between in the <see cref="ModChoiceOption{T}"/>.
/// </summary>
Expand All @@ -47,7 +52,7 @@ public class ModChoiceOption<T> : ModOption<T, ChoiceChangedEventArgs<T>>
/// <summary>
/// The currently selected index among the options array.
/// </summary>
public int Index { get; }
public int Index { get; private set; }

/// <summary>
/// The tooltip to show when hovering over the option.
Expand All @@ -61,13 +66,14 @@ public class ModChoiceOption<T> : ModOption<T, ChoiceChangedEventArgs<T>>
/// <param name="tabIndex">Where in the panel to add the option.</param>
public override void AddToPanel(uGUI_TabbedControlsPanel panel, int tabIndex)
{
uGUI_Choice choice = panel.AddChoiceOption(tabIndex, Label, OptionStrings, Index,
Choice = panel.AddChoiceOption(tabIndex, Label, OptionStrings, Index,
new UnityAction<int>((int index) => {
Index = index;
OnChange(Id, Options[index]);
parentOptions.OnChange<T, ChoiceChangedEventArgs<T>>(Id, Options[index]);
}), Tooltip);

OptionGameObject = choice.transform.parent.transform.parent.gameObject; // :(
OptionGameObject = Choice.transform.parent.transform.parent.gameObject; // :(

base.AddToPanel(panel, tabIndex);
}
Expand Down

0 comments on commit 187692b

Please sign in to comment.