static void InitLevel6() { FileStream fs = new FileStream("../../map.txt", FileMode.Open, FileAccess.Read); StreamReader read = new StreamReader(fs, Encoding.Default); string strReadline; int y = 0; while ((strReadline = read.ReadLine()) != null) { Console.WriteLine(strReadline); for (int x = 0; x < strReadline.Length; ++x) { if (strReadline[x] == '#') { Walls wall = new Walls(); wall.SetPos(x, y); Rogue.walls[MapPos(wall.x, wall.y)] = wall; } if (strReadline[x] == '!') { Rogue.AddMonster(x, y, 1, 1); } if (strReadline[x] == '%') { Yaoshi yaoshi = new Yaoshi(); yaoshi.SetPos(x, y); Rogue.yaoshis[MapPos(yaoshi.x, yaoshi.y)] = yaoshi; } if (strReadline[x] == '=') { Door door = new Door(); door.SetPos(x, y); Rogue.doors[MapPos(door.x, door.y)] = door; } if (strReadline[x] == '^') { Trap trap = new Trap(); trap.SetPos(x, y); Rogue.traps[MapPos(trap.x, trap.y)] = trap; } if (strReadline[x] == '↓') { Loutidowm loutidown = new Loutidowm(); loutidown.SetPos(x, y); Rogue.loutis_d [MapPos(loutidown.x, loutidown.y)] = loutidown; } if (strReadline[x] == '*') { Trap trap = new Trap(); trap.SetPos(x, y); Rogue.trap2s[MapPos(trap.x, trap.y)] = trap; } if (strReadline[x] == '剑') { Equipment baojian = new Equipment("宝剑", 100); baojian.SetPos(x, y); Rogue.equipments[MapPos(baojian.x, baojian.y)] = baojian; } } y += 1; // strReadline即为按照行读取的字符串 } Rogue.onMonsterDead = (Monster monster) => { if (Rogue.doors.Count() <= 1) { Rogue.OnStageClear(); } return(true); }; }