private void SetButtonPosition(UIBaseComponent comp, int buttonIndex) { int col = buttonIndex % 2; int row = buttonIndex / 2; comp.X = 1 + col * 32; comp.Y = 35 + row * 24; }
internal UIBaseComponent() { BackgroundColor = new Color(1.0f, 1.0f, 1.0f, 0.0f); UserInteractionEnabled = true; Visible = true; Alpha = 1.0f; ParentComponent = null; components = new List <UIBaseComponent>(); Components = new UIBaseComponentList(components); }
internal void RemoveComponent(UIBaseComponent comp) { if (comp == null) { return; } if (components.Contains(comp)) { components.Remove(comp); } comp.ParentComponent = null; }
internal void AddComponent(UIBaseComponent newComp) { if (newComp == null) { return; } if (newComp.ParentComponent != null) { newComp.ParentComponent.RemoveComponent(newComp); } newComp.ParentComponent = this; components.Add(newComp); }
internal Vector2 ConvertLocalToGlobal(Vector2 localCoords) { Vector2 result = localCoords; UIBaseComponent comp = this; while (comp != null) { result.X += comp.X; result.Y += comp.Y; comp = comp.ParentComponent; } return(result); }
internal void InsertComponent(UIBaseComponent newComp, int atPosition) { if (newComp == null) { return; } if (newComp.ParentComponent != null) { newComp.ParentComponent.RemoveComponent(newComp); } newComp.ParentComponent = this; components.Insert(atPosition, newComp); }
internal void RemoveComponent(UIBaseComponent comp) { if (comp == null) return; if (components.Contains(comp)) components.Remove(comp); comp.ParentComponent = null; }
internal void InsertComponent(UIBaseComponent newComp, int atPosition) { if (newComp == null) return; if (newComp.ParentComponent != null) newComp.ParentComponent.RemoveComponent(newComp); newComp.ParentComponent = this; components.Insert (atPosition, newComp); }
internal void AddComponent(UIBaseComponent newComp) { if (newComp == null) return; if (newComp.ParentComponent != null) newComp.ParentComponent.RemoveComponent(newComp); newComp.ParentComponent = this; components.Add(newComp); }