internal void Player_UseSkill(CActionItem_Skill skillAction, Vector3 pos) { //CActionItem pAction = (CActionItem)CActionSystem.Instance.GetAction_SkillID(skillDefineId); if (skillAction == null) { return; } CAI_Base pMySelfAI = CObjectManager.Instance.getPlayerMySelf().CharacterLogic_GetAI(); SCLIENT_SKILL pSkill = (SCLIENT_SKILL)skillAction.GetImpl(); if (pSkill == null) { return; } //发送消息 SCommand_AI cmdTemp = new SCommand_AI(); cmdTemp.m_wID = (int)AICommandDef.AIC_USE_SKILL; cmdTemp.SetValue <int>(0, pSkill.m_pDefine.m_nID); cmdTemp.SetValue <byte>(1, pSkill.m_nLevel); cmdTemp.SetValue <int>(2, MacroDefine.INVALID_ID); cmdTemp.SetValue <float>(3, pos.x); cmdTemp.SetValue <float>(4, pos.z); cmdTemp.SetValue <float>(5, -1); cmdTemp.SetValue <uint>(6, MacroDefine.INVALID_GUID); pMySelfAI.PushCommand(cmdTemp); //发送事件 CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_ON_SKILL_ACTIVE, skillAction.GetDefineID()); }
void levelUpInputDelegate(ref POINTER_INFO ptr) { if (ptr.evt == POINTER_INFO.INPUT_EVENT.TAP) { Transform parent = ptr.targetObj.gameObject.transform.parent; ActionButton actionBtn = parent.FindChild("Icon").gameObject.GetComponent <ActionButton>(); if (actionBtn != null) { CActionItem_Skill skillAction = actionBtn.CurrActionItem as CActionItem_Skill; if (skillAction != null) { SCLIENT_SKILL skill = skillAction.GetImpl() as SCLIENT_SKILL; if (skill != null) { CDataPool.Instance._StudySkill.SendStudySkillEvent(skill.m_pDefine.m_nSkillClass, skill.m_pDefine.m_nMenPai, 1); } } } } }
internal void Player_UseSkill(CActionItem_Skill skillAction, float dir) { //判断是否为合法的范围技能 //CActionItem pAction = (CActionItem)CActionSystem.Instance.GetAction_SkillID(idSkill); if (skillAction == null) { return; } //取得技能数据 SCLIENT_SKILL pSkill = (SCLIENT_SKILL)skillAction.GetImpl(); if (pSkill == null) { return; } //检测目标是否合法 // if(!(pSkill->IsValidTarget(idObj))) return; CAI_Base pMySelfAI = CObjectManager.Instance.getPlayerMySelf().CharacterLogic_GetAI(); //发送消息 SCommand_AI cmdTemp = new SCommand_AI(); cmdTemp.m_wID = (int)AICommandDef.AIC_USE_SKILL; cmdTemp.SetValue <int>(0, pSkill.m_pDefine.m_nID); cmdTemp.SetValue <byte>(1, pSkill.m_nLevel); cmdTemp.SetValue <int>(2, MacroDefine.INVALID_ID); cmdTemp.SetValue <float>(3, -1.0f); cmdTemp.SetValue <float>(4, -1.0f); cmdTemp.SetValue <float>(5, dir); cmdTemp.SetValue <uint>(6, MacroDefine.INVALID_GUID); pMySelfAI.PushCommand(cmdTemp); //发送事件 CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_ON_SKILL_ACTIVE, skillAction.GetDefineID()); }
void handlerUplevel(int nIndex) { if (nIndex < 0 || nIndex >= buttons.Count) { return; } CActionItem_Skill skillAction = buttons[nIndex].CurrActionItem as CActionItem_Skill; if (skillAction != null) { SCLIENT_SKILL skill = skillAction.GetImpl() as SCLIENT_SKILL; if (skill != null) { CDataPool.Instance._StudySkill.SendStudySkillEvent(skill.m_pDefine.m_nSkillClass, skill.m_pDefine.m_nMenPai, 1); } else { LogManager.LogWarning("handle uplevel failed index=" + nIndex); } } }
void UpdateSkill() { if (!gameObject.active) { return; } ResetUI(); if (tabMode == TAB_MODE.TAB_SKILL) { int num = CActionSystem.Instance.GetSkillActionNum(); int showIndex = 0; for (int i = 0; i < num; i++) { if (showIndex >= buttons.Count) { break; } CActionItem_Skill skill = CActionSystem.Instance.EnumAction(i, ActionNameType.Skill) as CActionItem_Skill; if (skill != null && skill.GetXinfaID() >= SCLIENT_SKILLCLASS.XINFATYPE_SKILLBENGIN) { //LogManager.LogWarning("Xinfa = " + skill.GetXinfaID() + " skill = " + skill.GetDefineID()); //这里可能有问题 items[showIndex].SetActiveRecursively(true); SCLIENT_SKILL skillData = skill.GetImpl() as SCLIENT_SKILL; buttons[showIndex].UpdateItemFromAction(skill); if (skillData != null && skillData.IsCanUse_CheckLevel(CObjectManager.Instance.getPlayerMySelf().ID, (int)skillData.m_nLevel) == OPERATE_RESULT.OR_OK) { buttons[showIndex].EnableDrag(); txtLevels[showIndex].Text = "等级:" + skill.GetSkillLevel(); } else { buttons[showIndex].DisableDrag(); txtLevels[showIndex].Text = "未学习"; } buttons[showIndex].EnableDoAction = true; //update text txtNames[showIndex].Text = skill.GetName(); SCLIENT_SKILLCLASS skillClass = CObjectManager.Instance.getPlayerMySelf().GetCharacterData().Get_SkillClass(skill.GetXinfaID()); //升级可操作 string error; if (!CDataPool.Instance.isCanSkillLevelUp(skillClass.m_pDefine.nID, skillClass.m_nLevel + 1, out error)) { levelUpBtns[showIndex].Hide(true); //levelUpBtns[showIndex].controlIsEnabled = false; toolText[showIndex] = UIString.Instance.ParserString_Runtime(error); } else { // levelUpBtns[showIndex].controlIsEnabled = true; levelUpBtns[showIndex].Hide(false); toolText[showIndex] = null; } showIndex++; } } } else if (tabMode == TAB_MODE.TAB_JINGJIE) { int num = CActionSystem.Instance.GetSkillActionNum(); int showIndex = 0; for (int i = 0; i < num; i++) { if (showIndex >= buttons.Count) { break; } CActionItem_Skill skill = CActionSystem.Instance.EnumAction(i, ActionNameType.Skill) as CActionItem_Skill; //LogManager.LogWarning("Xinfa = " + skill.GetXinfaID() + " skill = " + skill.GetDefineID()); if (skill != null && (skill.GetXinfaID() >= SCLIENT_SKILLCLASS.XINFATYPE_JINGJIEBEGIN && skill.GetXinfaID() < SCLIENT_SKILLCLASS.XINFATYPE_SKILLBENGIN)) { //这里可能有问题 items[showIndex].SetActiveRecursively(true); buttons[showIndex].UpdateItemFromAction(skill); buttons[showIndex].DisableDrag(); buttons[showIndex].EnableDoAction = false; //update text txtNames[showIndex].Text = skill.GetName(); txtLevels[showIndex].Text = "等级:" + skill.GetSkillLevel(); SCLIENT_SKILLCLASS skillClass = CObjectManager.Instance.getPlayerMySelf().GetCharacterData().Get_SkillClass(skill.GetXinfaID()); //升级可操作 string error; if (!CDataPool.Instance.isCanSkillLevelUp(skillClass.m_pDefine.nID, skillClass.m_nLevel + 1, out error)) { levelUpBtns[showIndex].controlIsEnabled = false; toolText[showIndex] = UIString.Instance.ParserString_Runtime(error); } else { levelUpBtns[showIndex].controlIsEnabled = true; toolText[showIndex] = null; } showIndex++; } } } else if (tabMode == TAB_MODE.TAB_USUALSKILL) { int num = CActionSystem.Instance.GetSkillActionNum(); //LogManager.LogWarning("Skill count = " + num); int showIndex = 0; for (int i = 0; i < num; i++) { CActionItem_Skill skill = CActionSystem.Instance.EnumAction(i, ActionNameType.Skill) as CActionItem_Skill; if (showIndex >= buttons.Count) { break; } //超过51不属于普通技能 if (skill != null && (skill.GetXinfaID() == -1 && skill.GetIDTable() < 51)) { // LogManager.LogWarning("Xinfa = " + skill.GetXinfaID() + "skill = " + skill.GetDefineID() + "index=" + i); //这里可能有问题 items[showIndex].SetActiveRecursively(true); buttons[showIndex].UpdateItemFromAction(skill); buttons[showIndex].EnableDrag(); buttons[showIndex].EnableDoAction = true; //update text txtNames[showIndex].Text = skill.GetName(); txtLevels[showIndex].Text = "等级:" + skill.GetSkillLevel(); levelUpBtns[showIndex].gameObject.SetActiveRecursively(false); showIndex++; } } } }