//根据技能跟新 public void Update_Skill(SCLIENT_SKILL pSkill) { m_idSkillImpl = pSkill.m_pDefine.m_nID * 100 + pSkill.m_nLevel; //名称 m_strName = pSkill.m_pDefine.m_lpszName; //图标 m_strIconName = pSkill.m_pDefine.m_lpszIconName; bool bOldEnable = IsEnabled(); bool bNewEnable = false; OPERATE_RESULT oResult = pSkill.IsCanUse_CheckDeplete(CObjectManager.Instance.getPlayerMySelf().ID); if (GameDefineResult.Instance.OR_SUCCEEDED(oResult)) { oResult = pSkill.IsCanUse_Leaned(); if (GameDefineResult.Instance.OR_SUCCEEDED(oResult)) { bNewEnable = true; } } if (bNewEnable != bOldEnable) { if (bNewEnable) { Enable(); } else { Disable(); } //通知UI UpdateToRefrence(); } }
public string GetOResultText(OPERATE_RESULT code) { if (resultInfo.ContainsKey((int)code)) { return(resultInfo[(int)code]); } return("找不到对应消息"); }
public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer) { GCOperateResult packResult = (GCOperateResult)pPacket; OPERATE_RESULT oCode = (OPERATE_RESULT)(packResult.Result); string resultText = GameDefineResult.Instance.GetOResultText(oCode); CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_INFO_SELF, resultText); //LogManager.LogWarning("OperateResult " + packResult.Result + " " + resultText); switch (oCode) { case OPERATE_RESULT.OR_NEED_SETMINORPASSWORD: CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_MINORPASSWORD_OPEN_SET_PASSWORD_DLG); break; case OPERATE_RESULT.OR_NEED_UNLOCKMINORPASSWORD: CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_MINORPASSWORD_OPEN_UNLOCK_PASSWORD_DLG); break; default: break; } return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); }
bool isAttackableSkill(CActionItem item) { if (item == null) { return(false); } bool result = false; SCLIENT_SKILL pSkill = item.GetImpl() as SCLIENT_SKILL; switch (item.GetType()) { case ACTION_OPTYPE.AOT_SKILL: { if (pSkill == null) { break; } ENUM_SELECT_TYPE typeSel = (ENUM_SELECT_TYPE)pSkill.m_pDefine.m_nSelectType; switch (typeSel) { case ENUM_SELECT_TYPE.SELECT_TYPE_CHARACTER: case ENUM_SELECT_TYPE.SELECT_TYPE_DIR: case ENUM_SELECT_TYPE.SELECT_TYPE_POS: case ENUM_SELECT_TYPE.SELECT_TYPE_NONE: result = true; break; default: break; } } break; default: break; } if (result) { OPERATE_RESULT retVal = pSkill.IsCanUse_CheckCoolDown(); if (retVal != OPERATE_RESULT.OR_OK) { return(false); } retVal = pSkill.IsCanUse_CheckPassive(); if (retVal != OPERATE_RESULT.OR_OK) { return(false); } retVal = pSkill.IsCanUse_CheckLevel(CObjectManager.Instance.getPlayerMySelf().ID, pSkill.m_nLevel); if (retVal != OPERATE_RESULT.OR_OK) { return(false); } retVal = pSkill.IsCanUse_CheckFightState(CObjectManager.Instance.getPlayerMySelf().ID); if (retVal != OPERATE_RESULT.OR_OK) { return(false); } retVal = pSkill.IsCanUse_CheckDeplete(CObjectManager.Instance.getPlayerMySelf().ID); if (retVal != OPERATE_RESULT.OR_OK) { return(false); } retVal = pSkill.IsCanUse_Leaned(); if (retVal != OPERATE_RESULT.OR_OK) { return(false); } } return(result); }
bool CanUseSkill(CActionItem skillItem, CObject_Character target) { if (skillItem == null) { return(false); } if (target == null) { return(false); } if (target.IsDie()) { return(false); } switch (skillItem.GetType()) { case ACTION_OPTYPE.AOT_SKILL: { SCLIENT_SKILL pSkill = skillItem.GetImpl() as SCLIENT_SKILL; if (pSkill == null) { break; } Vector3 avatarPos = CObjectManager.Instance.getPlayerMySelf().GetPosition(); Vector3 avatarPosOnPlane = new Vector3(avatarPos.x, 0, avatarPos.z); Vector3 targetPos = new Vector3(-1, 0, -1); int ServerID = -1; targetPos = new Vector3(target.GetPosition().x, 0, target.GetPosition().z); ServerID = target.ServerID; Vector3 PosOnPlane = new Vector3(targetPos.x, 0, targetPos.z); float dir = Vector3.Angle(avatarPosOnPlane, PosOnPlane); OPERATE_RESULT result = pSkill.IsCanUse(CObjectManager.Instance.getPlayerMySelf().ID, pSkill.m_nLevel, ServerID, targetPos.x, targetPos.z, dir); if (result == OPERATE_RESULT.OR_OK) { return(true); } } break; case ACTION_OPTYPE.AOT_PET_SKILL: { PET_SKILL pPetSkill = skillItem.GetImpl() as PET_SKILL; if (pPetSkill == null) { break; } if (Interface.Pet.Instance.IsFighting(pPetSkill.m_nPetNum)) { return(true); } } break; } return(false); }
public bool OR_FAILED(OPERATE_RESULT result) { return((int)result < 0); }
public bool OR_SUCCEEDED(OPERATE_RESULT result) { return((int)result >= 0); }