diff --git a/GeonBit.UI/Source/Utils/MessageBox.cs b/GeonBit.UI/Source/Utils/MessageBox.cs index 34dd7f1..d1fa857 100644 --- a/GeonBit.UI/Source/Utils/MessageBox.cs +++ b/GeonBit.UI/Source/Utils/MessageBox.cs @@ -6,8 +6,13 @@ // Since: 2017. //----------------------------------------------------------------------------- #endregion +using GeonBit.UI.Entities; +using GeonBit.UI.Entities.TextValidators; using Microsoft.Xna.Framework; - +using Microsoft.Xna.Framework.Input; +using System; +using System.Collections.Generic; +using System.IO; namespace GeonBit.UI.Utils { @@ -32,12 +37,17 @@ public class MessageBoxHandle /// /// Message box panel. /// - public Entities.Panel Panel; + public Panel Panel; /// /// Object used to fade out the background. /// - public Entities.Entity BackgroundFader; + public Entity BackgroundFader; + + /// + /// Message box bottom buttons. + /// + public Button[] Buttons; /// /// Hide / close the message box. @@ -97,14 +107,14 @@ public class MsgBoxOption /// /// Callback to run when clicked. Return false to leave message box opened (true will close it). /// - public System.Func Callback; + public Func Callback; /// /// Create the message box option. /// /// Text to write on the button. /// Action when clicked. Return false if you want to abort and leave the message opened, return true to close it. - public MsgBoxOption(string title, System.Func callback) + public MsgBoxOption(string title, Func callback) { Title = title; Callback = callback; @@ -148,20 +158,20 @@ public static MessageBoxHandle ShowMsgBox(string header, string text, MsgBoxOpti // create panel for messagebox size = size ?? new Vector2(500, -1); - var panel = new Entities.Panel(size.Value); + var panel = new Panel(size.Value); ret.Panel = panel; - panel.AddChild(new Entities.Header(header)); - panel.AddChild(new Entities.HorizontalLine()); - panel.AddChild(new Entities.RichParagraph(text)); + panel.AddChild(new Header(header)); + panel.AddChild(new HorizontalLine()); + panel.AddChild(new RichParagraph(text)); // add to opened boxes counter OpenedMsgBoxesCount++; // add rectangle to hide and lock background - Entities.ColoredRectangle fader = null; + ColoredRectangle fader = null; if (BackgroundFaderColor.A != 0) { - fader = new Entities.ColoredRectangle(Vector2.Zero, Entities.Anchor.Center); + fader = new ColoredRectangle(Vector2.Zero, Entities.Anchor.Center); fader.FillColor = new Color(0, 0, 0, 100); fader.OutlineWidth = 0; fader.ClickThrough = false; @@ -179,21 +189,23 @@ public static MessageBoxHandle ShowMsgBox(string header, string text, MsgBoxOpti } // add bottom buttons panel - var buttonsPanel = new Entities.Panel(new Vector2(0, 70), - Entities.PanelSkin.None, size.Value.Y == -1 ? Entities.Anchor.Auto : Entities.Anchor.BottomCenter); + var buttonsPanel = new Panel(new Vector2(0, 60), + PanelSkin.None, size.Value.Y == -1 ? Anchor.Auto : Anchor.BottomCenter); buttonsPanel.Padding = Vector2.Zero; panel.AddChild(buttonsPanel); buttonsPanel.PriorityBonus = -10; // add all option buttons + var buttonsList = new List