/// <summary> /// 响应服务器对使用技能的数据返回 /// </summary> public void ResponseUseSkill(UseSkillData detailData, bool isSuccess = true) { if (isSuccess) { int skillID = detailData.skillID; string skillAppendData = detailData.skillAppendData; string fromCardUUID = detailData.fromCardUUID; string toCardUUID = detailData.toCardUUID; GameSide operateSide; if (detailData.operatePlayerPosition == this.playerRoomData.allocPosition) { operateSide = GameSide.Our; } else { operateSide = GameSide.Enemy; } //获取场上卡片对象 CharacterCard fromCard = gameCardCollection.GetCharacterCard(fromCardUUID, operateSide); CharacterCard toCard = gameCardCollection.GetCharacterCard(toCardUUID); Skill skill = fromCard.GetSkillByID(skillID); if (skill != null) { skill.OnUse(toCard, skillAppendData);//调用施法卡片下的技能使用具体方法 } else { LogsSystem.Instance.Print("错误!试图调用卡片不存在的技能", LogLevel.WARN); } } else { LogsSystem.Instance.Print("能量不足,无法释放技能", LogLevel.GAMEDETAIL); } }
public void RequestUseSkill(Skill skill, CharacterCard from, CharacterCard to) { //构建封包 UseSkillData detailData = new UseSkillData(); detailData.operatePlayerPosition = playerRoomData.allocPosition; detailData.operatePlayerUid = this.playerInfo.uid; detailData.operatePlayerUUID = this.playerInfo.UUID; detailData.fromCardUUID = from.GetCardUUID(); detailData.toCardUUID = to.GetCardUUID(); detailData.skillID = skill.GetSkillID(); detailData.skillCommonName = skill.GetSkillCommonName(); detailData.skillAppendData = skill.GetSkillAppendData();//----------暂时没有任何内容 GameData data = new GameData(); data.operateCode = OperateCode.UseSkill; data.roomID = playerRoomData.roomID; data.operateData = JsonCoding<UseSkillData>.encode(detailData); GameClient.Instance.SendToServer(data); }