Supported Games
This plugin is for use with the CuiBuilder program.
The usual way to create a GUI for a plugin: Come up with UI/UX, draw in the image editor, then carefully move element by element into the code, okay moved, now you need to update it all every 5 seconds with a new value for each player - "Oh my God, how difficult it is"
Features
Immediately throw the layout in CuiBuilder, throw commands on the buttons and put {N} where we will change the value, press Ctrl E (export CuiDB.json) we throw the database guishek in data/CuiGenerator, reload this plugin-CuiGenerator and we can easily add GUI to different players, with different arguments and change the same arguments by calling DrawUI or DrawUIWithEx again.
This is the smallest part of what CuiGenerator can do, it is very well optimized, if you call DrawUI in a row with the same arguments, the request to create a GUI will be sent to the player only 1 time.Next, changing the arguments: a laborious work was carried out and a smart algorithm was written that changes only those elements that affected the argument, let's say you have two pictures that are superimposed on each other, if you change the one that is behind, the front will remain on the front layer.
Generally use on health, this miracle is free, ask questions in the thread of the plugin.
Usage
Save the function Ctrl E (export CuiDB.json) and throw the database in data / CuiGenerator:
Insert this code into your plugin.
[PluginReference]
private Plugin CuiGenerator;
private void DrawUI(BasePlayer player, string plugin, string funcName, params object[] args)
{
CuiGenerator?.Call("DrawUI",player, plugin, funcName, args);
}
private void DrawUIWIthEx(BasePlayer player, string plugin, string funcName, CuiElementContainer additionalContainer, params object[] args)
{
CuiGenerator?.Call("DrawUIWIthEx",player, plugin, funcName, additionalContainer, args);
}
private void DestroyUI(BasePlayer player, string plugin, string funcName)
{
CuiGenerator?.Call("DestroyUI",player, plugin, funcName);
}
Then the simplest usage example:
[ChatCommand("craft")]
private void cmdChatCraft(BasePlayer player, string command, string[] args)
{
if (args.Length > 0 && args[0] == "close")
{
DestroyUI(player, "mycraft", "menu")
return;
}
// Arguments: player, plugin name, function name
DrawUI(player, "mycraft", "menu");
}
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

