/// <summary> /// 初始化所有楼层地图内容 /// </summary>5p private static void InitializeFloor() { #region 第0层地图 floor_list[0][0, 0] = new SpecialItemImage(SpecialItemType.怪物手册); floor_list[0][0, 3] = new FloorImage(FloorType.白墙); floor_list[0][0, 5] = new FloorImage(FloorType.楼梯上); floor_list[0][0, 7] = new FloorImage(FloorType.白墙); floor_list[0][0, 10] = new SpecialItemImage(SpecialItemType.楼层飞跃器); floor_list[0][1, 3] = new FloorImage(FloorType.白墙); floor_list[0][1, 7] = new FloorImage(FloorType.白墙); floor_list[0][2, 3] = new FloorImage(FloorType.白墙); floor_list[0][2, 7] = new FloorImage(FloorType.白墙); floor_list[0][3, 0] = new FloorImage(FloorType.白墙); floor_list[0][3, 1] = new FloorImage(FloorType.白墙); floor_list[0][3, 2] = new DoorImage(DoorType.黄门); floor_list[0][3, 3] = new FloorImage(FloorType.白墙); floor_list[0][3, 7] = new FloorImage(FloorType.白墙); floor_list[0][3, 8] = new FloorImage(FloorType.白墙); floor_list[0][3, 9] = new DoorImage(DoorType.铁门); floor_list[0][3, 10] = new FloorImage(FloorType.白墙); for (int i = 0; i < 11; i++) { if (i != 5) { floor_list[0][5, i] = new FloorImage(FloorType.熔浆); } } floor_list[0][5, 5] = new KeyImage(KeyType.黄钥匙); floor_list[0][10, 3] = new FloorImage(FloorType.白墙); floor_list[0][9, 3] = new FloorImage(FloorType.白墙); floor_list[0][9, 7] = new FloorImage(FloorType.白墙); floor_list[0][8, 3] = new FloorImage(FloorType.白墙); floor_list[0][8, 7] = new FloorImage(FloorType.白墙); floor_list[0][7, 0] = new FloorImage(FloorType.白墙); floor_list[0][7, 1] = new FloorImage(FloorType.白墙); floor_list[0][7, 2] = new FloorImage(FloorType.白墙); floor_list[0][7, 3] = new FloorImage(FloorType.白墙); floor_list[0][7, 7] = new FloorImage(FloorType.白墙); floor_list[0][7, 8] = new FloorImage(FloorType.白墙); floor_list[0][7, 9] = new FloorImage(FloorType.白墙); floor_list[0][7, 10] = new FloorImage(FloorType.白墙); #endregion #region 第1层地图 floor_list[1][0, 0] = new NPCImage(NPCType.老人, DialogUtility.dialog_1_0_0); floor_list[1][0, 3] = new MonsterImage(MonsterType.绿史莱姆); floor_list[1][0, 5] = new FloorImage(FloorType.楼梯下); floor_list[1][0, 6] = new FloorImage(FloorType.白墙); floor_list[1][0, 8] = new DoorImage(DoorType.黄门); floor_list[1][0, 9] = new MonsterImage(MonsterType.绿史莱姆); floor_list[1][1, 0] = new FloorImage(FloorType.白墙); floor_list[1][1, 1] = new FloorImage(FloorType.白墙); floor_list[1][1, 3] = new FloorImage(FloorType.白墙); floor_list[1][1, 4] = new FloorImage(FloorType.白墙); floor_list[1][1, 5] = new FloorImage(FloorType.白墙); floor_list[1][1, 6] = new FloorImage(FloorType.白墙); floor_list[1][1, 8] = new FloorImage(FloorType.白墙); floor_list[1][1, 10] = new GemstoneImage(GemstoneType.红宝石); floor_list[1][2, 1] = new FloorImage(FloorType.白墙); floor_list[1][2, 3] = new MonsterImage(MonsterType.小蝙蝠); floor_list[1][2, 4] = new MonsterImage(MonsterType.红史莱姆); floor_list[1][2, 8] = new FloorImage(FloorType.白墙); floor_list[1][2, 9] = new FloorImage(FloorType.白墙); floor_list[1][2, 10] = new FloorImage(FloorType.白墙); floor_list[1][3, 1] = new FloorImage(FloorType.白墙); floor_list[1][3, 3] = new FloorImage(FloorType.白墙); floor_list[1][3, 4] = new FloorImage(FloorType.白墙); floor_list[1][3, 5] = new FloorImage(FloorType.白墙); floor_list[1][3, 6] = new FloorImage(FloorType.白墙); floor_list[1][3, 8] = new FloorImage(FloorType.白墙); floor_list[1][4, 0] = new MonsterImage(MonsterType.绿史莱姆); floor_list[1][4, 1] = new DoorImage(DoorType.黄门); floor_list[1][4, 3] = new FloorImage(FloorType.白墙); floor_list[1][4, 4] = new FloorImage(FloorType.白墙); floor_list[1][4, 5] = new FloorImage(FloorType.白墙); floor_list[1][4, 6] = new FloorImage(FloorType.白墙); floor_list[1][4, 8] = new FloorImage(FloorType.白墙); floor_list[1][4, 10] = new FloorImage(FloorType.楼梯上); floor_list[1][5, 0] = new MonsterImage(MonsterType.红史莱姆); floor_list[1][5, 1] = new FloorImage(FloorType.白墙); floor_list[1][5, 3] = new MonsterImage(MonsterType.红史莱姆); floor_list[1][5, 5] = new KeyImage(KeyType.黄钥匙); floor_list[1][5, 6] = new FloorImage(FloorType.白墙); floor_list[1][5, 8] = new DoorImage(DoorType.黄门); floor_list[1][6, 0] = new MonsterImage(MonsterType.绿史莱姆); floor_list[1][6, 1] = new FloorImage(FloorType.白墙); floor_list[1][6, 3] = new FloorImage(FloorType.白墙); floor_list[1][6, 5] = new MonsterImage(MonsterType.绿史莱姆); floor_list[1][6, 6] = new DoorImage(DoorType.黄门); floor_list[1][6, 8] = new FloorImage(FloorType.白墙); floor_list[1][7, 0] = new GemstoneImage(GemstoneType.蓝宝石); floor_list[1][7, 1] = new FloorImage(FloorType.白墙); floor_list[1][7, 2] = new FloorImage(FloorType.白墙); floor_list[1][7, 3] = new FloorImage(FloorType.白墙); floor_list[1][7, 4] = new FloorImage(FloorType.白墙); floor_list[1][7, 5] = new FloorImage(FloorType.白墙); floor_list[1][7, 6] = new FloorImage(FloorType.白墙); floor_list[1][7, 8] = new FloorImage(FloorType.白墙); floor_list[1][8, 2] = new FloorImage(FloorType.白墙); floor_list[1][8, 3] = new MonsterImage(MonsterType.绿史莱姆); floor_list[1][8, 4] = new MonsterImage(MonsterType.红史莱姆); floor_list[1][8, 5] = new GemstoneImage(GemstoneType.红宝石); floor_list[1][8, 6] = new FloorImage(FloorType.白墙); floor_list[1][8, 8] = new FloorImage(FloorType.白墙); floor_list[1][9, 2] = new DoorImage(DoorType.蓝门); floor_list[1][9, 3] = new MonsterImage(MonsterType.小蝙蝠); floor_list[1][9, 4] = new MonsterImage(MonsterType.兽人); floor_list[1][9, 5] = new GemstoneImage(GemstoneType.红血瓶); floor_list[1][9, 6] = new FloorImage(FloorType.白墙); floor_list[1][9, 8] = new FloorImage(FloorType.白墙); floor_list[1][9, 9] = new MonsterImage(MonsterType.红史莱姆); floor_list[1][9, 10] = new MonsterImage(MonsterType.红史莱姆); floor_list[1][10, 1] = new KeyImage(KeyType.黄钥匙); floor_list[1][10, 2] = new FloorImage(FloorType.白墙); floor_list[1][10, 3] = new MonsterImage(MonsterType.绿史莱姆); floor_list[1][10, 4] = new MonsterImage(MonsterType.红史莱姆); floor_list[1][10, 5] = new GemstoneImage(GemstoneType.蓝宝石); floor_list[1][10, 6] = new FloorImage(FloorType.白墙); floor_list[1][10, 8] = new FloorImage(FloorType.白墙); floor_list[1][10, 9] = new GemstoneImage(GemstoneType.蓝血瓶); floor_list[1][10, 10] = new NPCImage(NPCType.老人, DialogUtility.dialog_1_10_10); #endregion //默认添加地板 foreach (IBaseImage[,] image in floor_list) { for (int i = 0; i < 11; i++) { for (int j = 0; j < 11; j++) { if (image[i, j] == null) { image[i, j] = new FloorImage(FloorType.地板); } } } } }
/// <summary> /// 判别碰到的类型 /// </summary> /// <param name="a"></param> /// <param name="e"></param> /// <returns></returns> private bool IsTouch(IBaseImage image) { // 细分类 Enum e = image.GetFineType(); switch (image.GetCoarseType()) { case Atype.地板: switch (e) { case FloorType.地板: image.PlayMusic(image.GetPlayer(), "../../res/se/走路.MP3"); return(true); case FloorType.楼梯上: image.PlayMusic(image.GetPlayer(), "../../res/se/上下楼.MP3"); current_floor = floorFactory.CoreMap(floorFactory.GetFloorNum() + 1); return(true); case FloorType.楼梯下: image.PlayMusic(image.GetPlayer(), "../../res/se/上下楼.MP3"); current_floor = floorFactory.CoreMap(floorFactory.GetFloorNum() - 1); return(true); } return(false); case Atype.门: if (image.isImageExist()) { switch (e) { case DoorType.黄门: if (properties.yellowKey > 0) { MapUtility.ChangeToImage(floorFactory.GetFloorNum(), properties.x, properties.y, new FloorImage(FloorType.地板)); image.HideImage(); properties.yellowKey--; } else { image.PlayMusic(image.GetPlayer(), "../../res/se/开门失败.MP3"); } break; case DoorType.蓝门: if (properties.blueKey > 0) { MapUtility.ChangeToImage(floorFactory.GetFloorNum(), properties.x, properties.y, new FloorImage(FloorType.地板)); image.HideImage(); properties.blueKey--; } else { image.PlayMusic(image.GetPlayer(), "../../res/se/开门失败.MP3"); } break; case DoorType.红门: if (properties.redKey > 0) { MapUtility.ChangeToImage(floorFactory.GetFloorNum(), properties.x, properties.y, new FloorImage(FloorType.地板)); image.HideImage(); properties.redKey--; } else { image.PlayMusic(image.GetPlayer(), "../../res/se/开门失败.MP3"); } break; case DoorType.铁门: MapUtility.ChangeToImage(floorFactory.GetFloorNum(), properties.x, properties.y, new FloorImage(FloorType.地板)); image.HideImage(); break; } } return(false); case Atype.宝石: switch (e) { case GemstoneType.红宝石: properties.atk += 3; break; case GemstoneType.蓝宝石: properties.def += 3; break; case GemstoneType.绿宝石: properties.res += 3; break; case GemstoneType.红血瓶: properties.hp += 100; break; case GemstoneType.蓝血瓶: properties.hp += 300; break; case GemstoneType.黄血瓶: properties.hp += 500; break; case GemstoneType.绿血瓶: properties.hp += 1000; break; case GemstoneType.铁剑: properties.atk += 10; weapon = CommonString.WEAPON_SWORD; break; case GemstoneType.铁盾: properties.def += 10; break; case GemstoneType.银剑: properties.atk += 30; break; case GemstoneType.银盾: properties.def += 30; break; case GemstoneType.骑士剑: properties.atk += 70; break; case GemstoneType.骑士盾: properties.def += 70; break; case GemstoneType.圣剑: properties.atk += 100; break; case GemstoneType.圣盾: properties.def += 100; break; } image.PlayMusic(image.GetPlayer(), "../../res/se/吃物品.MP3"); MapUtility.ChangeToImage(floorFactory.GetFloorNum(), properties.x, properties.y, new FloorImage(FloorType.地板)); image.HideImage(); //更新显伤脚本 MapUtility.UpdateDamage(); return(true); case Atype.特殊物品: MapUtility.ChangeToImage(floorFactory.GetFloorNum(), properties.x, properties.y, new FloorImage(FloorType.地板)); image.PlayMusic(image.GetPlayer(), "../../res/se/吃物品.MP3"); return(true); case Atype.钥匙: switch ((KeyType)e) { case KeyType.黄钥匙: properties.yellowKey++; image.HideImage(); break; case KeyType.蓝钥匙: properties.blueKey++; image.HideImage(); break; case KeyType.红钥匙: properties.redKey++; image.HideImage(); break; } MapUtility.ChangeToImage(floorFactory.GetFloorNum(), properties.x, properties.y, new FloorImage(FloorType.地板)); image.PlayMusic(image.GetPlayer(), "../../res/se/吃物品.MP3"); return(true); case Atype.怪物: MonsterImage monster = new MonsterImage((MonsterType)e); if (CalculationUtility.Battle(monster)) { image.PlayMusic(image.GetPlayer(), "../../res/se/" + weapon + ".MP3"); //删除怪物图片和显伤脚本 image.HideImage(); ((MonsterImage)image).HideDamage(); //删除怪物,更改为地板 MapUtility.ChangeToImage(floorFactory.GetFloorNum(), properties.x, properties.y, new FloorImage(FloorType.地板)); //从怪物列表中删除怪物和位置 MapUtility.MonsterList.Remove(image); foreach (KeyValuePair <int, int> pair in MapUtility.MonsterPosition) { if (pair.Key == properties.x && pair.Value == properties.y) { MapUtility.MonsterPosition.Remove(pair); break; } } } return(false); case Atype.NPC: IsTalking = true; NPC = (NPCImage)image; NPC.ShowDialog(); break; } return(false); }