示例#1
0
        public static void ReadMap(string s)
        {
            FileStream   fs   = new FileStream(s, 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] == '#')
                    {
                        Rogue.AddWall(x, y);
                    }
                    else if (strReadline[x] == 'j')
                    {
                        Rogue.AddGear(x, y);
                    }
                }
                y += 1;
            }

            fs.Close();

            read.Close();
        }
示例#2
0
        static void InitLevel1()
        {
            Rogue.level_target = "目标:消灭所有怪物。";

            Rogue.AddMonster(1, 1, 1);
            Rogue.AddMonster(10, 5, 2);
            Rogue.AddMonster(15, 14, 3);

            Rogue.AddMonster(0, 10, 9);

            OldMan oldman = new OldMan("戴黑框眼镜的老者", 100);

            oldman.SetPos(Rogue.map_width - 1, Rogue.map_height - 1);
            Rogue.npcs[MapPos(oldman.x, oldman.y)] = oldman;

            Rogue.onMonsterDead = (Monster monster) =>
            {
                if (Rogue.monsters.Count() <= 1)
                {
                    Rogue.OnStageClear();
                }
                return(true);
            };

            //// 匿名函数还可以像下面这样写:

            //Rogue.onMonsterDead = delegate (Monster monster)
            //{
            //    if (Rogue.monsters.Count() <= 1)
            //    {
            //        Rogue.OnStageClear();
            //    }
            //    return true;
            //};
        }
示例#3
0
        static void InitLevel2()
        {
            OldMan2 o = new OldMan2("守门者", 5);

            o.SetPos(3, 7);
            Rogue.npcs[MapPos(o.x, o.y)] = o;
            Rogue.ReadMap("../../map13.txt");
        }
示例#4
0
        static void InitLevel1()
        {
            OldMan1 o = new OldMan1("采药老者", 5);

            o.SetPos(29, 14);
            Rogue.npcs[MapPos(o.x, o.y)] = o;

            Rogue.AddGear(2, 7);
        }
示例#5
0
 // 自定义关卡流程,新加关卡可以再后面加,也可以删除关卡或者调整顺序
 public static void AddAllLevels()
 {
     Rogue.AddLevel(InitLevel6);
     Rogue.AddLevel(InitLevel7);
     //Rogue.AddLevel(InitLevel5);
     //Rogue.AddLevel(InitLevel4);
     //Rogue.AddLevel(InitLevel1);
     //Rogue.AddLevel(InitLevel2);
     //Rogue.AddLevel(InitLevel3);
 }
示例#6
0
 public override bool OnTalk(Player player, out string text)
 {
     if (player.attack > 129)
     {
         text = name + ":" + "谢谢骑士你把我就救出去,我会让我父王重金酬谢你的";
         Rogue.OnStageClear();
         return(true);
     }
     text = name + ":" + "你也太弱了吧,哼,天知道你是怎么到这的";
     return(false);
 }
示例#7
0
        static void InitLevel3()
        {
            Rogue.level_target = "目标:消灭Boss!";
            Rogue.AddMonster(3, 3, Rogue.random.Next(1, 3), 10);
            Rogue.AddMonster(15, 20, Rogue.random.Next(1, 3), 10);
            Rogue.AddMonster(20, 1, Rogue.random.Next(2, 4), 10);
            Monster boss1 = Rogue.AddMonster(Rogue.map_width / 2, Rogue.map_height - 1, 90);

            boss1.attack = 8;

            Merchant merchant = new Merchant("尖嘴猴腮的胖子", 200);

            merchant.SetPos(Rogue.map_width - 1, Rogue.map_height - 1);
            Rogue.npcs[MapPos(merchant.x, merchant.y)] = merchant;

            Rogue.onMonsterDead = (Monster monster) =>
            {
                if (monster.id == 202)
                {
                    Rogue.OnStageClear();
                    return(true);
                }

                if (monster == boss1)
                {
                    merchant.SetState(2);
                    return(true);
                }

                MonsterDropMoney(monster);

                int pos = Rogue.RandPos();
                int x, y;
                MapXY(pos, out x, out y);
                if (Rogue.player.level < 9 && Rogue.player.money < 100)
                {
                    Rogue.AddMonster(x, y, Rogue.player.level + 2, (Rogue.player.level + 1) * 10);
                }

                return(true);
            };
        }
