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

[FEATURE] dynamic key hint text #398

Open
jpw1991 opened this issue Apr 17, 2023 · 1 comment
Open

[FEATURE] dynamic key hint text #398

jpw1991 opened this issue Apr 17, 2023 · 1 comment

Comments

@jpw1991
Copy link

jpw1991 commented Apr 17, 2023

I want to be able to change key hint text without having to recreate the whole button.

Envisioned Solution
Button.Hint = "new string"; immediately reflected in GUI

Additional context
I have a situation where I would like users to be able to cycle through options with one key (next minion) and then the create minion button reflects the current selection:

B - Create Warrior

B - Create Archer

So on and so forth.

@jpw1991
Copy link
Author

jpw1991 commented Apr 17, 2023

I am currently doing this as a workaround:

                CreateMinionButton = new ButtonConfig
                {
                    Name = ItemName + "CreateMinion",
                    Config = CreateMinionConfig,
                    GamepadConfig = CreateMinionGamepadConfig,
                    HintToken = "$chebgonaz_wand_createminion",
                    BlockOtherInputs = true
                };
                InputManager.Instance.AddButton(BasePlugin.PluginGuid, CreateMinionButton);

                ...

                if (_createMinionButtonText == null)
                {
                    var button = GameObject.Find(CreateMinionButton.Name);
                    if (button != null)
                    {
                        _createMinionButtonText = button.GetComponentInChildren<Text>();
                    }   
                }
                
                _createMinionButtonText.text = $"Create {SelectedMinionOption}";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant