private void menu_MouseClick(object sender, ButtonClickEventArgs e)
 {
     switch (e.ButtonIndex)
     {
         case 0:
             pauseMenu.pause();
             this.IsUpdated = true;
             break;
         case 1:
             contentManager.clear();
             pauseMenu.pause();
             this.IsUpdated = true;
             break;
         case 2:
             ofd.Filter = "XML|*.xml|All files|*.*";
             ofd.InitialDirectory = @"E:\Visual Studio 2013\Projects\CubePlatformer\Cube Platformer\Content\levels";
             Game1.Window.SetVisible(false);
             if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 IO.loadLevel(contentManager, ofd.FileName);
                 ofd.FileName = "";
             }
             pauseMenu.pause();
             Game1.Window.SetVisible(true);
             this.IsUpdated = true;
             break;
         case 3:
             sfd.Filter = "XML|*.xml|All files|*.*";
             sfd.InitialDirectory = @"E:\Visual Studio 2013\Projects\CubePlatformer\Cube Platformer\Content\levels";
             Game1.Window.SetVisible(false);
             if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 IO.saveLevel(sfd.FileName, contentManager);
                 sfd.FileName = "";
             }
             Game1.Window.SetVisible(true);
             pauseMenu.pause();
             this.IsUpdated = true;
             break;
         case 4:
             this.ParentScreen.pause();
             Game1.ScreenManager.remove(this);
             break;
     }
 }
 void mainMenu_ButtonClick(object sender, ButtonClickEventArgs e)
 {
     switch (e.ButtonIndex)
     {
         case 0:
             this.pause();
             Game1.ScreenManager.add(new GameScreen(this));
             break;
         case 1:
             this.pause();
             Game1.ScreenManager.add(new LevelEditorScreen(this));
             break;
         case 5:
             Game1.closeApplication();
             break;
     }
 }
Example #3
0
        private void menuScreen_MouseClick(object sender, ButtonClickEventArgs e)
        {
            MenuScreen m = ((MenuScreen)sender);
            if (m.Title.DisplayedString.Equals("Level Won"))
            {
                if (e.ButtonIndex == 0)
                {
                    m.pause();
                    currentLevel++;
                    IO.loadLevel(contentManager, "Content/levels/level" + currentLevel + ".xml");
                    this.IsUpdated = true;
                    Console.WriteLine("this fuckig thing ran");
                }
            }
            else if (m.Title.DisplayedString.Equals("Game Paused"))
            {
                if (e.ButtonIndex == 0)
                {
                    m.pause();
                    this.IsUpdated = true;
                }
            }

            if (e.ButtonIndex == 1)
            {
                foreach (Entity entity in contentManager.Entities)
                    if (entity is Player)
                        ((Player)entity).respawn();
                m.pause();
                this.IsUpdated = true;
            }
            if (e.ButtonIndex == 2)
            {
                ParentScreen.pause();
                Game1.ScreenManager.remove(this);
            }
        }