示例#8
0
        static void InitLevel5()
        {
            Rogue.AddMonster(13, 5, 1);
            Rogue.AddMonster(13, 3, 1);
            Rogue.AddMonster(8, 3, 1);
            Rogue.AddMonster(8, 5, 3);
            Rogue.AddMonster(21, 5, 12);
            Rogue.AddMonster(8, 10, 75);
            OldMan oldman = new OldMan("传说中的人物", 101);

            oldman.SetPos(8, 6);
            Rogue.npcs[MapPos(oldman.x, oldman.y)] = oldman;
            Rogue.onMonsterDead = (Monster monster) =>
            {
                if (Rogue.monsters.Count() <= 1)
                {
                    Rogue.OnStageClear();
                }
                return(true);
            };
        }
示例#9
0
        static void InitLevel2()
        {
            Rogue.level_target = "目标:升到9级。";
            Rogue.AddMonster(3, 3, 1);

            Rogue.onMonsterDead = (Monster monster) =>
            {
                if (Rogue.player.level == 8)
                {
                    Rogue.OnStageClear();
                    return(true);
                }

                int pos = Rogue.RandPos();
                int x, y;
                MapXY(pos, out x, out y);
                Rogue.AddMonster(x, y, 1);

                Rogue.level_target = string.Format("目标:升到9级。({0}/9)", Rogue.player.level + 1);
                return(true);
            };
        }
示例#10
0
 // 自定义关卡流程,新加关卡可以再后面加,也可以删除关卡或者调整顺序
 public static void AddAllLevels()
 {
     Rogue.AddLevel(InitLevel1);
     Rogue.AddLevel(InitLevel2);
     Rogue.AddLevel(InitLevel3);
 }
示例#11
0
        static void InitLevel7()
        {
            Rogue.monsters.Clear();
            Rogue.walls.Clear();
            Rogue.yaoshis.Clear();
            Rogue.doors.Clear();
            Rogue.trap2s.Clear();
            Rogue.traps.Clear();

            FileStream   fs   = new FileStream("C:\\Users\\meta42games\\Desktop\\Map地图游戏\\Map地图游戏\\Map地图游戏\\map2.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] == '*')
                    {
                        Trap trap = new Trap();
                        trap.SetPos(x, y);
                        Rogue.trap2s[MapPos(trap.x, trap.y)] = trap;
                    }
                }
                y += 1;
                // strReadline即为按照行读取的字符串
            }
            Rogue.onMonsterDead = (Monster monster) =>
            {
                if (Rogue.monsters.Count() <= 1)
                {
                    Rogue.OnStageClear();
                }
                return(true);
            };
        }
