Ejemplo 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();
            }
        }
Ejemplo n.º 2
0
        internal List <MapObstacle> InitObstacle(MapObstacleManager mapObstacleManager, string xmlMapObstacleFile)
        {
            List <MapObstacle> ret = new List <MapObstacle>();
            XmlDocument        doc = new XmlDocument();

            doc.Load(xmlMapObstacleFile);
            XmlNodeList MapObstacles = doc.SelectNodes(@"//MapObstacle");

            for (int i = 0; i < MapObstacles.Count; ++i)
            {
                MapObstacle pt = (MapObstacle)mapObstacleManager.CreateObject(int.Parse(MapObstacles[i].SelectSingleNode(@"Type").InnerText));
                ret.Add(pt);
                int XLogic = int.Parse(MapObstacles[i].SelectSingleNode(@"X").InnerText);
                int YLogic = int.Parse(MapObstacles[i].SelectSingleNode(@"Y").InnerText);
                ret[i].X = XLogic * GlobalVariables.MapCollisionDim;
                ret[i].Y = YLogic * GlobalVariables.MapCollisionDim;
                for (int j = YLogic + ret[i].StartObstacleY; j < ret[i].ObstacleHeight + YLogic + ret[i].StartObstacleY; ++j)
                {
                    for (int k = XLogic + ret[i].StartObstacleX; k < ret[i].ObstacleWidth + XLogic + ret[i].StartObstacleX; ++k)
                    {
                        Matrix[j][k] = false;
                    }
                }
            }
            return(ret);
        }
Ejemplo n.º 3
0
 internal List<MapObstacle> InitObstacle(MapObstacleManager mapObstacleManager, string xmlMapObstacleFile)
 {
     List<MapObstacle> ret = new List<MapObstacle>();
     XmlDocument doc = new XmlDocument();
     doc.Load(xmlMapObstacleFile);
     XmlNodeList MapObstacles = doc.SelectNodes(@"//MapObstacle");
     for (int i = 0; i < MapObstacles.Count; ++i)
     {
         MapObstacle pt = (MapObstacle)mapObstacleManager.CreateObject(int.Parse(MapObstacles[i].SelectSingleNode(@"Type").InnerText));
         ret.Add(pt);
         int XLogic = int.Parse(MapObstacles[i].SelectSingleNode(@"X").InnerText);
         int YLogic = int.Parse(MapObstacles[i].SelectSingleNode(@"Y").InnerText);
         ret[i].X = XLogic * GlobalVariables.MapCollisionDim;
         ret[i].Y = YLogic * GlobalVariables.MapCollisionDim;
         for (int j = YLogic + ret[i].StartObstacleY; j < ret[i].ObstacleHeight + YLogic + ret[i].StartObstacleY; ++j)
         {
             for (int k = XLogic + ret[i].StartObstacleX; k < ret[i].ObstacleWidth + XLogic + ret[i].StartObstacleX; ++k)
             {
                 Matrix[j][k] = false;
             }
         }
     }
     return ret;
 }
        //--------------------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();
            }
        }