using Microsoft.Xna.Framework; using System.Collections.Generic; namespace Subsurface { class GUIMessageBox { public static Queue messageBoxes = new Queue(); const int DefaultWidth=400, DefaultHeight=200; public delegate bool OnClickedHandler(GUIButton button, object obj); public OnClickedHandler OnClicked; GUIFrame frame; GUIButton[] buttons; public GUIMessageBox(string header, string text) : this(header, text, new string[] {"OK"}) { } public GUIMessageBox(string header, string text, string[] buttons, Alignment textAlignment = (Alignment.Left |Alignment.Top)) { frame = new GUIFrame(new Rectangle(Game1.GraphicsWidth/2-DefaultWidth/2, Game1.GraphicsHeight/2-DefaultHeight/2, DefaultWidth, DefaultHeight), GUI.style.backGroundColor, Alignment.CenterX, GUI.style); frame.Padding = GUI.style.smallPadding; if (buttons == null || buttons.Length == 0) { DebugConsole.ThrowError("Creating a message box with no buttons isn't allowed"); return; } new GUITextBlock(new Rectangle(0, 5, 0, 30), header, Color.Transparent, Color.White, textAlignment, frame, true); new GUITextBlock(new Rectangle(0,50,0,DefaultHeight-70),text, Color.Transparent, Color.White, textAlignment, frame, true); int x = 0; this.buttons = new GUIButton[buttons.Length]; for (int i=0; i