Exemplo n.º 1
0
 public ARGameBase()
     : base()
 {
     sceneManager = new ARSceneManager(this);
     fps          = new FpsShower(this);
     Components.Add(fps);
 }
Exemplo n.º 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()
        {
            // TODO: Add your initialization logic here

            try
            {
                CurrentStage  = AODSaver.LoadData <int>(GameConsts.GameSaveDirectory + @"\" + "Cs.aod");
                EnabledStages = AODSaver.LoadData <List <int> >(GameConsts.GameSaveDirectory + @"\" + "Es.aod");
            }
            catch
            {
                CurrentStage  = 0;
                EnabledStages = new List <int>(10);
                EnabledStages.Add(1);
#if DEBUG
                EnabledStages.Add(2);
                EnabledStages.Add(3);
                EnabledStages.Add(4);
                EnabledStages.Add(5);
                EnabledStages.Add(6);
#endif
                EnabledStages.Add(11);
            }

            if (Directory.Exists(GameConsts.SettingsDirectory) == false)
            {
                Directory.CreateDirectory(GameConsts.SettingsDirectory);
            }
            if (Directory.Exists(GameConsts.GameSaveDirectory) == false)
            {
                Directory.CreateDirectory(GameConsts.GameSaveDirectory);
            }


            mainMenu                  = new AODMainMenuScene(this);
            mainMenu.StartGame       += new StartGameHandler(this.StartGame);
            mainMenu.SettingsChanged += new EventHandler(this.SettingsChanged);
            Components.Add(mainMenu);
            //添加GameComponent
            gameScene = new GameScene(this);
            gameScene.ExitToMainMenu += new EventHandler(gameScene_ExitToMainMenu);
            Components.Add(gameScene);
            gameScene.Enabled = false;
            bloom             = new BloomComponent(this);
            Components.Add(bloom);
            bloom.Enabled = false;
            bloom.Visible = false;
            fpsShower     = new FpsShower(this);
            Components.Add(fpsShower);


            base.Initialize();
        }
Exemplo n.º 3
0
        protected override void Initialize()
        {
            spriteBatch    = new SpriteBatch(GraphicsDevice);
            primitiveBatch = new PrimitiveBatch(GraphicsDevice);
            fps            = new FpsShower(this);
            GameOperators.GraphicsDevice = GraphicsDevice;
            GameOperators.SoundManager   = new SoundManager();
            GameOperators.SpriteBatch    = spriteBatch;
            GameOperators.PrimitiveBatch = primitiveBatch;
            GameOperators.Content        = Content;
            Components.Add(fps);

            startMenu = new StartMenu(this);
            GameState.currentGameState = GameState.State.Menu;
            startMenu.StartVideo      += new EventHandler(startMenu_StartVideo);
            startMenu.StartAVA        += new EventHandler(startMenu_StartAVA);
            startMenu.StartPVA        += new EventHandler(startMenu_StartPVA);

            base.Exiting += new EventHandler <EventArgs>(Game1_Exiting);
            base.Initialize();
            Services.AddService(typeof(SpriteBatch), spriteBatch);
        }