protected GuiControl()
 {
     Color     = Color.White;
     TextColor = Color.White;
     IsEnabled = true;
     IsVisible = true;
     Controls  = new GuiControlCollection(this);
     Origin    = Vector2.One * 0.5f;
 }
        protected GuiControl(GuiSkin skin)
        {
            Skin      = skin;
            Color     = Color.White;
            TextColor = Color.White;
            IsEnabled = true;
            IsVisible = true;
            Controls  = new GuiControlCollection(this);
            Origin    = Vector2.Zero;

            var style = skin?.GetStyle(GetType());

            style?.Apply(this);
        }
Beispiel #3
0
        protected List <T> FindControls <T>(GuiControlCollection controls)
            where T : GuiControl
        {
            var results = new List <T>();

            foreach (var control in controls)
            {
                if (control is T)
                {
                    results.Add(control as T);
                }
                if (control.Controls.Any())
                {
                    results = results.Concat(FindControls <T>(control.Controls)).ToList();
                }
            }
            return(results);
        }
Beispiel #4
0
        protected GuiControl(GuiSkin skin)
        {
            Skin      = skin;
            Color     = Color.White;
            TextColor = Color.White;
            IsEnabled = true;
            IsVisible = true;
            Controls  = new GuiControlCollection(this)
            {
                ItemAdded   = x => UpdateRootIsLayoutRequired(),
                ItemRemoved = x => UpdateRootIsLayoutRequired()
            };
            Origin = Vector2.Zero;

            var style = skin?.GetStyle(GetType());

            style?.Apply(this);
        }