示例#12
0
        // 返回值: 是否需要刷新
        static bool MovePlayer()//移动玩家
        {
            ConsoleKeyInfo key = Console.ReadKey();

            int next_x = player.x;
            int next_y = player.y;

            if (key.Key == ConsoleKey.UpArrow)
            {
                next_y -= 1;
            }
            else if (key.Key == ConsoleKey.DownArrow)
            {
                next_y += 1;
            }
            else if (key.Key == ConsoleKey.LeftArrow)
            {
                next_x -= 1;
            }
            else if (key.Key == ConsoleKey.RightArrow)
            {
                next_x += 1;
            }
            else
            {
                return(true);
            }

            if (next_x < 0 || next_x >= map_width || next_y < 0 || next_y >= map_height)
            {
                return(true);
            }
            int next_pos = MapPos(next_x, next_y);

            if (moneys.ContainsKey(next_pos))//如果遇到金币
            {
                Money money = moneys[next_pos];
                below_text    = "捡到 " + money.money + " 颗金币。";
                player.money += money.money;
                moneys.Remove(next_pos);
            }
            else if (loutis_d.ContainsKey(next_pos))//如果遇到往下走的楼梯
            {
                Rogue.monsters.Clear();
                Rogue.walls.Clear();
                Rogue.yaoshis.Clear();
                Rogue.doors.Clear();
                Rogue.trap2s.Clear();
                Rogue.traps.Clear();
                Rogue.loutis_u.Clear();
                Map_save();
                DrawOther();
            }

            else if (yaoshis.ContainsKey(next_pos))
            {
                Yaoshi yaoshi = yaoshis[next_pos];
                below_text     = "捡到一把钥匙";
                player.yaoshi += 1;
                yaoshis.Remove(next_pos);
            }
            else if (doors.ContainsKey(next_pos))
            {
                if (player.yaoshi >= 1)
                {
                    Door door = doors[next_pos];
                    below_text     = "门打开了";
                    player.yaoshi -= 1;
                    doors.Remove(next_pos);
                }
                else
                {
                    below_text = "寻找一把钥匙,方可打开此门";
                }
            }
            else if (monsters.ContainsKey(next_pos))//如果遇到怪兽
            {
                Monster monster = monsters[next_pos];
                string  info;
                int     result = player.Attack(monster, out info);
                below_text = info;
                if (result == -1)
                {
                    GameOver();
                    return(true);
                }
                else if (result == 1)
                {
                    bool ret = onMonsterDead(monster);
                    if (ret)
                    {
                        below_text += "怪物死亡。";
                        player.AddExp(monster.level);
                        monsters.Remove(next_pos);
                    }
                }
            }
            else if (npcs.ContainsKey(next_pos))//如果遇到NPC
            {
                NPC    npc = npcs[next_pos];
                string s;
                if (npc.OnTalk(player, out s))
                {
                    npcs.Remove(next_pos);
                    object o = npc.AfterDisappear();
                    if (o is Monster)
                    {
                        Monster m = o as Monster;
                        monsters[MapPos(m.x, m.y)] = m;
                    }
                }
                below_text = s;
            }
            else if (walls.ContainsKey(next_pos))//如果遇到墙
            {
            }
            else if (trap2s.ContainsKey(next_pos))//如果遇到陷阱2
            {
                Trap trap = trap2s[next_pos];
                trap2s.Remove(next_pos);
                Rogue.AddMonster(11, 8, 4);
                Rogue.AddMonster(12, 8, 4);
                Rogue.AddMonster(13, 8, 4);
            }
            else if (traps.ContainsKey(next_pos))//如果遇到陷阱
            {
                Trap trap1 = traps[next_pos];
                traps.Remove(next_pos);

                player.x = 15;
                player.y = 0;
            }
            else if (equipments.ContainsKey(next_pos))//如果遇到装备
            {
                Equipment equipment = equipments[next_pos];
                equipments.Remove(next_pos);
                player.AddAtk(100);
                object o = equipment.AfterDisappear();
                if (o is Trap)
                {
                    Trap m = o as Trap;
                    traps[MapPos(m.x, m.y)] = m;
                }
            }
            else if (princess.ContainsKey(next_pos))//如果遇到公主
            {
                Base_Princess princess1 = princess[next_pos];
                string        s;
                if (princess1.OnTalk(player, out s))
                {
                    princess.Remove(next_pos);
                    object o = princess1.AfterDisappear();
                    if (o is NPC)
                    {
                        NPC m = o as NPC;
                        npcs[MapPos(m.x, m.y)] = m;
                    }
                }
                below_text = s;
            }

            else
            {
                MapXY(next_pos, out player.x, out player.y);
            }
            // 玩家行动结束


            // 所有怪物行动
            List <int> remove_keys = new List <int>();
            Dictionary <int, Monster> new_monsters = new Dictionary <int, Monster>();

            foreach (var pair in monsters)
            {
                int new_pos = MonsterMove(pair.Value);
                if (new_pos != pair.Key)
                {
                    // 更新Key
                    remove_keys.Add(pair.Key);
                    new_monsters[new_pos] = pair.Value;
                }
            }

            for (int i = 0; i < remove_keys.Count(); ++i)
            {
                monsters.Remove(remove_keys[i]);
            }
            foreach (var new_pair in new_monsters)
            {
                monsters[new_pair.Key] = new_pair.Value;
            }

            return(true);
        }
示例#13
0
        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);
            };
        }
