Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Menu options showing incorrect chosen value for enum-based [Choice] when using custom string names. #231

Merged
merged 2 commits into from
Jul 8, 2021

Conversation

toebeann
Copy link
Contributor

@toebeann toebeann commented Jul 8, 2021

Changes made in this pull request

  • Resolves an issue where passing custom string names for enum-based Choice was incorrectly displaying the choice as if the first option was selected when the menu is first built, regardless of what option is actually selected.

Example:

[Choice(label: "Desired fullscreen mode",
        "Exclusive fullscreen", "Windowed fullscreen", "Windowed")]
public FullscreenMode DesiredFullscreenMode { get; set; } = FullscreenMode.WindowedFullscreen;

public enum FullscreenMode
{
    ExclusiveFullscreen,
    WindowedFullscreen,
    Windowed
}

In the above instance, on first load, despite the fact the default is WindowedFullscreen, SMLHelper is always assuming it is the 0 index when the mod options are built ("Exclusive fullscreen").

Builds 9e54041

Subnautica

Stable
Experimental

Below Zero

Stable
Experimental

…hoice` was incorrectly displaying the choice as if the first option was selected when the menu is first built, regardless of what option is actually selected.
@toebeann toebeann merged commit 158234d into dev Jul 8, 2021
@toebeann toebeann deleted the enum-choice-custom-names-bugfix branch July 8, 2021 18:04
@toebeann toebeann mentioned this pull request Jul 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants