Ejemplo n.º 1
0
 public static void Border(Anchor posMin, Anchor posMax, ref CuiElementContainer container, float borderSize = 0.001f, string color = "1 1 1 1", string parent = "Overlay")
 {
     Element("", parent, ref container, posMin, new Anchor(posMax.X, posMin.Y + (borderSize * 2)), "1 1 1 1");
     Element("", parent, ref container, new Anchor(posMin.X, posMax.Y - (borderSize * 2)), posMax, "1 1 1 1");
     Element("", parent, ref container, posMin, new Anchor(posMin.X + borderSize, posMax.Y), "1 1 1 1");
     Element("", parent, ref container, new Anchor(posMax.X, posMin.Y), new Anchor(posMax.X + borderSize, posMax.Y), "1 1 1 1");
 }
Ejemplo n.º 2
0
 public static void Text(string name, string parent, ref CuiElementContainer container, TextAnchor anchor,
                         string color, int fontSize, string text,
                         Anchor Min, Anchor Max, string font = "robotocondensed-bold.ttf", float fadeOut = 0f,
                         float fadeIn = 0f)
 {
     container.Add(new CuiElement()
     {
         Name       = name,
         Parent     = parent,
         FadeOut    = fadeOut,
         Components =
         {
             new CuiTextComponent()
             {
                 Text     = text,
                 Align    = anchor,
                 FontSize = fontSize,
                 Font     = font,
                 FadeIn   = fadeIn,
                 Color    = color
             },
             new CuiRectTransformComponent()
             {
                 AnchorMin = $"{Min.X} {Min.Y}",
                 AnchorMax = $"{Max.X} {Max.Y}"
             }
         }
     });
 }
Ejemplo n.º 3
0
 public static void Button(string name, string parent, ref CuiElementContainer container, Anchor Min,
                           Anchor Max, string command, string text, string textColor,
                           int fontSize, string color = "1 1 1 1", TextAnchor anchor = TextAnchor.MiddleCenter, float fadeOut = 0f,
                           float fadeIn = 0f, string font = "robotocondensed-bold.ttf")
 {
     container.Add(new CuiButton()
     {
         FadeOut = fadeOut,
         Button  =
         {
             Color   = color,
             Command = command,
         },
         RectTransform =
         {
             AnchorMin = $"{Min.X} {Min.Y}",
             AnchorMax = $"{Max.X} {Max.Y}"
         },
         Text =
         {
             Text     = text,
             Color    = textColor,
             Align    = anchor,
             Font     = font,
             FontSize = fontSize,
             FadeIn   = fadeIn
         }
     }, parent, name);
 }
Ejemplo n.º 4
0
        public static CuiElementContainer Container(string name, string bgColor, Anchor Min, Anchor Max,
                                                    string parent = "Overlay", float fadeOut = 0f, float fadeIn = 0f)
        {
            var newElement = new CuiElementContainer()
            {
                new CuiElement()
                {
                    Name       = name,
                    Parent     = parent,
                    FadeOut    = fadeOut,
                    Components =
                    {
                        new CuiImageComponent()
                        {
                            Color  = bgColor,
                            FadeIn = fadeIn
                        },
                        new CuiRectTransformComponent()
                        {
                            AnchorMin = $"{Min.X} {Min.Y}",
                            AnchorMax = $"{Max.X} {Max.Y}"
                        }
                    }
                },
            };

            return(newElement);
        }
Ejemplo n.º 5
0
 public static void Panel(string name, string parent, ref CuiElementContainer container, string bgColor,
                          Anchor Min, Anchor Max, bool cursor = false)
 {
     container.Add(new CuiPanel()
     {
         Image =
         {
             Color = bgColor
         },
         CursorEnabled = cursor,
         RectTransform =
         {
             AnchorMin = $"{Min.X} {Min.Y}",
             AnchorMax = $"{Max.X} {Max.Y}"
         }
     }, parent, name);
 }
Ejemplo n.º 6
0
 public static void Element(string name, string parent, ref CuiElementContainer container, Anchor Min, Anchor Max,
                            string bgColor, string material = "", float fadeOut = 0f, float fadeIn = 0f)
 {
     container.Add(new CuiElement()
     {
         Name       = name,
         Parent     = parent,
         FadeOut    = fadeOut,
         Components =
         {
             new CuiImageComponent()
             {
                 Color  = bgColor,
                 FadeIn = fadeIn
             },
             new CuiRectTransformComponent()
             {
                 AnchorMin = $"{Min.X} {Min.Y}",
                 AnchorMax = $"{Max.X} {Max.Y}"
             }
         }
     });
 }
Ejemplo n.º 7
0
 public static void Label(string name, string parent, ref CuiElementContainer container, Anchor Min, Anchor Max,
                          string text, string color = "1 1 1 1", int fontSize = 15, TextAnchor textAnchor = TextAnchor.MiddleCenter,
                          string font = "robotocondensed-bold.ttf")
 {
     container.Add(new CuiLabel()
     {
         Text =
         {
             Align    = textAnchor,
             Color    = color,
             Font     = font,
             FontSize = fontSize
         },
         RectTransform =
         {
             AnchorMin = $"{Min.X} {Min.Y}",
             AnchorMax = $"{Max.X} {Max.Y}"
         }
     }, parent, name);
 }
Ejemplo n.º 8
0
 public ConfigAnchor(Anchor min, Anchor max)
 {
     Min = min;
     Max = max;
 }