示例#14
0
        static void InitLevel3()
        {
            Rogue.level_target = "目标:消灭大魔王,救出公主。";

            BuildWall();

            Rogue.AddMonster(5, 4, 21, 50);
            Rogue.AddMonster(24, 4, 37);
            Rogue.AddMonster(24, 10, 120);
            Rogue.AddMonster(5, 10, 21, 50);
            Rogue.AddMonster(5, 7, 21, 50);
            Rogue.AddMonster(24, 7, 121);
            Rogue.AddMonster(27, 7, 150);
            for (int i = 0; i < 15; i++)
            {
                Rogue.AddMonster(10, i, 34, 10);
            }
            for (int i = 0; i < 15; i++)
            {
                Rogue.AddMonster(15, i, 34, 10);
            }
            for (int i = 0; i < 15; i++)
            {
                Rogue.AddMonster(20, i, 34, 10);
            }

            Equipment equipment = new Equipment("利刃", 20);

            equipment.SetPos(3, 7);
            Rogue.equipments[MapPos(equipment.x, equipment.y)] = equipment;

            Equipment equipment1 = new Equipment("屠魔剑", 8);

            equipment1.SetPos(26, 6);
            Rogue.equipments[MapPos(equipment1.x, equipment1.y)] = equipment1;

            Prop prop = new Prop("人参", 96);

            prop.SetPos(29, 14);
            Rogue.props[MapPos(prop.x, prop.y)] = prop;

            Businessman1 businessman1 = new Businessman1("被关在地牢中的冒险家", 1);

            businessman1.SetPos(0, 0);
            Rogue.npcs[MapPos(businessman1.x, businessman1.y)] = businessman1;

            Businessman2 businessman2 = new Businessman2("商人", 2);

            businessman2.SetPos(0, 14);
            Rogue.npcs[MapPos(businessman2.x, businessman2.y)] = businessman2;

            Pangolin pangolin = new Pangolin("盗贼", 3);

            pangolin.SetPos(29, 0);
            Rogue.npcs[MapPos(pangolin.x, pangolin.y)] = pangolin;

            Princess princess = new Princess("公主", 10);

            princess.SetPos(29, 7);
            Rogue.npcs[MapPos(princess.x, princess.y)] = princess;

            Rogue.onMonsterDead = (Monster monster) =>
            {
                MonsterDropMoney(monster);
                return(true);
            };
            //// 匿名函数还可以像下面这样写:

            //Rogue.onMonsterDead = delegate (Monster monster)
            //{
            //    if (Rogue.monsters.Count() <= 1)
            //    {
            //        Rogue.OnStageClear();
            //    }
            //    return true;
            //};
        }
