Exemple #1
0
            public UIPanel(Vector2 min, Vector2 max, string color = "0 0 0 .85", UIBaseElement parent = null) : base(min, max, parent)
            {
                panel = new CuiImageComponent
                {
                    Color = color
                };

                Element.Components.Insert(0, panel);
            }
            public UIPanel(UIContainer container, Vector2 position, float width, float height, string color = "0 0 0 .85", string pngImage = "") : base(container)
            {
                panel = new CuiImageComponent
                {
                    Color = color
                };

                this.SetPosition(position.x, position.y);
                this.SetSize(width, height);

                Element.Components.Insert(0, panel);
            }
Exemple #3
0
            /// <summary>Turns data into a CuiImageComponent.</summary>
            /// <param name="data">The data to base the CuiImageComponent on.</param>
            /// <returns>A CuiImageComponent based on the data.</returns>
            public static CuiImageComponent ToImageComponent(Dictionary <string, object> data)
            {
                CuiImageComponent imageComponent = new CuiImageComponent();

                if (data.ContainsKey(ImageProperties.color))
                {
                    imageComponent.Color = data[ImageProperties.color].ToString();
                }
                if (data.ContainsKey(ImageProperties.uri))
                {
                    imageComponent.Png    = data[ImageProperties.uri].ToString();
                    imageComponent.Sprite = "assets/content/textures/generic/fulltransparent.tga";
                }
                return(imageComponent);
            }
Exemple #4
0
 static bool EqualComponent(CuiImageComponent e1, CuiImageComponent e2)
 {
     if (e1.Sprite != e2.Sprite)
     {
         return(false);
     }
     if (e1.Color != e2.Color)
     {
         return(false);
     }
     if (e1.Png != e2.Png)
     {
         return(false);
     }
     if (e1.Material != e2.Material)
     {
         return(false);
     }
     if (e1.ImageType != e2.ImageType)
     {
         return(false);
     }
     return(!(Math.Abs(e1.FadeIn - e2.FadeIn) > 0.01));
 }
Exemple #5
0
 public UIImage(Vector2 position, float width, float height, UIBaseElement parent = null) : this(position, new Vector2(position.x + width, position.y + height), parent)
 {
     Image = new CuiImageComponent();
     Element.Components.Insert(0, Image);
 }
Exemple #6
0
 public UIImage(Vector2 min, Vector2 max, UIBaseElement parent = null) : base(min, max, parent)
 {
     Image = new CuiImageComponent();
     Element.Components.Insert(0, Image);
 }
 public UIImage(UIContainer container, Vector2 position, float width, float height) : base(container, position, width, height)
 {
     Image = new CuiImageComponent();
     Element.Components.Insert(0, Image);
 }