示例#1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            this.IsMouseVisible = true;

            ContentLibrary.LoadContentLibrary(Content);

            m_scoreList = new List <Score>();
            m_scoreList = LevelIO.LoadScore("scores.bin");

            //GameState Manager Stuff
            m_gameStateManager = new GameStateManager(this);

            PlayingGameState m_playingGameState =
                new PlayingGameState(m_gameStateManager, windowRes);

            LevelEditor m_editor =
                new LevelEditor(m_gameStateManager, windowRes);

            SplashScreen m_splash =
                new SplashScreen(m_gameStateManager, windowRes);

            MenuGameState m_menu =
                new MenuGameState(m_gameStateManager, windowRes);

            PauseGameState m_pause =
                new PauseGameState(m_gameStateManager, windowRes);

            TutorialGameState m_tutorial =
                new TutorialGameState(m_gameStateManager, windowRes);

            Level1GameState m_level1 =
                new Level1GameState(m_gameStateManager, windowRes);

            Level2GameState m_level2 =
                new Level2GameState(m_gameStateManager, windowRes);

            Level3GameState m_level3 =
                new Level3GameState(m_gameStateManager, windowRes);

            m_gameStateManager.SetState("playingGS", m_playingGameState);
            m_gameStateManager.SetState("editor", m_editor);
            m_gameStateManager.SetState("splashScreen", m_splash);
            m_gameStateManager.SetState("menu", m_menu);
            m_gameStateManager.SetState("pause", m_pause);
            m_gameStateManager.SetState("tutorial", m_tutorial);
            m_gameStateManager.SetState("level1", m_level1);
            m_gameStateManager.SetState("level2", m_level2);
            m_gameStateManager.SetState("level3", m_level3);

            m_gameStateManager.PushState("splashScreen");
            base.Initialize();

            for (int i = 0; i < m_scoreList.Count; i++)
            {
                Console.WriteLine(m_scoreList[i].m_level);
                Console.WriteLine(m_scoreList[i].m_time);
                Console.WriteLine(m_scoreList[i].m_deaths);
            }
        }
示例#2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            this.IsMouseVisible = true;

            ContentLibrary.LoadContentLibrary(Content);

            m_scoreList = new List<Score>();
            m_scoreList = LevelIO.LoadScore("scores.bin");

            //GameState Manager Stuff
            m_gameStateManager = new GameStateManager(this);
            
            PlayingGameState m_playingGameState =
                new PlayingGameState(m_gameStateManager, windowRes);
            
            LevelEditor m_editor =
                new LevelEditor(m_gameStateManager, windowRes);

            SplashScreen m_splash =
                new SplashScreen(m_gameStateManager, windowRes);

            MenuGameState m_menu =
                new MenuGameState(m_gameStateManager, windowRes);

            PauseGameState m_pause =
                new PauseGameState(m_gameStateManager, windowRes);

            TutorialGameState m_tutorial =
                new TutorialGameState(m_gameStateManager, windowRes);

            Level1GameState m_level1 =
                new Level1GameState(m_gameStateManager, windowRes);

            Level2GameState m_level2 =
                new Level2GameState(m_gameStateManager, windowRes);

            Level3GameState m_level3 =
                new Level3GameState(m_gameStateManager, windowRes);

            m_gameStateManager.SetState("playingGS", m_playingGameState);
            m_gameStateManager.SetState("editor", m_editor);
            m_gameStateManager.SetState("splashScreen", m_splash);
            m_gameStateManager.SetState("menu", m_menu);
            m_gameStateManager.SetState("pause", m_pause);
            m_gameStateManager.SetState("tutorial", m_tutorial);
            m_gameStateManager.SetState("level1", m_level1);
            m_gameStateManager.SetState("level2", m_level2);
            m_gameStateManager.SetState("level3", m_level3);

            m_gameStateManager.PushState("splashScreen");
            base.Initialize();

            for (int i = 0; i < m_scoreList.Count; i++)
            {
                Console.WriteLine(m_scoreList[i].m_level);
                Console.WriteLine(m_scoreList[i].m_time);
                Console.WriteLine(m_scoreList[i].m_deaths);
            }
        }