示例#15
0
        static void InitLevel4()
        {
            Rogue.level_target = "找到正真的公主";

            Rogue.AddMonster(13, 0, 1);


            Rogue.AddMonster(8, 5, 3);
            Rogue.AddMonster(21, 5, 12, 100);
            Rogue.AddMonster(8, 10, 80, 100);
            //Rogue.AddMonster(21, 10, 13);

            Rogue.AddMonster(21, 8, 1000);
            Rogue.AddMonster(8, 8, 90);

            for (int i = 0; i < 9; i++)
            {
                Walls wall = new Walls();
                wall.SetPos(i, 6);
                Rogue.walls[MapPos(wall.x, wall.y)] = wall;
            }
            for (int i = 0; i < 5; i++)
            {
                Walls wall = new Walls();
                wall.SetPos(8, i);
                Rogue.walls[MapPos(wall.x, wall.y)] = wall;
            }
            for (int i = 0; i < 9; i++)
            {
                Walls wall = new Walls();
                wall.SetPos(i, 9);
                Rogue.walls[MapPos(wall.x, wall.y)] = wall;
            }
            for (int i = 11; i < 15; i++)
            {
                Walls wall = new Walls();
                wall.SetPos(8, i);
                Rogue.walls[MapPos(wall.x, wall.y)] = wall;
            }
            for (int i = 21; i < 27; i++)
            {
                Walls wall = new Walls();
                wall.SetPos(i, 6);
                Rogue.walls[MapPos(wall.x, wall.y)] = wall;
            }
            for (int i = 28; i < 30; i++)
            {
                Walls wall = new Walls();
                wall.SetPos(i, 6);
                Rogue.walls[MapPos(wall.x, wall.y)] = wall;
            }
            for (int i = 21; i < 30; i++)
            {
                Walls wall = new Walls();
                wall.SetPos(i, 9);
                Rogue.walls[MapPos(wall.x, wall.y)] = wall;
            }
            for (int i = 0; i < 5; i++)
            {
                Walls wall = new Walls();
                wall.SetPos(21, i);
                Rogue.walls[MapPos(wall.x, wall.y)] = wall;
            }
            for (int i = 11; i < 15; i++)
            {
                Walls wall = new Walls();
                wall.SetPos(21, i);
                Rogue.walls[MapPos(wall.x, wall.y)] = wall;
            }


            Walls walls = new Walls();

            walls.SetPos(21, 7);
            Rogue.walls[MapPos(walls.x, walls.y)] = walls;

            Walls walls2 = new Walls();

            walls2.SetPos(8, 7);
            Rogue.walls[MapPos(walls2.x, walls.y)] = walls2;


            OldMan oldman = new OldMan("传说中的人物", 101);

            oldman.SetPos(0, 0);
            Rogue.npcs[MapPos(oldman.x, oldman.y)] = oldman;

            Merchant merchant = new Merchant("奇怪的东西", 201);

            merchant.SetPos(21, 10);//21
            Rogue.npcs[MapPos(merchant.x, merchant.y)] = merchant;

            Merchant merchant2 = new Merchant("商人", 200);

            merchant2.SetPos(Rogue.map_width - 1, 0);
            Rogue.npcs[MapPos(merchant2.x, merchant2.y)] = merchant2;

            Princess gongzhu = new Princess("美丽善良的公主", 300);

            gongzhu.SetPos(Rogue.map_width - 1, 7);
            Rogue.princess[MapPos(gongzhu.x, gongzhu.y)] = gongzhu;

            Princess2 gongzhu2 = new Princess2("邪恶的公主", 300);

            gongzhu2.SetPos(0, 7);
            Rogue.princess[MapPos(gongzhu2.x, gongzhu2.y)] = gongzhu2;

            Dabaojian equipment = new Dabaojian("宝剑", 300);

            equipment.SetPos(Rogue.map_width - 1, Rogue.map_height - 1);
            Rogue.equipments[MapPos(equipment.x, equipment.y)] = equipment;

            Monster boss1 = Rogue.AddMonster(0, Rogue.map_height - 1, 140);

            boss1.attack = 50;



            Rogue.onMonsterDead = (Monster monster) =>
            {
                if (Rogue.monsters.Count() <= 1)
                {
                    Rogue.OnStageClear();
                }

                if (monster == boss1)
                {
                    merchant.SetState(2);
                    return(true);
                }



                MonsterDropMoney(monster);
                int pos = Rogue.RandPos2();
                int x, y;
                MapXY(pos, out x, out y);
                if (Rogue.player.level < 2)
                {
                    Rogue.AddMonster(x, y, Rogue.player.level + 1);
                }

                return(true);
            };
        }
