Esempio n. 1
0
//--------------------Su kien New Game frame------------------
        void StateMenu_Move_Complete_NewGame(object sender, EventArgs e)
        {
            if (_indexOfNextState != 0)
            {
                return;
            }
            GameFrame _frame = (GameFrame)sender;

            if (_frame.IsVisible == false)
            {
                int nObjectManager = 12;
                GameObjectManager[] objectManagerArray = new GameObjectManager[nObjectManager];

                objectManagerArray[1]  = new MapManager(@"Data\Map\map.xml");
                objectManagerArray[0]  = new PlayerCharacterManager(@"Data\character\character.xml");
                objectManagerArray[2]  = new MonsterManager(@"Data\monster\monster.xml");
                objectManagerArray[3]  = new ProcessBarManager(@"Data\XML\processbar-stateloading.xml");
                objectManagerArray[4]  = new PortralManager(@"Data\Portral\Portral.xml");
                objectManagerArray[5]  = new MapObstacleManager(@"Data\MapObstacle\MapObstacle.xml");
                objectManagerArray[6]  = new ProjectileManager(@"Data\Projectile\Projectile.xml");
                objectManagerArray[7]  = new SkillManager(@"Data\Skill\Skill.xml");
                objectManagerArray[8]  = new GameFrameManager(@"Data\XML\gameframe-statemaingame.xml");
                objectManagerArray[9]  = new ProcessBarManager(@"Data\XML\processbar-statemaingame.xml");
                objectManagerArray[10] = new ButtonManger(@"Data\XML\buttonmanager-statemaingame.xml");
                objectManagerArray[11] = new LabelManager(@"Data\XML\labelmanager-statemaingame.xml");


                Owner.GameState = new StateLoading();
                Owner.GameState.InitState(null, Owner);
                ((StateLoading)Owner.GameState).GetDataLoading(Owner.Content, @"./Data/XML/loadingtomenu.xml", objectManagerArray, typeof(StateMainGame));
                Owner.GameState.EnterState();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            this.graphics.IsFullScreen = true;

            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            GlobalVariables.Sf = Content.Load <SpriteFont>("sf");

            GlobalVariables.ScreenHeight = this.Window.ClientBounds.Height;
            GlobalVariables.ScreenWidth  = this.Window.ClientBounds.Width;

            //Khởi tạo 2 biến mouseState
            GlobalVariables.CurrentMouseState  = new MouseState();
            GlobalVariables.PreviousMouseState = new MouseState();

            GlobalVariables.GameCursor = new Cursor();
            GlobalVariables.GameCursor.Init(Content);

            //_gameState = new StateMenu();
            //_gameState.InitState(Content, this);
            //_gameState.EnterState();

            int nObjectManager = 3;

            GameObjectManager[] objectManagerArray = new GameObjectManager[nObjectManager];
            objectManagerArray[0] = new BackgroundManager(@"./Data/XML/menubg.xml");
            objectManagerArray[1] = new GameFrameManager(@"./Data/XML/gameframe-statemenu.xml");
            objectManagerArray[2] = new ButtonManger(@"./Data/XML/buttonmanager-statemenu.xml");
            _gameState            = new StateLoading();
            _gameState.InitState(null, this);
            ((StateLoading)_gameState).GetDataLoading(Content, @"./Data/XML/loadingtomenu.xml", objectManagerArray, typeof(StateMenuManager));
            _gameState.EnterState();

            //int nObjectManager = 12;
            //GameObjectManager[] objectManagerArray = new GameObjectManager[nObjectManager];

            //objectManagerArray[1] = new MapManager(@"Data\Map\map.xml");
            //objectManagerArray[0] = new PlayerCharacterManager(@"Data\character\character.xml");
            //objectManagerArray[2] = new MonsterManager(@"Data\monster\monster.xml");
            //objectManagerArray[3] = new ProcessBarManager(@"Data\XML\processbar-stateloading.xml");
            //objectManagerArray[4] = new PortralManager(@"Data\Portral\Portral.xml");
            //objectManagerArray[5] = new MapObstacleManager(@"Data\MapObstacle\MapObstacle.xml");
            //objectManagerArray[6] = new ProjectileManager(@"Data\Projectile\Projectile.xml");
            //objectManagerArray[7] = new SkillManager(@"Data\Skill\Skill.xml");
            //objectManagerArray[8] = new GameFrameManager(@"Data\XML\gameframe-statemaingame.xml");
            //objectManagerArray[9] = new ProcessBarManager(@"Data\XML\processbar-statemaingame.xml");
            //objectManagerArray[10] = new ButtonManger(@"Data\XML\buttonmanager-statemaingame.xml");
            //objectManagerArray[11] = new LabelManager(@"Data\XML\labelmanager-statemaingame.xml");

            //_gameState = new StateLoading();
            //_gameState.InitState(null, this);
            //((StateLoading)_gameState).GetDataLoading(Content, @"./Data/XML/loadingtomenu.xml", objectManagerArray, typeof(StateMainGame));
            //_gameState.EnterState();
        }
        //Su kien button OK
        public void OKButton_Click(object sender, EventArgs e)
        {
            int nObjectManager = 3;

            GameObjectManager[] objectManagerArray = new GameObjectManager[nObjectManager];
            objectManagerArray[0] = new BackgroundManager(@"./Data/XML/menubg.xml");
            objectManagerArray[1] = new GameFrameManager(@"./Data/XML/gameframe-statemenu.xml");
            objectManagerArray[2] = new ButtonManger(@"./Data/XML/buttonmanager-statemenu.xml");

            _stateOwner.Owner.GameState = new StateLoading();
            _stateOwner.Owner.GameState.InitState(null, _stateOwner.Owner);
            ((StateLoading)_stateOwner.Owner.GameState).GetDataLoading(_stateOwner.Owner.Content, @"./Data/XML/loadingtomenu.xml", objectManagerArray, typeof(StateMenuManager));
            _stateOwner.Owner.GameState.EnterState();
        }
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            this.graphics.IsFullScreen = true;

            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            GlobalVariables.Sf = Content.Load<SpriteFont>("sf");

            GlobalVariables.ScreenHeight = this.Window.ClientBounds.Height;
            GlobalVariables.ScreenWidth = this.Window.ClientBounds.Width;

            //Khởi tạo 2 biến mouseState
            GlobalVariables.CurrentMouseState = new MouseState();
            GlobalVariables.PreviousMouseState = new MouseState();

            GlobalVariables.GameCursor = new Cursor();
            GlobalVariables.GameCursor.Init(Content);

            //_gameState = new StateMenu();
            //_gameState.InitState(Content, this);
            //_gameState.EnterState();

            int nObjectManager = 3;
            GameObjectManager[] objectManagerArray = new GameObjectManager[nObjectManager];
            objectManagerArray[0] = new BackgroundManager(@"./Data/XML/menubg.xml");
            objectManagerArray[1] = new GameFrameManager(@"./Data/XML/gameframe-statemenu.xml");
            objectManagerArray[2] = new ButtonManger(@"./Data/XML/buttonmanager-statemenu.xml");
            _gameState = new StateLoading();
            _gameState.InitState(null, this);
            ((StateLoading)_gameState).GetDataLoading(Content, @"./Data/XML/loadingtomenu.xml", objectManagerArray, typeof(StateMenuManager));
            _gameState.EnterState();

            //int nObjectManager = 12;
            //GameObjectManager[] objectManagerArray = new GameObjectManager[nObjectManager];

            //objectManagerArray[1] = new MapManager(@"Data\Map\map.xml");
            //objectManagerArray[0] = new PlayerCharacterManager(@"Data\character\character.xml");
            //objectManagerArray[2] = new MonsterManager(@"Data\monster\monster.xml");
            //objectManagerArray[3] = new ProcessBarManager(@"Data\XML\processbar-stateloading.xml");
            //objectManagerArray[4] = new PortralManager(@"Data\Portral\Portral.xml");
            //objectManagerArray[5] = new MapObstacleManager(@"Data\MapObstacle\MapObstacle.xml");
            //objectManagerArray[6] = new ProjectileManager(@"Data\Projectile\Projectile.xml");
            //objectManagerArray[7] = new SkillManager(@"Data\Skill\Skill.xml");
            //objectManagerArray[8] = new GameFrameManager(@"Data\XML\gameframe-statemaingame.xml");
            //objectManagerArray[9] = new ProcessBarManager(@"Data\XML\processbar-statemaingame.xml");
            //objectManagerArray[10] = new ButtonManger(@"Data\XML\buttonmanager-statemaingame.xml");
            //objectManagerArray[11] = new LabelManager(@"Data\XML\labelmanager-statemaingame.xml");

            //_gameState = new StateLoading();
            //_gameState.InitState(null, this);
            //((StateLoading)_gameState).GetDataLoading(Content, @"./Data/XML/loadingtomenu.xml", objectManagerArray, typeof(StateMainGame));
            //_gameState.EnterState();
        }
        //--------------------Su kien New Game frame------------------
        void StateMenu_Move_Complete_NewGame(object sender, EventArgs e)
        {
            if (_indexOfNextState != 0)
                return;
            GameFrame _frame = (GameFrame)sender;
            if (_frame.IsVisible == false)
            {
                int nObjectManager = 12;
                GameObjectManager[] objectManagerArray = new GameObjectManager[nObjectManager];

                objectManagerArray[1] = new MapManager(@"Data\Map\map.xml");
                objectManagerArray[0] = new PlayerCharacterManager(@"Data\character\character.xml");
                objectManagerArray[2] = new MonsterManager(@"Data\monster\monster.xml");
                objectManagerArray[3] = new ProcessBarManager(@"Data\XML\processbar-stateloading.xml");
                objectManagerArray[4] = new PortralManager(@"Data\Portral\Portral.xml");
                objectManagerArray[5] = new MapObstacleManager(@"Data\MapObstacle\MapObstacle.xml");
                objectManagerArray[6] = new ProjectileManager(@"Data\Projectile\Projectile.xml");
                objectManagerArray[7] = new SkillManager(@"Data\Skill\Skill.xml");
                objectManagerArray[8] = new GameFrameManager(@"Data\XML\gameframe-statemaingame.xml");
                objectManagerArray[9] = new ProcessBarManager(@"Data\XML\processbar-statemaingame.xml");
                objectManagerArray[10] = new ButtonManger(@"Data\XML\buttonmanager-statemaingame.xml");
                objectManagerArray[11] = new LabelManager(@"Data\XML\labelmanager-statemaingame.xml");

                Owner.GameState = new StateLoading();
                Owner.GameState.InitState(null, Owner);
                ((StateLoading)Owner.GameState).GetDataLoading(Owner.Content, @"./Data/XML/loadingtomenu.xml", objectManagerArray, typeof(StateMainGame));
                Owner.GameState.EnterState();
            }
        }
        //Su kien button OK
        public void OKButton_Click(object sender, EventArgs e)
        {
            int nObjectManager = 3;
            GameObjectManager[] objectManagerArray = new GameObjectManager[nObjectManager];
            objectManagerArray[0] = new BackgroundManager(@"./Data/XML/menubg.xml");
            objectManagerArray[1] = new GameFrameManager(@"./Data/XML/gameframe-statemenu.xml");
            objectManagerArray[2] = new ButtonManger(@"./Data/XML/buttonmanager-statemenu.xml");

            _stateOwner.Owner.GameState = new StateLoading();
            _stateOwner.Owner.GameState.InitState(null, _stateOwner.Owner);
            ((StateLoading)_stateOwner.Owner.GameState).GetDataLoading(_stateOwner.Owner.Content, @"./Data/XML/loadingtomenu.xml", objectManagerArray, typeof(StateMenuManager));
            _stateOwner.Owner.GameState.EnterState();
        }