/// <summary> /// 刷新状态栏 /// </summary> public static void RefreshStatus() { state.floorNumber.Text = floorFactory.GetFloorNum().ToString() + "F"; state.heroLevel.Text = hero.properties.level.ToString(); state.heroHP.Text = hero.properties.hp.ToString(); state.heroATK.Text = hero.properties.atk.ToString(); state.heroDEF.Text = hero.properties.def.ToString(); state.heroRES.Text = hero.properties.res.ToString(); state.heroEXP.Text = hero.properties.exp.ToString(); state.heroGold.Text = hero.properties.gold.ToString(); state.heroYellowKey.Text = "x" + hero.properties.yellowKey.ToString(); state.heroBlueKey.Text = "x" + hero.properties.blueKey.ToString(); state.heroRedKey.Text = "x" + hero.properties.redKey.ToString(); //ShowDamage(); }
/// <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); }