示例#16
0
            public static void Draw()
            {
                DrawEngine.SplashScreen.MainScreen2();
                DrawEngine.SplashScreen.MainScreen();

                ConsoleWindows.Window w = new ConsoleWindows.Window();
                w.Animated         = true;
                w.Animation        = ConsoleWindows.Additional.HorizontalAnimation;
                w.Animation.Frames = 2;
                w.Speed            = 10;
                w.Border           = ConsoleWindows.Additional.BoldBorder;
                w.BorderColor      = ConsoleColor.DarkGray;
                //w.Border.HorizontalLine = '░';
                //w.Border.VerticalLine = '⌠';
                w.Border.LowerLeftCorner        = '@';
                w.Border.LowerRightCorner       = '@';
                w.Border.UpperLeftCorner        = '@';
                w.Border.UpperRightCorner       = '@';
                w.Border.PerpendicularRightward = '@';
                w.Border.PerpendicularLeftward  = '@';

                w.Header = true;
                w.Height = 24;
                w.Width  = 26;
                w.Left   = 36;
                w.Top    = 5;

                ConsoleWindows.Text t = new ConsoleWindows.Text(w);
                t.BackgroundColor = ConsoleColor.Black;
                t.TextPosition    = ConsoleWindows.TextPosition.Center;
                t.ForegroundColor = ConsoleColor.DarkCyan;
                t.Write("Dungeon");
                t.ForegroundColor = ConsoleColor.Red;
                t.Write(" 12");
                t.AppendLine();
                t.TextPosition    = ConsoleWindows.TextPosition.Right;
                t.ForegroundColor = ConsoleColor.Red;
                t.WriteLine("Альфа");
                t.TextPosition    = ConsoleWindows.TextPosition.Center;
                t.ForegroundColor = ConsoleColor.Magenta;
                t.Write("[You are not alone]");
                t.AppendLine();

                w.Text = t;

                //Controls
                ConsoleWindows.Button bng = new ConsoleWindows.Button(w);
                bng.Top           = 6;
                bng.Left          = 3;
                bng.Width         = 20;
                bng.Height        = 6;
                bng.ActiveColor   = ConsoleColor.Red;
                bng.InactiveColor = ConsoleColor.DarkRed;
                bng.CloseAfterUse = true;
                bng.Label         = "Вернуться в игру";
                bng.OnClick       = () =>
                {
                    if (Rogue.RAM.Map.Name.IndexOf("Мраумир") != -1)
                    {
                        SoundEngine.Music.TownTheme();
                    }
                    else
                    {
                        SoundEngine.Music.DungeonTheme();
                    }
                    Console.Clear();
                    Console.BackgroundColor = ConsoleColor.Black;
                    DrawEngine.GUIDraw.DrawGUI();
                    DrawEngine.GUIDraw.drawstat();
                };
                w.AddControl(bng);

                ConsoleWindows.Button bfg = new ConsoleWindows.Button(w);
                bfg.Top           = 9;
                bfg.Left          = 3;
                bfg.Width         = 20;
                bfg.Height        = 6;
                bfg.ActiveColor   = ConsoleColor.Red;
                bfg.InactiveColor = ConsoleColor.DarkRed;
                bfg.Label         = "Главное меню";
                bfg.CloseAfterUse = true;
                bfg.OnClick       = () => { SoundEngine.Music.MainTheme(); Rogue.Main(new string[] { "no" }); };
                w.AddControl(bfg);

                ConsoleWindows.Button ba = new ConsoleWindows.Button(w);
                ba.Top           = 12;
                ba.Left          = 3;
                ba.Width         = 20;
                ba.Height        = 6;
                ba.ActiveColor   = ConsoleColor.Red;
                ba.InactiveColor = ConsoleColor.DarkRed;
                ba.Label         = "Глобальный лог";
                ba.CloseAfterUse = true;
                ba.OnClick       = () => { PlayEngine.InGameSettings.Keymap(); };
                w.AddControl(ba);

                ConsoleWindows.Button bex = new ConsoleWindows.Button(w);
                bex.Top           = 15;
                bex.Left          = 3;
                bex.Width         = 20;
                bex.Height        = 6;
                bex.ActiveColor   = ConsoleColor.Red;
                bex.InactiveColor = ConsoleColor.DarkRed;
                bex.Label         = "Выход";
                bex.CloseAfterUse = true;
                bex.OnClick       = () =>
                {
                    Environment.Exit(0);
                };
                w.AddControl(bex);

                w.Draw();
            }
示例#17
0
        static void Map_save()
        {
            FileStream   fs   = new FileStream("../../map2.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] == '$')
                    {
                        Money monry = new Money(100);
                        monry.SetPos(x, y);
                        Rogue.moneys [MapPos(monry.x, monry.y)] = monry;
                    }
                    if (strReadline[x] == '!')
                    {
                        Rogue.AddMonster(x, y, 1);
                    }
                    if (strReadline[x] == '8')
                    {
                        Rogue.AddMonster(x, y, 160, 100);
                    }
                    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] == '*')
                    {
                        Trap trap = new Trap();
                        trap.SetPos(x, y);
                        Rogue.trap2s[MapPos(trap.x, trap.y)] = trap;
                    }
                    if (strReadline[x] == '@')
                    {
                        OldMan oldman = new OldMan("公主", 101);
                        oldman.SetPos(x, y);
                        Rogue.npcs[MapPos(oldman.x, oldman.y)] = oldman;
                    }
                    if (strReadline[x] == '&')
                    {
                        Merchant merchant2 = new Merchant("商人", 200);
                        merchant2.SetPos(x, y);
                        Rogue.npcs[MapPos(merchant2.x, merchant2.y)] = merchant2;
                    }
                }
                y += 1;
                // strReadline即为按照行读取的字符串
            }

            /*Guanka guanka1 = new Guanka(Rogue.monsters, Rogue.npcs, Rogue.walls, Rogue.equipments, Rogue.princess, Rogue.traps, Rogue.doors, Rogue.yaoshis
             * , Rogue.trap2s, Rogue.loutis_d, Rogue.loutis_u);*/
        }