Help in CUI

Discussion in 'Rust Development' started by misha1979, Jan 7, 2018.

  1. Hi, I recently started to remodel some plugins for myself, add sounds, change the interface.
    Even wrote the plugin redirecting commands:
    /kits => /kit
    /help => /info
    And I'm not going to stop, but can help me?
    I need the material:
    How to create a user interface?
    [DOUBLEPOST=1515360554][/DOUBLEPOST]And
    Cui - Text UI?
    Gui - Graphic?
    [DOUBLEPOST=1515360619][/DOUBLEPOST]I do not know where to start, my eyes run out.
    So many opportunities, but I miss everything(
     
  2. Simple example (very old plugin):
    Code:
    void Rules(BasePlayer player)
            {
                CuiHelper.DestroyUi(player, "RulesGUI");
                var elements = new CuiElementContainer(); //Êîíòåéíåð äëÿ ýëåìåíòîâ ÃÓÈ
                //-------------ÎÒÐÈÑÎÂÊÀ ÃÓÈ-------------
                var mainName = elements.Add(new CuiPanel
                {
                    FadeOut = 1.0f,
                    Image =
                    {
                        Color = "0.1 0.1 0.1 0"
                    },
                    RectTransform =
                    {
                        AnchorMin = "0.3445 0.115",
                        AnchorMax = "0.6395 0.135"
                    },
                    CursorEnabled = false
                }, "Hud", "RulesGUI");
                elements.Add(new CuiElement
                {
                    FadeOut = 1.0f,
                    Parent = "RulesGUI",
                    Components =
                        {
                            new CuiRawImageComponent
                            {
                                FadeIn = 1.0f,
                                Url = "http://i.imgur.com/nBtBdI1.png",
                                Sprite = "assets/content/textures/generic/fulltransparent.tga"
                            },
                            new CuiRectTransformComponent
                            {
                                AnchorMin = "0 0",
                                AnchorMax = "1 1"
                            }
                        }
                });
                //-------------Âûâîä íà ýêðàí-------------
                CuiHelper.AddUi(player, elements);
                //-------------ÎÒÐÈÑÎÂÊÀ ÃÓÈ-------------
            }
    Then every where you want: Rules(player);