-
Notifications
You must be signed in to change notification settings - Fork 9
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Problem Description
1.IOption.Visible IOption.Enabled needs to add setter,This is usually used to modify its state in callback delegation.
2.Creating a disable option is beneficial for generating a non interactive option for viewing.
Proposed Solution
1.Add more setters
// SwiftlyS2.Shared.Menus.IOption
bool Visible { get;set; }
bool Enabled { get;set; }2.Add Enable status option
IMenuBuilder AddText(string text, bool Enable=true,...);
IMenuBuilder AddButton(string text, bool Enable=true,...);
// Other types of options
...Alternative Solutions
No response
Use Case
1.Add more setters
IMenu menu = Core.Menus.CreateMenu("test");
menu.Builder.AddAsyncButton("buy!", async (p,option) =>
{
await Task.Delay(2000);
p.PrintToChat("successful!!");
option.Enabled = false; // Disable this option after buy
});
Core.Menus.OpenMenu(player, menu);2.Add enable parameter when Builder.AddOptions
// var (enable, itemName) = new Tuple<bool, string>(false,"item1");
var (enable,itemName) = await service.GetItem(player);
IMenu menu = Core.Menus.CreateMenu("test");
menu.Builder.AddText($"[{(enable?"ENABLE":"DISABLE")}] {itemName}", Enable:enable); // opening the menu, it should not be selected
menu.Builder.AddText("abc");
Core.Menus.OpenMenu(player, menu);Implementation Ideas
about Add enable parameter when Builder.AddOptions
1.If the menu only has one disabled option, it should not be operable and cannot be selected. Attempting to move should sound a warning sound
2.After disabling the selected option, it should automatically move to the next or previous item If the last option is disabled, move to the previous one. If it is not the last option, move to the next one
Priority
Low
Contribution
- I'm willing to implement this feature myself
- I can help with testing
- I can help with documentation
- I can provide feedback during development
Additional Context
No response
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request