Beispiel #1
0
        //load la map
        private void CreerAreaDic(int mapid)
        {
            MondeControllerClient client   = new MondeControllerClient();
            List <Monde>          lstmonde = client.GetListMonde();

            _currentWorld = lstmonde.FirstOrDefault(c => c.Id == mapid);
            if (_currentWorld == null)
            {
                return;
            }
            int Mondex = int.Parse(_currentWorld.LimiteX) / 8;
            int Mondey = int.Parse(_currentWorld.LimiteY) / 8;

            for (int x = 0; x < Mondex; x++)
            {
                for (int y = 0; y < Mondey; y++)
                {
                    Area area = new Area(mapid, x, y, _tiles);
                    _world.Add(area.Name, area);
                }
            }
        }
Beispiel #2
0
        //load la map 
        private void CreerAreaDic(int mapid)
        {
            MondeControllerClient client = new MondeControllerClient();
            List<Monde> lstmonde = client.GetListMonde();
            _currentWorld = lstmonde.FirstOrDefault(c => c.Id == mapid);
            if (_currentWorld == null)
                return;
            int Mondex = int.Parse(_currentWorld.LimiteX) / 8;
            int Mondey = int.Parse(_currentWorld.LimiteY) / 8;

            for (int x = 0; x < Mondex; x++)
            {

                for (int y = 0; y < Mondey; y++)
                {
                    Area area = new Area(mapid, x, y, _tiles);
                    _world.Add(area.Name, area);
                }
            }
        }
Beispiel #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="Mondeid"></param>
        /// <param name="x">Position du héro X</param>
        /// <param name="y">Position du héro Y</param>
        /// <param name="tiles"></param>
        public Area(int Mondeid, int x, int y, Dictionary <string, Tile> tiles)
        {
            _x     = x;
            _y     = y;
            _tiles = tiles;
            FillGrass();
            MondeControllerClient client   = new MondeControllerClient();
            List <Monde>          lstmonde = client.GetListMonde();

            currentWorld = lstmonde.FirstOrDefault(c => c.Id == Mondeid);

            Name = x.ToString() + ',' + y.ToString();
            if (y == 0)
            {
                NorthArea = "-";
            }
            else
            {
                NorthArea = x.ToString() + ',' + (y - 1).ToString();
            }

            if (x * 8 + 8 == int.Parse(currentWorld.LimiteX))
            {
                EastArea = "-";
            }
            else
            {
                EastArea = (x + 1).ToString() + ',' + (y).ToString();
            }

            if (y * 8 + 8 == int.Parse(currentWorld.LimiteY))
            {
                SouthArea = "-";
            }
            else
            {
                SouthArea = x.ToString() + ',' + (y + 1).ToString();
            }

            if (x == 0)
            {
                WestArea = "-";
            }
            else
            {
                WestArea = (x - 1).ToString() + ',' + (y).ToString();
            }


            if (currentWorld == null)
            {
                return;
            }
            int Mondex = int.Parse(currentWorld.LimiteX) / 8;
            int Mondey = int.Parse(currentWorld.LimiteY) / 8;



            //Read in 8 lines of 8 characters each. Look up the tile and make the
            //matching sprite

            Refresh();



            ////Read game objects until the blank line
            //while (!stream.EndOfStream && (line = stream.ReadLine().Trim()) != "")
            //{
            //    //Each line is an x,y coordinate and a tile shortcut
            //    //Look up the tile and construct the sprite
            //    string[] elements = line.Split(',');
            //    int x = Convert.ToInt32(elements[0]);
            //    int y = Convert.ToInt32(elements[1]);
            //    MapTile mapTile = Map[x, y];
            //    mapTile.ObjectTile = tiles[elements[2]];
            //    mapTile.SetObjectSprite(x, y);

            //    if (mapTile.ObjectTile.IsTransparent)
            //    {
            //        mapTile.ObjectSprite.ColorKey = Color.FromArgb(75, 75, 75);
            //    }
            //}
        }
Beispiel #4
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="Mondeid"></param>
        /// <param name="x">Position du héro X</param>
        /// <param name="y">Position du héro Y</param>
        /// <param name="tiles"></param>
        public Area(int Mondeid, int x, int y, Dictionary<string, Tile> tiles)
        {
            _x = x;
            _y = y;
            _tiles = tiles;
            FillGrass();
            MondeControllerClient client = new MondeControllerClient();
            List<Monde> lstmonde = client.GetListMonde();
            currentWorld = lstmonde.FirstOrDefault(c => c.Id == Mondeid);

            Name = x.ToString() + ',' + y.ToString();
            if (y == 0)
                NorthArea = "-";
            else
                NorthArea = x.ToString() + ',' + (y - 1).ToString();

            if (x * 8 + 8 == int.Parse(currentWorld.LimiteX))
                EastArea = "-";
            else
                EastArea = (x + 1).ToString() + ',' + (y).ToString();

            if (y * 8 + 8 == int.Parse(currentWorld.LimiteY))
                SouthArea = "-";
            else
                SouthArea = x.ToString() + ',' + (y + 1).ToString();

            if (x == 0)
                WestArea = "-";
            else
                WestArea = (x - 1).ToString() + ',' + (y).ToString();


            if (currentWorld == null)
                return;
            int Mondex = int.Parse(currentWorld.LimiteX) / 8;
            int Mondey = int.Parse(currentWorld.LimiteY) / 8;



            //Read in 8 lines of 8 characters each. Look up the tile and make the
            //matching sprite

            Refresh();





            ////Read game objects until the blank line
            //while (!stream.EndOfStream && (line = stream.ReadLine().Trim()) != "")
            //{
            //    //Each line is an x,y coordinate and a tile shortcut
            //    //Look up the tile and construct the sprite
            //    string[] elements = line.Split(',');
            //    int x = Convert.ToInt32(elements[0]);
            //    int y = Convert.ToInt32(elements[1]);
            //    MapTile mapTile = Map[x, y];
            //    mapTile.ObjectTile = tiles[elements[2]];
            //    mapTile.SetObjectSprite(x, y);

            //    if (mapTile.ObjectTile.IsTransparent)
            //    {
            //        mapTile.ObjectSprite.ColorKey = Color.FromArgb(75, 75, 75);
            //    }
            //}

        }