Ejemplo n.º 1
0
        public void LoadTiles(string path)
        {
            int           width;
            List <string> textlines  = new List <string>();
            StreamReader  fileReader = new StreamReader(path);
            string        line       = fileReader.ReadLine();

            width = line.Length;
            while (line != null)
            {
                textlines.Add(line);
                line = fileReader.ReadLine();
            }
            TileField tiles = new TileField(textlines.Count - 1, width, 1, "tiles");

            this.Add(tiles);
            tiles.CellWidth  = 32;
            tiles.CellHeight = 32;

            for (int x = 0; x < width; ++x)
            {
                for (int y = 0; y < textlines.Count - 1; ++y)
                {
                    Tile t = LoadTile(textlines[y][x], x, y);
                    tiles.Add(t, x, y);
                }
            }
        }
Ejemplo n.º 2
0
        public void LoadTiles(string path)
        {
            int width;
            List<string> textlines = new List<string>();
            StreamReader fileReader = new StreamReader(path);
            string line = fileReader.ReadLine();
            width = line.Length;
            while (line != null)
            {
                textlines.Add(line);
                line = fileReader.ReadLine();
            }
            TileField tiles = new TileField(textlines.Count - 1, width, 1, "tiles");

            this.Add(tiles);
            tiles.CellWidth = 32;
            tiles.CellHeight = 32;

            for (int x = 0; x < width; ++x)
            {
                for (int y = 0; y < textlines.Count - 1; ++y)
                {
                    Tile t = LoadTile(textlines[y][x], x, y);
                    tiles.Add(t, x, y);
                }
            }
        }