Now i'm not a coder, but i've managed to make this work after a few hours of trial and error, changing methods, learning as i go, untill i figured it out.
I doubt this is the propper method
and I'm not sure if this will cause any trouble with the code trying to close an unnamed CUI, but i don't see any errors.
I modified the code to allow buttons to close the menu, enabling me to create an actual close "button".
This works on all buttons though and can also execute the command attached to it, even if the button opens another menu.
inside "private class ConfigButton" just below:
I doubt this is the propper method
and I'm not sure if this will cause any trouble with the code trying to close an unnamed CUI, but i don't see any errors.
I modified the code to allow buttons to close the menu, enabling me to create an actual close "button".
This works on all buttons though and can also execute the command attached to it, even if the button opens another menu.
inside "private class ConfigButton" just below:
[JsonProperty(PropertyName = "Executing command")]
public string Command = "/tpa";add:[JsonProperty(PropertyName = "Close Menu")]
public bool CloseMenu = false;You can change the "false" to "true" if you want the default setting to close buttons.
In the "Loading buttons" for loop add the folowing two lines:
Below:
var type = button.IsChatCommand ? "chat" : "console";add:
var isClose = button.CloseMenu ? "GameMenuCUI" : "";And also inside same loop, just below:
Button =
{
add
Close = $"{isClose}",