public ParentComponent(ParentComponent parent, Rectangle bounds) : base(bounds) { this.parent = parent; this.children = new LinkedList<Component>(); if( parent == null ) ComponentManager.GetInstance().componentList.AddLast(this); }
public XNALabel(ParentComponent parent, Rectangle bounds, String text) : base(parent, bounds) { this.text = text; this.backgroundColor = Color.Transparent; this.border = null; }
public ChildComponent(ParentComponent parent, Rectangle bounds) : base(bounds) { this.parent = parent; this.enabled = true; this.backgroundColor = Color.Red; }
public XNAButton(ParentComponent parent, Rectangle bounds, String text) : base(parent, bounds) { this.text = text; MouseManager.GetInstance().mouseClickedListeners += OnMouseClick; MouseManager.GetInstance().mouseReleasedListeners += OnMouseRelease; }
public UserDisplayPanel(ParentComponent parent, User user, int index) : base(parent, new Rectangle()) { this.user = user; this.UpdateBounds(index); Boolean enabled = false; if (user.id == ChatServerConnectionManager.GetInstance().user.id) enabled = true; readyCheckBox = new XNACheckBox(this, new Rectangle(10, 10, 20, 20), ""); readyCheckBox.onClickListeners += this.OnReadyChanged; readyCheckBox.enabled = enabled; // readyCheckBox usernameLbl = new XNALabel(this, new Rectangle(40, 5, 230, 30), user.username); usernameLbl.font = MenuManager.BIG_TEXTFIELD_FONT; teamDropdown = new XNADropdown(this, new Rectangle(280, 5, 50, 30)); teamDropdown.dropdownLineSpace = 15; teamDropdown.arrowSize = 8; teamDropdown.onOptionSelectedChangedListeners += this.OnTeamChanged; for (int i = 0; i < 8; i++) teamDropdown.AddOption((i + 1) + ""); teamDropdown.enabled = enabled; colorDropdown = new XNADropdown(this, new Rectangle(340, 5, 50, 30)); colorDropdown.dropdownLineSpace = 15; colorDropdown.arrowSize = 8; for (int i = 0; i < colors.Length; i++) { colorDropdown.AddOption(""); colorDropdown.SetBackgroundColor(i + 1, colors[i]); } colorDropdown.onOptionSelectedChangedListeners += this.OnColorChanged; colorDropdown.enabled = enabled; kickBtn = new XNAButton(this, new Rectangle(400, 5, 75, 30), "Kick"); kickBtn.visible = false; if (((GameLobby)MenuManager.GetInstance().GetCurrentlyDisplayedMenu()).IsCurrentUserHost() && this.user.id != ChatServerConnectionManager.GetInstance().user.id) { kickBtn.visible = true; kickBtn.onClickListeners += this.OnKickButtonPressed; } if (this.user.id == 1) { // Wotuu this.SelectColor(1); this.readyCheckBox.selected = true; this.teamDropdown.SelectItem(0); } else if (this.user.id == 2) { this.SelectColor(3); this.readyCheckBox.selected = true; this.teamDropdown.SelectItem(1); } }
public ChildComponent(ParentComponent parent, Rectangle bounds) : base(bounds) { this.parent = parent; this.enabled = true; this.backgroundColor = Color.Red; this.font = DEFAULT_FONT; this.fontColor = DEFAULT_FONT_COLOR; }
public XNACheckBox(ParentComponent parent, Rectangle bounds, String text) : base(parent, bounds) { this.text = text; this.textAlign = TextAlign.RIGHT; this.checkBoxSize = new Vector2(20, 20); this.crossPadding = 3; MouseManager.GetInstance().mouseClickedListeners += OnMouseClick; MouseManager.GetInstance().mouseReleasedListeners += OnMouseRelease; }
public ParentComponent(ParentComponent parent, Rectangle bounds) : base(parent, bounds) { this.children = new LinkedList<Component>(); if (parent == null) ComponentManager.GetInstance().QueueLoad(this); else { this.parent.children.AddLast(this); // this.z = parent.z - 0.01f; } }
public Component(ParentComponent parent, Rectangle bounds) { this.parent = parent; this.bounds = bounds; this.backgroundColor = Color.White; this.mouseOverColor = Color.Orange; this.visible = true; this.border = new Border(this, 1, Color.Black); if (parent != null) this.z = parent.z - 0.01f; else this.z = 1f - this.GetDrawDepthOffset(); }
public XNARadioButton(ParentComponent parent, Rectangle bounds, XNARadioButtonGroup group, String text) : base(parent, bounds) { this.text = text; this.textAlign = TextAlign.RIGHT; this.group = group; this.group.RegisterMember(this); MouseManager.GetInstance().mouseClickedListeners += OnMouseClick; MouseManager.GetInstance().mouseReleasedListeners += OnMouseRelease; }
public ChildComponent(ParentComponent parent, Rectangle bounds) : base(bounds) { this.parent = parent; parent.AddChild(this); this.enabled = true; this.backgroundColor = Color.Red; this.font = DEFAULT_FONT; this.fontColor = DEFAULT_FONT_COLOR; this.padding = new Padding(5, 5, 5, 5); this.text = ""; }
public XNADropdown(ParentComponent parent, Rectangle bounds) : base(parent, bounds) { this.enabled = true; optionHeight = this.bounds.Height; shownButton = new XNAButton(this, new Rectangle( 0, 0, this.bounds.Width, optionHeight), ""); shownButton.onClickListeners += ShownButtonClicked; dropdownLineSpace = 30; arrowSize = 10; }
public GameDisplayPanel(ParentComponent parent, int index, MultiplayerGame multiplayerGame) : base(parent, new Rectangle()) { this.index = index; this.bounds = new Rectangle(5, 5 + (componentHeight + componentSpacing) * this.index, 580, componentHeight); this.border = new Border(this, 2, Color.Pink); this.multiplayerGame = multiplayerGame; XNALabel gameNameLbl = new XNALabel(this, new Rectangle(5, 5, 180, 30), this.multiplayerGame.gamename); mapNameLbl = new XNALabel(this, new Rectangle(195, 5, 180, 30), this.multiplayerGame.mapname); joinGameBtn = new XNAButton(this, new Rectangle(475, 5, 100, 30), "Join game"); joinGameBtn.onClickListeners += this.JoinGame; }
public XNASlider(ParentComponent parent, Rectangle bounds) : base(parent, bounds) { this.maxValue = 100f; this.sliderButton = new XNAButton(this, new Rectangle(0, 0, 10, this.bounds.Height), ""); this.sliderTextField = new XNATextField(this, new Rectangle(this.bounds.Width + 5, 0, 60, this.bounds.Height), 1); // this.sliderButton.z = this.z - 0.0001f; this.lineColor = Color.Black; // this.border = new Border(this, 1, Color.Black); MouseManager.GetInstance().mouseDragListeners += this.OnMouseDrag; MouseManager.GetInstance().mouseMotionListeners += this.OnMouseMotion; this.sliderTextField.onTextFieldValueChangedListeners += this.OnTextFieldValueChanged; this.sliderTextField.text = "0"; }
public MapPreviewPanel(ParentComponent parent, Rectangle bounds) : base(parent, new Rectangle()) { this.bounds = bounds; this.border = new Border(this, 2, Color.Pink); this.selectedMapLbl = new XNALabel(this, new Rectangle(5, this.bounds.Height - 70, this.bounds.Width - 10, 30), "No map selected"); this.selectedMapLbl.textAlign = XNALabel.TextAlign.CENTER; this.selectedMapLbl.font = MenuManager.BIG_TEXTFIELD_FONT; this.selectedMapLbl.border = null; this.selectMapButton = new XNAButton(this, new Rectangle(5, this.bounds.Height - 35, this.bounds.Width - 10, 30), "Select map"); this.selectMapButton.onClickListeners += this.OnSelectMapButtonClicked; this.selectMapButton.visible = false; this.imageBounds = new Rectangle( this.GetScreenBounds().X + 15, this.GetScreenBounds().Y + 15, this.GetScreenBounds().Width - 30, this.GetScreenBounds().Height - 90); }
public XNATextField(ParentComponent parent, Rectangle bounds, int rows) : base(parent, bounds) { this.caret = new Caret(this); this.rows = rows; this.isEditable = true; Rectangle drawRect = this.GetScreenBounds(); this.scrollbarBounds = new Rectangle(drawRect.Right - 15, drawRect.Top, 15, drawRect.Height); this.scrollbarButtonBounds = new Rectangle(drawRect.Right - 15, drawRect.Top + 1, 14, 0); KeyboardManager.GetInstance().keyPressedListeners += this.OnKeyPressed; KeyboardManager.GetInstance().keyTypedListeners += this.OnKeyTyped; KeyboardManager.GetInstance().keyReleasedListeners += this.OnKeyReleased; MouseManager.GetInstance().mouseDragListeners += this.OnMouseDrag; MouseManager.GetInstance().mouseMotionListeners += this.OnMouseMotion; MouseManager.GetInstance().mouseClickedListeners += this.OnMouseClick; MouseManager.GetInstance().mouseReleasedListeners += this.OnMouseRelease; this.hiddenCharacters = ""; }
/// <summary> /// Shows a certain menu. /// </summary> /// <param name="menu"></param> public void ShowMenu(Menu menu) { switch (menu) { case Menu.NoMenu: { if (this.GetCurrentMenu() != null) { this.GetCurrentMenu().Unload(); this.currentMenu = null; } break; } case Menu.MainMenu: { this.currentMenu = new MainMenu(); break; } case Menu.IngameMenu: { this.currentMenu = new IngameMenu(); break; } } }
public XNAPanel(ParentComponent parent, Rectangle bounds) : base(parent, bounds) { }
/// <summary> /// Queues the element for unloading by the manager. /// </summary> /// <param name="component">The component to unload</param> public void QueueUnload(ParentComponent component) { unloadList.AddLast(component); }
public XNAPanel(ParentComponent parent, Rectangle bounds, Texture2D backgroundTexture) : base(parent, bounds) { this.backgroundTexture = backgroundTexture; }