/// <summary>
        /// Start a New File
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public virtual void Event_NewFileToolbarItem_Clicked(object sender, vxGuiItemClickEventArgs e)
        {
            vxMessageBox NewFile = new vxMessageBox("Are you sure you want to Start a New File,\nAll Unsaved Work will be Lost", "quit?");

            vxEngine.AddScreen(NewFile, ControllingPlayer);
            NewFile.Accepted += new EventHandler <PlayerIndexEventArgs>(Event_NewFile_Accepted);
        }
        /// <summary>
        /// When the user cancels the main menu, ask if they want to exit the sample.
        /// </summary>
        public override void OnCancel(PlayerIndex playerIndex)
        {
            const string message = "Are you sure you want to quit?";
            vxMessageBox confirmExitMessageBox = new vxMessageBox(message, "quit?");

            confirmExitMessageBox.Accepted += ConfirmExitMessageBoxAccepted;
            vxEngine.AddScreen(confirmExitMessageBox, playerIndex);
        }
Example #3
0
        /// <summary>
        /// Event handler for when the Quit Game menu entry is selected.
        /// </summary>
        void QuitGameMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            string message = LanguagePack.Get(vxLocalization.Pause_AreYouSureYouWantToQuit);

            vxMessageBox confirmQuitMessageBox = new vxMessageBox(message, LanguagePack.Get(vxLocalization.Pause));

            confirmQuitMessageBox.Accepted += ConfirmQuitMessageBoxAccepted;

            vxEngine.AddScreen(confirmQuitMessageBox, ControllingPlayer);
        }
        /// <summary>
        /// The Draw Method for the Menu Screen Art Provider. If you want to customize the draw call, then create an inherited class
        /// of this one and override this draw call.
        /// </summary>
        /// <param name="guiItem"></param>
        public virtual void Draw(object guiItem)
        {
            //Set Font
            Font = vxEngine.vxGUITheme.Font;

            //First Cast the GUI Item to be a Menu Entry
            vxMessageBox msgBox = (vxMessageBox)guiItem;

            TitlePosition = msgBox.textTitlePosition;

            Vector2 TitleSize = GetTextSize(msgBox.Title);

            FormBoundingRectangle = new Rectangle(
                (int)(msgBox.backgroundRectangle.X - Padding.X),
                (int)(msgBox.backgroundRectangle.Y - Padding.Y),
                (int)(msgBox.backgroundRectangle.Width + 2 * Padding.X),
                (int)(msgBox.backgroundRectangle.Height + 2 * Padding.Y));

            TitleBoundingRectangle = new Rectangle(
                (int)(TitlePosition.X - TitlePadding.X),
                (int)(TitlePosition.Y - TitlePadding.Y),
                (int)(TitleSize.X + 2 * TitlePadding.X),
                (int)(TitleSize.Y + 2 * TitlePadding.Y));


            vxEngine.SpriteBatch.Begin();


            // Draw the message box text.
            vxEngine.SpriteBatch.Draw(BackgroundImage, FormBoundingRectangle, BackgroundColour * Alpha * msgBox.TransitionAlpha);
            vxEngine.SpriteBatch.DrawString(Font, msgBox.message, msgBox.textPosition, TextColour * Alpha * msgBox.TransitionAlpha);


            // Draw the Title
            vxEngine.SpriteBatch.Draw(TitleBackgroundImage, TitleBoundingRectangle, TitleBackgroundColour * TitleAlpha * msgBox.TransitionAlpha);
            vxEngine.SpriteBatch.DrawString(Font, msgBox.Title, TitlePosition, TitleTextColour * TitleAlpha * msgBox.TransitionAlpha);

            vxEngine.SpriteBatch.End();
        }