/** Creates a new gui character stats page.*/ public GuiCharacterSpellsPage() { InnerShadow = true; spellClassList = new GuiSpellClassList(308, 364) { X = -2, Y = -2 }; spellClassList.Character = Character; Add(spellClassList); spellHeader = new GuiSpellClassHeader(); spellHeader.Width = (int)ContentsFrame.width; Add(spellHeader); spellList = new GuiSpellList(); Add(spellList, 10, spellHeader.Height + 10); spellClassList.OnSpellClassSelected += delegate(object source, System.EventArgs e) { if (!(source is GuiComponent)) { return; } int id = (source as GuiComponent).Id; viewSpellClass(CoM.SpellClasses.ByID(id)); }; backButton = new GuiButton("Back"); Add(backButton, 0, -10, true); backButton.OnMouseClicked += delegate { viewSpellClassList(); }; }
/** Updates the positioning and size of the buttons to reflect the current button spacing */ private void positionButtons() { if (Buttons.Count == 0) { SizeForContent(ButtonSpacing, ButtonSpacing); return; } int xPos = ButtonSpacing; int yPos = ButtonSpacing; GuiButton lastButton = null; foreach (GuiButton button in Buttons) { button.X = xPos; button.Y = yPos; button.Width = (int)ButtonSize.x; button.Height = (int)ButtonSize.y; switch (RadioMode) { case GuiRadioButtonMode.Horizontal: xPos += (int)button.Width + ButtonSpacing; break; case GuiRadioButtonMode.Vertial: yPos += (int)button.Height + ButtonSpacing; break; } lastButton = button; } this.SizeForContent((int)lastButton.Bounds.xMax + ButtonSpacing, (int)lastButton.Bounds.yMax + ButtonSpacing); }
private GuiButton createNewButton() { var button = new GuiButton("", (int)ButtonSize.x, (int)ButtonSize.y); button.Style = ButtonStyle; button.TextAlign = TextAnchor.MiddleCenter; button.OnMouseClicked += delegate { SelectedIndex = button.Id; }; return(button); }
public GuiStatAdjustment(int x, int y, string statName, int startingValue) : base(250, HEIGHT) { X = x; Y = y; PanelMode = GuiPanelMode.Square; Color = new Color(0.25f, 0.25f, 0.25f, 0.0f); this.Value = startingValue; this.statName = statName; this.MinValue = 5; this.MaxValue = 10; nameLabel = new GuiLabel(0, 0, ""); nameLabel.FontColor = Color.white; nameLabel.TextAlign = TextAnchor.MiddleLeft; Add(nameLabel, 4, 0); valueLabel = new GuiLabel(0, 0, "", 20, 16); valueLabel.TextAlign = TextAnchor.MiddleCenter; Add(valueLabel); decButton = new GuiButton("<", 20, 17); Add(decButton, Width - 62, 1); incButton = new GuiButton(">", 20, 17); Add(incButton, Width - 21, 1); incButton.OnMouseClicked += delegate { if ((Value < MaxValue) && (FreePoints > 0)) { FreePoints--; Value++; Refresh(); } }; decButton.OnMouseClicked += delegate { if (Value > MinValue) { FreePoints++; Value--; Refresh(); } }; }
public EditPartyState(MDRParty party = null, bool createInsteadOfEdit = false) : base("Edit Party State") { var windowTitle = createInsteadOfEdit ? "Create Party" : "Edit Party"; window = new GuiWindow(600, 520, windowTitle); window.Background.Sprite = ResourceManager.GetSprite("Gui/InnerWindow"); window.Background.Color = new Color(0.4f, 0.42f, 0.62f); characterSlotsPanel = new GuiPanel(500, 110); characterSlotsPanel.Color = Color.clear; characterSlotsPanel.Align = GuiAlignment.Top; window.Add(characterSlotsPanel); characterSlot = new GuiCharacterSlot[4]; for (int lp = 0; lp < 4; lp++) { var slot = new GuiCharacterSlot(); slot.Tag = lp + 1; characterSlot[lp] = slot; characterSlotsPanel.Add(slot, 0, 10); characterSlotsPanel.PositionComponentToColumns(slot, lp + 1, 4, 100); characterSlot[lp].OnDDContentChanged += delegate { applyToParty(slot.Tag - 1); refreshUnassignedCharacters(); }; } unassignedCharacters = new GuiCharacterGrid(true); unassignedCharacters.DragDropEnabled = true; unassignedCharacters.OnCreateNewCharacter += delegate { refreshUI(); }; unassignedCharactersScrollArea = new GuiScrollableArea(550 + 21, 310, ScrollMode.VerticalOnly); unassignedCharactersScrollArea.Add(unassignedCharacters); var frame = GuiWindow.CreateFrame(unassignedCharactersScrollArea, "", GuiWindowStyle.ThinTransparent); frame.Color = new Color(0.1f, 0.1f, 0.1f); window.Add(frame, 0, -46, true); var unusedCaption = new GuiLabel("<B>Available Heroes</B>", (int)window.ContentsBounds.width + 10, 24); unusedCaption.EnableBackground = true; unusedCaption.TextAlign = TextAnchor.MiddleCenter; unusedCaption.Color = Color.Lerp(Colors.BackgroundRed, Color.black, 0.5f); unusedCaption.FauxEdge = true; unusedCaption.FontColor = new Color(1, 1, 1, 0.9f); unusedCaption.FontSize = 18; window.Add(unusedCaption, 0, frame.Y - 15); doneButton = new GuiButton("Done"); window.Add(doneButton, 0, -10); dispandButton = new GuiButton("Dispand"); UIStyle.RedWarning(dispandButton); window.Add(dispandButton, 0, -10); window.PositionComponentToColumns(dispandButton, 1, 2, 100); window.PositionComponentToColumns(doneButton, 2, 2, 100); doneButton.OnMouseClicked += delegate { applyToParty(); Engine.PopState(); }; dispandButton.OnMouseClicked += delegate { party.Dispand(); Engine.PopState(); }; Party = party; Add(window, 0, 0); }
public GuiPartyInfo(int x = 0, int y = 0) : base(x, y) { IgnoreClipping = true; const int INFOLABEL_HEIGHT = 24; Width = 300; Height = GuiCharacterFrame.HEIGHT * 2 + INFOLABEL_HEIGHT + 24; CharacterPanel = new GuiCharacterFrame[4]; for (int lp = 0; lp < 4; lp++) { CharacterPanel[lp] = new GuiCharacterFrame() { X = (lp % 2) * (GuiCharacterFrame.WIDTH), Y = (int)(lp / 2) * (GuiCharacterFrame.HEIGHT) }; Add(CharacterPanel[lp]); } GuiButton RemoveButton = new GuiButton("Remove", 80, 20); Add(RemoveButton, 10, Height - 25); GuiButton AddButton = new GuiButton("Add", 80, 20); Add(AddButton, 100, Height - 25); menuButton = new GuiButton("Menu", 80, 20); Add(menuButton, 190, Height - 25); InfoLabel = new GuiLabel(0, 0, "") { Height = INFOLABEL_HEIGHT, TextAlign = TextAnchor.MiddleCenter, Align = GuiAlignment.Bottom }; Add(InfoLabel); RemoveButton.OnMouseClicked += delegate { if (Party.Selected != null) { Party.RemoveCharacter(Party.Selected); Sync(); } }; menuButton.OnMouseClicked += delegate { Engine.PushState(new InGameMenuState()); }; AddButton.OnMouseClicked += delegate { if (Party.MemberCount == 4) { return; } ModalOptionListState <MDRCharacter> chooseCharacterState = new ModalOptionListState <MDRCharacter>("Select a character to add", CoM.GetCharactersInCurrentArea()); chooseCharacterState.OnStateClose += delegate { if (chooseCharacterState.Result != null) { Party.AddCharacter(chooseCharacterState.Result); } Sync(); }; Engine.PushState(chooseCharacterState); }; }
public GuiPartySpan(MDRParty party) : base(WIDTH, HEIGHT) { DepressedOffset = 1; Style = Engine.GetStyleCopy("SmallButton"); Style.padding = new RectOffset(10, 12, 1, 3); portraits = new GuiImage[4]; names = new GuiLabel[4]; TextAlign = TextAnchor.MiddleCenter; FontSize = 22; CaptionDropShadow = true; editButton = new GuiButton("Edit", 80, 30); editButton.ColorTransform = ColorTransform.Saturation(0.5f); Add(editButton, -5, 30, true); editButton.Visible = false; locationLabel = new GuiLabel("", Width, 23); locationLabel.FontSize = 16; locationLabel.FontColor = Color.yellow; locationLabel.Color = Color.black.Faded(0.6f); locationLabel.EnableBackground = true; locationLabel.TextAlign = TextAnchor.MiddleCenter; locationLabel.Align = GuiAlignment.Bottom; Add(locationLabel); editButton.OnMouseClicked += delegate { if (Party != null) { Engine.PushState(new EditPartyState(Party)); } }; this._party = party; for (int lp = 0; lp < 4; lp++) { portraits[lp] = new GuiImage(lp * BLOCK_WIDTH + ((BLOCK_WIDTH - PORTAIT_WIDTH) / 2), 7); portraits[lp].FrameStyle = Engine.GetStyleCopy("Frame"); portraits[lp].Framed = true; portraits[lp].InnerShadow = true; portraits[lp].OuterShadow = true; portraits[lp].OuterShadowSprite = ResourceManager.GetSprite("Icons/OuterEdge"); portraits[lp].OuterShadowColor = Color.black.Faded(0.25f); Add(portraits[lp]); names[lp] = new GuiLabel(""); names[lp].FontColor = new Color(0.9f, 0.9f, 0.9f, 0.9f); names[lp].DropShadow = true; names[lp].TextAlign = TextAnchor.MiddleCenter; names[lp].X = 15 + lp * 125; names[lp].Y = 70; names[lp].Width = BLOCK_WIDTH - 30; names[lp].EnableBackground = true; names[lp].Color = new Color(0.2f, 0.2f, 0.2f); Add(names[lp]); } apply(); }