Exemplo n.º 1
0
        public void ReadTheMap()
        {
            MapIsLoad = true;
            ListTexture.RemoveRange(0, ListTexture.Count);
            ListElement.RemoveRange(0, ListElement.Count);
            Path = Directory.GetCurrentDirectory() + @"\Map\" + X + "," + Y + ".txt";
            string       line;
            StreamReader sr = new StreamReader(File.Open(Path, FileMode.Open));

            while ((line = sr.ReadLine()) != null)
            {
                if (line.Substring(0, 7) != "monstre")
                {
                    for (int i = 0; i < line.Length; i += 3)
                    {
                        ListTexture.Add(line.Substring(i, 3));
                    }
                }
                else
                {
                    for (int i = 9; i < line.Length; i += 9)
                    {
                        ListElement.Add(line.Substring(i, 9));
                    }
                }
            }
            sr.Close();
        }