I'm not able to find any documentation of the CuiHelper class
Tho I found a little demo on some forum for a while ago but it doesn't seem to actuelly work, nothing happens when the command is executed (no error messages either)
[Command("cui")]
private void cmdCui(BasePlayer player, string command, string[] args)
{
var elements = new CuiElementContainer();
var mainName = elements.Add(new CuiPanel
{
Image =
{
Color = "0.1 0.1 0.1 1"
},
RectTransform =
{
AnchorMin = "0.8 0.25",
AnchorMax = "0.995 0.8"
},
CursorEnabled = true
});
var closeButton = new CuiButton
{
Button =
{
Close = mainName,
Color = "0.8 0.8 0.8 0.2"
},
RectTransform =
{
AnchorMin = "0.86 0.92",
AnchorMax = "0.97 0.98"
},
Text =
{
Text = "X",
FontSize = 22,
Align = TextAnchor.MiddleCenter
}
};
elements.Add(closeButton, mainName);
for (var i = 2; i < 10; i++)
{
elements.Add(new CuiLabel
{
Text =
{
Text = "hello " + i,
FontSize = 18,
Align = TextAnchor.MiddleCenter
},
RectTransform =
{
AnchorMin = $"0.06 {1 - 0.07*i + 0.006}",
AnchorMax = $"0.75 {1 - 0.07*(i - 1)}"
}
}, mainName);
elements.Add(new CuiButton
{
Button =
{
Command = "cui" + i,
Color = "0.8 0.8 0.8 0.2"
},
RectTransform =
{
AnchorMin = $"0.76 {1 - 0.07*i + 0.006}",
AnchorMax = $"0.87 {1 - 0.07*(i - 1)}"
},
Text =
{
Text = "+",
FontSize = 22,
Align = TextAnchor.MiddleCenter
}
}, mainName);
}
Puts(elements.ToString());
CuiHelper.AddUi(player, elements);
}