Ejemplo n.º 1
0
        public override void OnBackButton()
        {
            Pause();

            BackgroundScreen pauseBg = new BackgroundScreen("Sprites\\Titles\\GamePaused");
            ScreenManager.AddScreen(pauseBg, PlayerIndex.One);
            ScreenManager.AddScreen(new PauseScreen(pauseBg), PlayerIndex.One);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// The main game constructor.
        /// </summary>
        public Game1()
        {
            Content.RootDirectory = "Content";

            graphics = new GraphicsDeviceManager(this);
            graphics.IsFullScreen = true;
              graphics.PreparingDeviceSettings += new EventHandler<PreparingDeviceSettingsEventArgs>(graphics_PreparingDeviceSettings);

              // Frame rate is 60 fps
              IsFixedTimeStep = false;
              //TargetElapsedTime = TimeSpan.FromTicks(166667);

            #if WINDOWS
            graphics.IsFullScreen = false;
            #endif

            // you can choose whether you want a landscape or portait
            // game by using one of the two helper functions.
            InitializePortraitGraphics();
            //InitializeLandscapeGraphics();

            //Get CI
            ci = (CultureInfo)CultureInfo.CurrentCulture.Clone();
            ci.NumberFormat.NumberDecimalSeparator = ".";
            ci.NumberFormat.NumberGroupSeparator = ",";

            //Load the waves
            wavedefines = Content.Load<BoardWaveDefines>("Maps\\Waves");
            maxwave = wavedefines.GetMaxWave();

            // Create the accounting table
            currentGameAccounting = new WaveAccountingTable(maxwave);

            // Create the screen manager component.
            screenManager = new ScreenManager(this);

            Components.Add(screenManager);

            //attempt to deserialize overall gameplay state.
            bool loaded;
            loaded = DeserializeState();

            if (loaded == true)
            {
                boardSeed = state.boardSeed;
                currentwave = state.currentWave;
                finalscore = state.currentTotalScore;
                currentGameAccounting.Load(state.accountingentries);
            }

            // attempt to deserialize the screen manager from disk. if that
            // fails, we add our default screens.
            //if (!screenManager.DeserializeState())
            //{
                // Activate the first screens.

            background = new BackgroundScreen("sprites\\Titles\\MainMenu");
            background.StartCursor(2.0f);

            screenManager.AddScreen(background, null);
            screenManager.AddScreen(new SplashScreen(), null);
            //screenManager.AddScreen(new GameOverScreen(), PlayerIndex.One);
            //screenManager.AddScreen(new GameplayScreen(), null);
            //}

               //music
               backgroundMusicManager = new BackgroundMusicManager(this);
               MainMenuSong = Content.Load<Song>("Sounds\\Music\\jm_menu_loop");
               GameSong = Content.Load<Song>("Sounds\\Music\\jm_main_loop");
        }
Ejemplo n.º 3
0
 public void SetBackgroundScreen(BackgroundScreen screen)
 {
     background = screen;
 }
Ejemplo n.º 4
0
        public void HighScoresAndRestartGame()
        {
            UInt64 score = GetFinalScore();
            int wave = GetCurrentWave();

            //reset everything to wave 1 and score 0
            ResetAll();

            //high score screen.
            BackgroundScreen screen = new BackgroundScreen("Sprites\\Titles\\HighScores");
            screenManager.AddScreen(screen, PlayerIndex.One);
            screenManager.AddScreen(new MainMenuScreen(IsContinuing()), PlayerIndex.One);
            screenManager.AddScreen(new HighScoreScreenDynamic(score, wave), PlayerIndex.One);
        }
Ejemplo n.º 5
0
        public void ExitCurrentLevel()
        {
            //find the gameplayScreen.
            GameScreen[] screens = screenManager.GetScreens();
            foreach (GameScreen screen in screens)
            {
                if (screen is GameplayScreen)
                {
                    ((GameplayScreen)(screen)).ExitScreen();
                }
            }

            BackgroundScreen bgscreen = new BackgroundScreen("Sprites\\Titles\\MainMenu");
            screenManager.AddScreen(bgscreen, PlayerIndex.One);
            screenManager.AddScreen(new MainMenuScreen(IsContinuing()), PlayerIndex.One);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Constructor fills in the menu contents.
 /// </summary>
 public PauseScreen(BackgroundScreen bg)
     : base("")
 {
     backgroundScreen = bg;
 }