Пример #1
0
 public static void Label(ref CuiElementContainer container, string text, int size, string color, UiPosition pos, TextAnchor align = TextAnchor.MiddleCenter)
 {
     container.Add(new CuiLabel
     {
         Text          = { FontSize = size, Align = align, Text = text, Color = color },
         RectTransform = { AnchorMin = pos.GetMin(), AnchorMax = pos.GetMax() }
     },
                   UiPanel);
 }
Пример #2
0
 public static CuiElementContainer Container(string color, UiPosition pos, string panel, string parent = "Hud")
 {
     UiPanel = panel;
     return(new CuiElementContainer
     {
         {
             new CuiPanel
             {
                 Image = { Color = color },
                 RectTransform = { AnchorMin = pos.GetMin(), AnchorMax = pos.GetMax() },
                 CursorEnabled = false
             },
             new CuiElement().Parent = parent,
             panel
         }
     });
 }
Пример #3
0
            public static void Image(ref CuiElementContainer container, string png, string color, UiPosition pos)
            {
                uint value;
                bool isPng = uint.TryParse(png, out value);

                container.Add(new CuiElement
                {
                    Name       = CuiHelper.GetGuid(),
                    Parent     = UiPanel,
                    Components =
                    {
                        new CuiRawImageComponent      {
                            Color = color, Png = isPng ? png : null, Url = !isPng ? png : null
                        },
                        new CuiRectTransformComponent {
                            AnchorMin = pos.GetMin(), AnchorMax = pos.GetMax()
                        }
                    }
                });
            }