/// <summary> /// 选择装备物品 /// </summary> /// <param name="goods"></param> private void EquipSelected(BaseGoods goods) { var canUseCharacters = _combatUI.PlayerCharacters.Where(m => goods.CanPlayerUse(m.Index)).ToArray(); if (canUseCharacters.Length == 0) { // 没人能装备 Context.ShowMessage("不能装备!", 1000); } else if (canUseCharacters.Length == 1) { // 一个人能装备 if (canUseCharacters[0].HasEquipt(goods.Type, goods.Index)) { Context.ShowMessage("已装备!", 1000); } else { Context.PushScreen(new ScreenChangeEquipment(Context, canUseCharacters[0], (GoodsEquipment)goods)); } } else { // 多人可装备 Context.PushScreen(new EquipSelectedScreen(Context, canUseCharacters, goods)); } }
/// <summary> /// 选择装备 /// </summary> /// <param name="goods"></param> private void EquipSelected(BaseGoods goods) { List <PlayerCharacter> characters = new List <PlayerCharacter>(); for (int i = 0; i < Context.PlayContext.PlayerCharacters.Count; i++) { PlayerCharacter character = Context.PlayContext.PlayerCharacters[i]; if (goods.CanPlayerUse(character.Index)) { characters.Add(character); } } if (characters.Count == 0) { // 没人能装备 Context.ShowMessage("不能装备!", 1000); } else if (characters.Count == 1) { // 一个人能装备 if (characters[0].HasEquipt(goods.Type, goods.Index)) { Context.ShowMessage("已装备!", 1000); } else { Context.PushScreen(new ScreenChangeEquipment(Context, characters[0], (GoodsEquipment)goods)); } } else { // 多人可装备 Context.PushScreen(new MutilCharacterEquipScreen(Context, characters, goods)); } }