public MessageBox(string message, GameTime gameTime, RemoveMessage removeMessage, string dismissButtonText = "Dismiss", GUIButton.ButtonAction OnDismiss = null) : base(new Rectangle((int)((GraphicsDevice.Viewport.Width * PADDING_SCALE) / 2), (int)((GraphicsDevice.Viewport.Height * PADDING_SCALE) / 2), (int)(GraphicsDevice.Viewport.Width * (1F - PADDING_SCALE)), (int)(GraphicsDevice.Viewport.Height * (1F - PADDING_SCALE)))) { this.removeMessage = removeMessage; if (OnDismiss == null) { OnDismiss = new GUIButton.ButtonAction((e) => { }); } AddElement(new GUILabel(new Point(elementRectangle.Center.X, elementRectangle.Center.Y - (elementRectangle.Height / 4)), message, GameButton.TextFont, Color.White, new Rectangle(0, 0, elementRectangle.Width, elementRectangle.Height / 2), wordWrap: true)); AddElement(new GameButton(new Point(elementRectangle.Center.X, elementRectangle.Center.Y + (elementRectangle.Height / 4)), new Rectangle(0, 0, (int)(elementRectangle.Width * PADDING_SCALE), (int)((elementRectangle.Height / 2) * PADDING_SCALE)), new GameButtonData(dismissButtonText, Dismiss_Click + OnDismiss, null))); }
public GameButtonData(string text, GUIButton.ButtonAction ClickAction, GUIButton.ButtonAction HoverAction) { this.ClickAction = ClickAction; this.HoverAction = HoverAction; this.text = text; }