예제 #1
0
        private static Room[] LoadFromFile()
        {
            RoomBuilder  rb = new RoomBuilder();
            StreamReader s  = new StreamReader(File.Open("Maze2.txt", FileMode.Open));

            while (!s.EndOfStream)
            {
                string data = s.ReadLine();

                if (data.Length > 0)
                {
                    switch (data[0])
                    {
                    case '|':
                        rb.AppendWallsAndDoors(data.Substring(1));
                        break;

                    case ':':
                        rb.BeginNewRoom(data.Substring(1));
                        break;

                    default:
                        break;
                    }
                }
            }

            s.Dispose();
            return(rb.GetRooms());
        }
예제 #2
0
        private static Room[] LoadFromFile()
        {
            RoomBuilder rb = new RoomBuilder();
            StreamReader s = new StreamReader(File.Open("Maze2.txt", FileMode.Open));

            while (!s.EndOfStream) {
                string data = s.ReadLine();

                if (data.Length > 0) {
                    switch (data[0]) {
                    case '|':
                        rb.AppendWallsAndDoors(data.Substring(1));
                        break;

                    case ':':
                        rb.BeginNewRoom(data.Substring(1));
                        break;

                    default:
                        break;
                    }
                }
            }

            s.Dispose();
            return rb.GetRooms();
        }