Beispiel #1
0
 public string Add(CuiLabel label, string parent = "Hud", string name = null)
 {
     if (string.IsNullOrEmpty(name))
     {
         name = CuiHelper.GetGuid();
     }
     Add(new CuiElement
     {
         Name       = name,
         Parent     = parent,
         Components =
         {
             label.Text,
             label.RectTransform
         }
     });
     return(name);
 }
        public string Add(CuiLabel label, string parent = "Hud", string name = null)
        {
            if (String.IsNullOrEmpty(name))
            {
                name = CuiHelper.GetGuid();
            }
            CuiElement cuiElement = new CuiElement()
            {
                Name    = name,
                Parent  = parent,
                FadeOut = label.FadeOut
            };

            cuiElement.Components.Add(label.Text);
            cuiElement.Components.Add(label.RectTransform);
            base.Add(cuiElement);
            return(name);
        }
Beispiel #3
0
        public string Add(CuiPanel panel, string parent = "Hud", string name = null)
        {
            if (string.IsNullOrEmpty(name))
            {
                name = CuiHelper.GetGuid();
            }

            CuiElement element = new CuiElement
            {
                Name    = name,
                Parent  = parent,
                FadeOut = panel.FadeOut
            };

            if (panel.Image != null)
            {
                element.Components.Add(panel.Image);
            }

            if (panel.RawImage != null)
            {
                element.Components.Add(panel.RawImage);
            }

            element.Components.Add(panel.RectTransform);

            if (panel.CursorEnabled)
            {
                element.Components.Add(new CuiNeedsCursorComponent());
            }

            if (panel.KeyboardEnabled)
            {
                element.Components.Add(new CuiNeedsKeyboardComponent());
            }

            Add(element);
            return(name);
        }