コード例 #1
0
        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());
        }
コード例 #2
0
    void SendChatMessage(string message)
    {
        // tempTest for hyperLink
        if (message.IndexOf("testskill") == 0)
        {
            string[] skillIDArray = message.Split(new string[1] {
                " "
            }, StringSplitOptions.None);
            if (skillIDArray.Length == 3)
            {
                int skillID     = Convert.ToInt32(skillIDArray[1]);
                int isDirectUse = Convert.ToInt32(skillIDArray[2]);
                Dictionary <int, SCLIENT_SKILL> mapSkill = CObjectManager.Instance.getPlayerMySelf().GetCharacterData().Get_Skill();
                foreach (KeyValuePair <int, SCLIENT_SKILL> skill in mapSkill)
                {
                    if (skill.Value.m_pDefine.m_nID == skillID)
                    {
                        int defineID = skill.Value.m_pDefine.m_nID * 100 + skill.Value.m_nLevel;
                        CActionItem_Skill curSkill = CActionSystem.Instance.GetAction_SkillID(defineID);
                        if (isDirectUse != 0)
                        {
                            curSkill.DoAction();
                        }
                        else
                        {
                            CObjectManager.Instance.getPlayerMySelf().SetActiveSkill(curSkill);
                        }
                        break;
                    }
                }
            }
            return;
        }
//      if(field.Content == "testPos")
//      {
//             SendCommonTalk("测试坐标超链接{#pos[50,50]坐标超链接}asd测试物品超链接123{#item[100000]物品超链接}");
//          txtField.Text = "";
//          return;
//      }

        if (message.IndexOf("!!") == -1)
        {
            SendCommonTalk(message);
        }
        else
        {
            SendGmCommand(message.Substring(2, message.Length - 2));
        }
    }
コード例 #3
0
    void UpdateJingJieSkillnfo()
    {
        CActionItem_Skill xinfa = SuperTooltips.Instance.GetActionItem() as CActionItem_Skill;

        if (xinfa != null)
        {
            //xinfaAction.SetTexture(IconManager.Instance.GetIcon(xinfa.GetIconName()));
            xinfaName.Text    = xinfa.GetName();
            xinfaDesc.Text    = UIString.Instance.ParserString_Runtime(xinfa.GetDesc1());
            xinfaLevel.Text   = xinfa.GetSkillLevel().ToString() + "级";
            xinfaRequire.Text = UIString.Instance.ParserString_Runtime(xinfa.GetUpLevelDesc());

            xinfaSkill.SetActiveRecursively(true);
        }
    }
コード例 #4
0
 private void UpdateInfo()
 {
     if (SuperTooltips.Instance.GetActionItem() == null)
     {
         if (showText == "")
         {
             return;
         }
         else
         {
             UpdateTextInfo();
         }
     }
     else if (SuperTooltips.Instance.GetActionItem().GetType() == ACTION_OPTYPE.AOT_ITEM)
     {
         if (SuperTooltips.Instance.GetActionItem().GetImpl() is CObject_Item_Equip)
         {
             UpdateEquipInfo();
         }
         else
         {
             UpdateItemInfo();
         }
     }
     else if (SuperTooltips.Instance.GetActionItem().GetType() == ACTION_OPTYPE.AOT_SKILL)
     {
         // 心法培养和技能区别显示 [5/9/2012 SUN]
         CActionItem_Skill skill = SuperTooltips.Instance.GetActionItem() as CActionItem_Skill;
         if (skill.IsJingJieSkill())
         {
             UpdateJingJieSkillnfo();
         }
         else
         {
             UpdateSkillInfo();
         }
     }
     else if (SuperTooltips.Instance.GetActionItem().GetType() == ACTION_OPTYPE.AOT_TALISMAN)
     {
         UpdateTalismanItemInfo();
     }
     else if (SuperTooltips.Instance.GetActionItem().GetType() == ACTION_OPTYPE.AOT_PET_SKILL)
     {
         UpdatePetSkillInfo();
     }
 }
コード例 #5
0
    void UpdateSkillInfo()
    {
        CActionItem_Skill skill = SuperTooltips.Instance.GetActionItem() as CActionItem_Skill;

        if (skill != null)
        {
            skillAction.SetTexture(IconManager.Instance.GetIcon(skill.GetIconName()));
            skillName.Text     = skill.GetName();
            skillLevel.Text    = skill.GetSkillLevel().ToString() + "级";
            skillReqLevel.Text = skill.GetNextRoleLevel().ToString();
            skillDesc.Text     = UIString.Instance.ParserString_Runtime(skill.GetDesc());

            if (gameObject.transform.position.y < -160)
            {
                gameObject.transform.position = new Vector3(gameObject.transform.position.x, -160, gameObject.transform.position.z);
            }
            skillGo.SetActiveRecursively(true);
        }
    }
コード例 #6
0
 public void MainMenuBar_ActionUpdate(GAME_EVENT_ID eventId, List <string> vParam)
 {
     if (eventId == GAME_EVENT_ID.GE_CHANGE_BAR)
     {
         string arg0 = vParam[0];
         if (arg0 == "main")
         {
             int nIndex = int.Parse(vParam[1]);
             if (nIndex <= 0 || nIndex > 10)
             {
                 return;
             }
             int actionId = int.Parse(vParam[2]);
             buttons[nIndex - 1].SetActionItemByActionId(actionId);
         }
     }
     else if (eventId == GAME_EVENT_ID.GE_UNIT_EXP)
     {
         ShowExperience();
     }
     else if (eventId == GAME_EVENT_ID.GE_UNIT_MAX_EXP)
     {
         ShowExperience();
     }
     else if (eventId == GAME_EVENT_ID.GE_NEW_SKILL)
     {
         int skillID = int.Parse(vParam[0]);
         CActionItem_Skill actionSkill = CActionSystem.Instance.GetAction_SkillID(skillID);
         if (actionSkill == null)
         {
             return;
         }
         for (int i = 0; i < 10; i++)
         {
             int actionID = CActionSystem.Instance.MainMenuBar_Get(i);
             if (actionID == MacroDefine.INVALID_ID)
             {
                 CActionSystem.Instance.MainMenuBar_Set(i, actionSkill.GetID());
                 return;
             }
         }
     }
 }
コード例 #7
0
 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);
                 }
             }
         }
     }
 }
コード例 #8
0
        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());
        }
コード例 #9
0
    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);
            }
        }
    }
コード例 #10
0
    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++;
                }
            }
        }
    }
コード例 #11
0
    public void LockNearestTargetToHit()
    {
        CObject_Character pNearestTarget = LockNearestEnemy();

        //下边为挂机增加自动攻击

        if (AutoReleaseSkill.Instance.isAutoSkill())
        {
            if (AutoReleaseSkill.Instance.CanUseNextSkill())
            {
                CObject_Character target = mMainTarget as CObject_Character;
                if (target != null && !target.CannotBeAttack())
                {
                    mNearestTargetOLD = target;
                }
                if (mNearestTargetOLD == null || mNearestTargetOLD.IsDie())
                {
                    mNearestTargetOLD = pNearestTarget;
                }
                bool needSend = false;
                if (mNeedWaitSkillSend)
                {
                    uint curTime = GameProcedure.s_pTimeSystem.GetTimeNow();
                    if (curTime - mWaitSkillSend >= 1000)
                    {
                        needSend       = true;
                        mWaitSkillSend = curTime;
                    }
                }
                else
                {
                    needSend = true;
                }

                if (needSend)
                {
                    tActionItem suitAbleItem = AutoReleaseSkill.Instance.getSuitAbleSkill(mNearestTargetOLD);
                    if (suitAbleItem == null)
                    {
                        suitAbleItem = CActionSystem.Instance.GetDefaultAction();
                    }
                    CActionItem_Skill curSkill = suitAbleItem as CActionItem_Skill;
                    mNeedWaitSkillSend = !curSkill.AutoKeepOn();
                    Vector3 fvMouseHitPlan = Vector3.zero;
                    if (mNearestTargetOLD != null)
                    {
                        fvMouseHitPlan = mNearestTargetOLD.GetPosition();
                    }
                    CursorMng.Instance.MouseCommand_Set(false, mNearestTargetOLD, fvMouseHitPlan, suitAbleItem);
                    GameProcedure.s_pGameInterface.AutoHitState = 1;
                    CursorMng.Instance.MouseCommand_Active(CursorMng.Instance.MouseCommand_GetLeft());
                    GameProcedure.s_pGameInterface.AutoHitState = 0;
                }
            }
            else
            {
                AutoReleaseSkill.Instance.waitNextSkill();
            }
        }
        else
        {
            CObject_Character target = mMainTarget as CObject_Character;
            if (target != pNearestTarget)
            {
                if (target != null && !target.CannotBeAttack())
                {
                    mNearestTargetOLD = target;
                }
            }

            if (mNearestTargetOLD != pNearestTarget &&
                (mNearestTargetOLD == null || mNearestTargetOLD.IsDie()))
            {
                mNearestTargetOLD = pNearestTarget;
                Vector3 fvMouseHitPlan = Vector3.zero;
                bool    needSend       = false;
                if (mNeedWaitSkillSend)
                {
                    uint curTime = GameProcedure.s_pTimeSystem.GetTimeNow();
                    if (curTime - mWaitSkillSend >= 1000)
                    {
                        needSend       = true;
                        mWaitSkillSend = curTime;
                    }
                }
                else
                {
                    needSend = true;
                }

                if (needSend)
                {
                    tActionItem suitAbleItem = null;
                    if (AutoReleaseSkill.Instance.isAutoSkill())
                    {
                        if (AutoReleaseSkill.Instance.CanUseNextSkill())
                        {
                            suitAbleItem = AutoReleaseSkill.Instance.getSuitAbleSkill(pNearestTarget);
                        }
                        else
                        {
                            AutoReleaseSkill.Instance.waitNextSkill();
                        }
                    }

                    if (suitAbleItem == null)
                    {
                        suitAbleItem = CActionSystem.Instance.GetDefaultAction();
                    }
                    CActionItem_Skill curSkill = suitAbleItem as CActionItem_Skill;
                    mNeedWaitSkillSend = !curSkill.AutoKeepOn();
                    if (mNearestTargetOLD != null)
                    {
                        fvMouseHitPlan = mNearestTargetOLD.GetPosition();
                    }
                    CursorMng.Instance.MouseCommand_Set(false, mNearestTargetOLD, fvMouseHitPlan, suitAbleItem);
                    GameProcedure.s_pGameInterface.AutoHitState = 1;
                    CursorMng.Instance.MouseCommand_Active(CursorMng.Instance.MouseCommand_GetLeft());
                    GameProcedure.s_pGameInterface.AutoHitState = 0;
                }

                //if (suitAbleItem == null)
                //{
                //    suitAbleItem = CActionSystem.Instance.GetDefaultAction();
                //}
                //CursorMng.Instance.MouseCommand_Set(false, pNearestTarget, fvMouseHitPlan, suitAbleItem);
                ////  CAI_MySelf aiSelf = (CAI_MySelf)(CObjectManager.Instance.getPlayerMySelf().CharacterLogic_GetAI());
                //// if (aiSelf.GetMySelfAI() == ENUM_MYSELF_AI.MYSELF_AI_GUAJI)
                ////无需判定,一定是挂机状态
                //{
                //    GameProcedure.s_pGameInterface.AutoHitState = 1;
                //}
                //CursorMng.Instance.MouseCommand_Active(CursorMng.Instance.MouseCommand_GetLeft());
                //GameProcedure.s_pGameInterface.AutoHitState = 0;
                //mNearestTargetOLD = pNearestTarget;
            }
        }
    }
コード例 #12
0
    public void Update()
    {
        if (!execute_)
        {
            return;
        }
        if (targetID_ == MacroDefine.INVALID_ID)
        {
            return;
        }
        if (CObjectManager.Instance.getPlayerMySelf().IsAutoFight())
        {
            return;
        }
        CObject_Character pChar = CObjectManager.Instance.FindServerObject(targetID_) as CObject_Character;

        if (pChar == null || pChar.IsDie())
        {
            enterFightStat_    = false;
            waitSendSkillTime_ = 0;
            return;
        }
        if (!enterFightStat_)
        {
            return;
        }
        if (pChar.CannotBeAttack())
        {
            return;
        }

        if (!canUseNextSkill_)
        {
            waitNextSkill();
            return;
        }

        bool needSend = false;

        if (needWaitSendSkill_)
        {
            uint curTime = GameProcedure.s_pTimeSystem.GetTimeNow();
            if (curTime - waitSendSkillTime_ >= MIN_ACTION_TIME)
            {
                needSend           = true;
                waitSendSkillTime_ = curTime;
            }
        }
        else
        {
            needSend = true;
        }

        if (needSend)
        {
            tActionItem curSkill = getSuitAbleSkill(pChar);
            if (curSkill == null)
            {
                curSkill = CActionSystem.Instance.GetDefaultAction();
            }
            CActionItem_Skill skill = curSkill as CActionItem_Skill;
            needWaitSendSkill_ = !skill.AutoKeepOn();
            Vector3 fvMouseHitPlan = pChar.GetPosition();
            CursorMng.Instance.MouseCommand_Set(false, pChar, fvMouseHitPlan, curSkill);
            CursorMng.Instance.MouseCommand_Active(CursorMng.Instance.MouseCommand_GetLeft());
        }
    }
コード例 #13
0
    //激活鼠标命令
    public void MouseCommand_Active(SCommand_Mouse cmd)
    {
        CObject_PlayerMySelf mySelf = CObjectManager.Instance.getPlayerMySelf();

        if (mySelf == null)
        {
            return;
        }

        switch (cmd.m_typeMouse)
        {
        case MOUSE_CMD_TYPE.MCT_PLAYER_MOVETO:
        {
            if (uPrevMoveTime == 0 || GameProcedure.s_pTimeSystem.GetTimeNow() > uPrevMoveTime + 100)
            {
                //CEventSystem::GetMe()->PushEvent(GE_AUTO_RUNING_CHANGE, 0);
                uPrevMoveTime = GameProcedure.s_pTimeSystem.GetTimeNow();

                float   x         = cmd.GetValue <float>(0);
                float   z         = cmd.GetValue <float>(1);
                Vector3 targeMove = new Vector3(x, 0, z);
                GameInterface.Instance.Player_MoveTo(targeMove);
            }
        }
        break;

        case MOUSE_CMD_TYPE.MCT_PLAYER_SELECT:
        {
            GameProcedure.s_pGameInterface.Object_SelectAsMainTarget(cmd.GetValue <int>(0)
                                                                     , CObjectManager.DESTROY_MAIN_TARGET_TYPE.DEL_RIGHT_CLICK);

            if (m_cmdCurrent_Left.m_typeMouse == MOUSE_CMD_TYPE.MCT_SKILL_DIR ||
                m_cmdCurrent_Left.m_typeMouse == MOUSE_CMD_TYPE.MCT_SKILL_AREA)
            {
                m_cmdCurrent_Left.m_typeMouse = MOUSE_CMD_TYPE.MCT_NULL;
                m_cmdCurrent_Left.SetValue(0, 0);
                m_cmdCurrent_Left.SetValue(1, 0);
                //恢复激活技能
                CActionSystem.Instance.SetDefaultAction(CObjectManager.Instance.getPlayerMySelf().GetActiveSkill());
            }
            //			AxTrace(0, 0, "Active: SelectPlayer(ID=%d)", (int)cmd.m_afParam[0]);
        }
        break;

        case MOUSE_CMD_TYPE.MCT_SKILL_OBJ:
        {
            //首先选择
            GameProcedure.s_pGameInterface.Object_SelectAsMainTarget(cmd.GetValue <int>(1)
                                                                     , CObjectManager.DESTROY_MAIN_TARGET_TYPE.DEL_RIGHT_CLICK);

            tActionItem pItem = cmd.GetValue <tActionItem>(0);
            if (pItem == null)
            {
                break;
            }

            //进入攻击
            if (pItem.GetType() == ACTION_OPTYPE.AOT_PET_SKILL)
            {
                // 先不实现宠物技能
                //                      int nPetSkillID = ((PET_SKILL*)(((CActionItem_PetSkill*)pItem)->GetImpl()))->m_pDefine->m_nID;
                //                      CDataPool::GetMe()->Pet_SendUseSkillMessage(nPetSkillID,
                //                          INVALID_ID, cmd.m_afParam[1], cmd.m_afParam[2]);
            }
            else
            {
                tActionItem skill = cmd.GetValue <tActionItem>(0);
                GameProcedure.s_pGameInterface.Player_UseSkill((CActionItem_Skill)skill, cmd.GetValue <int>(1));
            }
        }
        break;

        case MOUSE_CMD_TYPE.MCT_SKILL_AREA:
        {
            tActionItem pItem = cmd.GetValue <tActionItem>(0);
            if (pItem == null)
            {
                break;
            }

            if (pItem.GetType() == ACTION_OPTYPE.AOT_PET_SKILL)
            {
                //                      int nPetSkillID = ((PET_SKILL*)(((CActionItem_PetSkill*)pItem)->GetImpl()))->m_pDefine->m_nID;
                //                      CDataPool::GetMe()->Pet_SendUseSkillMessage(nPetSkillID,
                //                          INVALID_ID, cmd.m_afParam[1], cmd.m_afParam[2]);
            }
            else
            {
                tActionItem skill = cmd.GetValue <tActionItem>(0);
                Vector3     pos   = new Vector3(cmd.GetValue <float>(1), 0, cmd.GetValue <float>(2));
                GameProcedure.s_pGameInterface.Player_UseSkill((CActionItem_Skill)skill, pos);
            }

            //恢复激活Action
            CActionSystem.Instance.SetDefaultAction(CObjectManager.Instance.getPlayerMySelf().GetActiveSkill());
        }
        break;

        case MOUSE_CMD_TYPE.MCT_CANCEL_SKILL:
        {
            //恢复激活Action
            CActionSystem.Instance.SetDefaultAction(CObjectManager.Instance.getPlayerMySelf().GetActiveSkill());
        }
        break;

        case MOUSE_CMD_TYPE.MCT_SKILL_DIR:
        {
            // 支持方向攻击 [1/25/2011 ivan edit]
            tActionItem pItem = cmd.GetValue <tActionItem>(0);
            if (pItem == null)
            {
                break;
            }

            if (pItem.GetType() == ACTION_OPTYPE.AOT_PET_SKILL)
            {
                //TODO
            }
            else
            {
                tActionItem skill = cmd.GetValue <tActionItem>(0);
                float       dir   = cmd.GetValue <float>(1);
                GameProcedure.s_pGameInterface.Player_UseSkill((CActionItem_Skill)skill, dir);
            }

            //恢复激活Action
            CActionSystem.Instance.SetDefaultAction(CObjectManager.Instance.getPlayerMySelf().GetActiveSkill());
        }
        break;

        case MOUSE_CMD_TYPE.MCT_HIT_TRIPPEROBJ:
        {
            GameProcedure.s_pGameInterface.TripperObj_Active(cmd.GetValue <int>(0));
            //			AxTrace(0, 0, "Active: TripObj(ID=%d)", (int)cmd.m_adwParam[0]);
        }
        break;

        case MOUSE_CMD_TYPE.MCT_SPEAK:
        {
            // 当鼠标点击其他的时候自动寻路结束(临时方案,具体等策划案子) [9/1/2011 edit by ZL]
            CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_AUTO_RUNING_CHANGE);

            int npcId = cmd.GetValue <int>(0);
            //首先选择
            GameInterface.Instance.Object_SelectAsMainTarget(npcId);

            //谈话
            //CGameProcedure::s_pGameInterface->Player_Speak(cmd.m_adwParam[0]);
            GameInterface.Instance.Player_Speak(npcId);
        }
        break;

        case MOUSE_CMD_TYPE.MCT_CONTEXMENU:
        {
            //首先选择
            //CGameProcedure::s_pGameInterface->Object_SelectAsMainTarget((INT)cmd.m_adwParam[0], 1);

            //显示右键菜单
            //CGameProcedure::s_pGameInterface->Object_ShowContexMenu(cmd.m_adwParam[0]);
        }
        break;

        case MOUSE_CMD_TYPE.MCT_REPAIR:
        {
            //do nothing...
        }
        break;

        case MOUSE_CMD_TYPE.MCT_CANCLE_REPAIR:
        {
            //取消修理
            CActionSystem.Instance.SetDefaultAction(CObjectManager.Instance.getPlayerMySelf().GetActiveSkill());
        }
        break;


        case MOUSE_CMD_TYPE.MCT_UI_USE_IDENTIFY:
        {
            // 使用鉴定卷轴

            break;
        }

        case MOUSE_CMD_TYPE.MCT_UI_USE_CANCEL_IDENTIFY:
        {
            // 取消使用鉴定卷轴
            //CDataPool::GetMe()->Identify_UnLock();
            break;
        }

        case MOUSE_CMD_TYPE.MCT_UI_USE_EXCHANGE:
        {
            //                  if(TRUE == CObjectManager::GetMe()->GetMySelf()->GetCharacterData()->Get_IsInStall())
            //                  {
            //                      CEventSystem::GetMe()->PushEvent(GE_INFO_INTERCOURSE,"你正在摆摊……");
            //                      return ;
            //                  }
            //                  CGameProcedure::s_pGameInterface->Object_SelectAsMainTarget((INT)cmd.m_adwParam[0]);
            //                  CObject* pChar = (CObject*) CObjectManager::GetMe()->GetMainTarget();
            //                  if(pChar && g_theKernel.IsKindOf(pChar->GetClass(), GETCLASS(CObject_PlayerOther)))
            //                  {
            //                      //先判定距离是不是合法
            //                      if(pChar)
            //                      {
            //                          const fVector3 pMePos = CObjectManager::GetMe()->GetMySelf()->GetPosition();
            //                          const fVector3 pOtherPos = ((CObject*)pChar)->GetPosition();
            //
            //                          FLOAT fDistance =
            //                              TDU_GetDist(fVector2(pMePos.x, pMePos.z),
            //                              fVector2(pOtherPos.x, pOtherPos.z));
            //
            //                          if( EXCHANGE_MAX_DISTANCE < fDistance )
            //                          {
            //                              CEventSystem::GetMe()->PushEvent(GE_INFO_INTERCOURSE,"距离太远,启动交易失败");
            //                              return;
            //                          }
            //                      }
            //
            //                      //不能向已经死亡的玩家发送交易申请
            //                      if ( ((CObject_Character*)pChar)->CharacterLogic_Get() == CObject_Character::CHARACTER_LOGIC_DEAD )
            //                      {
            //                          CEventSystem::GetMe()->PushEvent(GE_INFO_INTERCOURSE,"不能向已经死亡的玩家申请交易");
            //                          return ;
            //                      }
            //
            //                      CGExchangeApplyI msg;
            //                      msg.SetObjID(pChar->GetServerID());
            //                      CNetManager::GetMe()->SendPacket(&msg);
            //                      CEventSystem::GetMe()->PushEvent(GE_INFO_INTERCOURSE,"交易请求已经发送");
            //                      CGameProcedure::s_pGameInterface->Skill_CancelAction();
            //                      return ;
            //                  }
        }
        break;

        case MOUSE_CMD_TYPE.MCT_UI_USE_CANCEL_EXCHANGE:
        {
            CActionSystem.Instance.SetDefaultAction(CObjectManager.Instance.getPlayerMySelf().GetActiveSkill());
            break;
        }

        case MOUSE_CMD_TYPE.MCT_SALE:
            break;

        case MOUSE_CMD_TYPE.MCT_CANCEL_SALE:
        {
            CActionSystem.Instance.SetDefaultAction(CObjectManager.Instance.getPlayerMySelf().GetActiveSkill());
            break;
        }

        case MOUSE_CMD_TYPE.MCT_BUYMULT:
            break;

        case MOUSE_CMD_TYPE.MCT_CANCEL_BUYMULT:
        {
            CActionSystem.Instance.SetDefaultAction(CObjectManager.Instance.getPlayerMySelf().GetActiveSkill());
            break;
        }

        case MOUSE_CMD_TYPE.MCT_UI_USE_ADDFRIEND:
        {
            //首先选择
            //                  CGRelation Msg;
            //                  Msg.GetRelation()->CleanUp();
            //                  Msg.GetRelation()->m_Type = REQ_ADDFRIEND;
            //                  REQUEST_ADD_RELATION_WITH_GROUP* pFriend = &(Msg.GetRelation()->m_AddRelationWithGroup);
            //                  pFriend->CleanUp();
            //                  CGameProcedure::s_pGameInterface->Object_SelectAsMainTarget((INT)cmd.m_adwParam[0]);
            //                  CObject_Character* pCharObj = (CObject_Character*)CObjectManager::GetMe()->GetMainTarget();
            //                  if( pCharObj == NULL )
            //                      break;
            //                  if( pCharObj == CObjectManager::GetMe()->GetMySelf() ) // 如果是自己,就不加
            //                      break;
            //                  if( g_theKernel.IsKindOf( pCharObj->GetClass(), GETCLASS(CObject_PlayerOther) ) ) // 如果是玩家
            //                  {
            //                      ENUM_RELATION sCamp = CGameInterface::GetMe()->GetCampType(
            //                          pCharObj,
            //                          (CObject*)CObjectManager::GetMe()->GetMySelf() );
            //
            //                      // 通过PK模式判断是否为敌人 [8/19/2011 edit by ZL]
            //                      if (sCamp != RELATION_ENEMY) {
            //                          INT tempRelation = CObjectManager::GetMe()->GetMySelf()->GetRelationOther(pCharObj);
            //                          if ( tempRelation != -1 )
            //                              sCamp = (ENUM_RELATION)tempRelation;
            //                      }
            //
            //                      if( sCamp != RELATION_FRIEND ) // 如果是同一阵营的
            //                      {
            //                          CGameProcedure::s_pEventSystem->PushEvent( GE_INFO_INTERCOURSE, "无效目标");
            //                          break;
            //                      }
            //                  }
            //                  else
            //                  {
            //                      CGameProcedure::s_pEventSystem->PushEvent( GE_INFO_INTERCOURSE, "无效目标");
            //                      break;
            //                  }
            //                  pFriend->SetTargetName( pCharObj->GetCharacterData()->Get_Name() );
            //                  //需要重写--Ivan
            //                  //pFriend->SetGroup( SCRIPT_SANDBOX::Friend::m_nCurTeam );
            //                  pFriend->SetRelationType( RELATION_TYPE_FRIEND );
            //                  CNetManager::GetMe()->SendPacket( &Msg );
        }
        break;

        case MOUSE_CMD_TYPE.MCT_UI_USE_CANCEL_ADDFRIEND:
            CActionSystem.Instance.SetDefaultAction(CObjectManager.Instance.getPlayerMySelf().GetActiveSkill());
            break;

        case MOUSE_CMD_TYPE.MCT_USE_ITEM:
        {
            //使用物品
            //                  CGameProcedure::s_pGameInterface->PacketItem_UserItem((
            //                      tActionItem*)cmd.m_apParam[0],
            //                      cmd.m_adwParam[1],
            //                      fVector2(cmd.m_afParam[2], cmd.m_afParam[3]));

            //恢复激活Action
            CActionSystem.Instance.SetDefaultAction(CObjectManager.Instance.getPlayerMySelf().GetActiveSkill());
        }
        break;

        case MOUSE_CMD_TYPE.MCT_CANCEL_USE_ITEM:
        {
            //恢复激活Action
            CActionSystem.Instance.SetDefaultAction(CObjectManager.Instance.getPlayerMySelf().GetActiveSkill());
        }
        break;

        case MOUSE_CMD_TYPE.MCT_LEAP:
        {
            //轻功...
            //SkillID_t id = CObjectManager::GetMe()->GetMySelf()->GetCharacterData()->GetDefaultFlySkillID();
            //CObjectManager::GetMe()->GetMySelf()->CharacterLogic_GetAI()->PushCommand_Fly(id, cmd.m_afParam[0], cmd.m_afParam[1]);
        }
        break;

        case MOUSE_CMD_TYPE.MCT_CATCH_PET:
        {
            //CGameProcedure::s_pGameInterface->Player_UseSkill( cmd.m_adwParam[0], int( cmd.m_adwParam[1] ) );
        }
        break;

        case MOUSE_CMD_TYPE.MCT_ENTER_BUS:
        {
            // 进入载具 [8/26/2011 ivan edit]
            //CGameProcedure::s_pGameInterface->Player_EnterSpecialBus(cmd.m_adwParam[0]);
        }
        break;

        case MOUSE_CMD_TYPE.MCT_EXIT_BUS:
        {
            // 离开载具 [8/26/2011 ivan edit]
            //CGameProcedure::s_pGameInterface->Player_ExitSpecialBus(cmd.m_adwParam[0]);
        }
        break;

        case MOUSE_CMD_TYPE.MCT_HyperLink:
        {
            HyperItemBase link = cmd.GetValue <HyperItemBase>(0);
            link.Click();
        }
        break;

        case MOUSE_CMD_TYPE.MCT_SKILL_NONE:
        {
            tActionItem       skill    = cmd.GetValue <tActionItem>(0);                  //无目标技能
            CActionItem_Skill curSkill = (CActionItem_Skill)skill;
            if (curSkill != null)
            {
                CObjectManager.Instance.getPlayerMySelf().Player_UseSkill(curSkill.GetDefineID());
            }
        }
        break;

        case MOUSE_CMD_TYPE.MCT_SKILL_SELF:
        {
            tActionItem       skill    = cmd.GetValue <tActionItem>(0); //无目标技能
            CActionItem_Skill curSkill = (CActionItem_Skill)skill;
            int ServerID = cmd.GetValue <int>(1);                       //针对自己的技能;
            if (curSkill != null)
            {
                CObjectManager.Instance.getPlayerMySelf().Player_UseSkill(curSkill.GetDefineID(), ServerID);
            }
        }
        break;

        default:
            //AxTrace(0, 0, "Active: ERROR!(%d)", cmd.m_typeMouse);
            break;
        }
    }
コード例 #14
0
    void UpdateSkill()
    {
        if (!gameObject.active)
        {
            return;
        }

        ResetUI();

        if (tabMode == TAB_MODE.TAB_SELFXINFA)
        {
            int           num         = CActionSystem.Instance.GetSkillActionNum();
            int           nXinfaIndex = -1;
            IUIListObject listItem    = null;
            for (int i = 0; i < num; i++)
            {
                CActionItem_Skill skill = CActionSystem.Instance.EnumAction(i, ActionNameType.Skill) as CActionItem_Skill;
                if (skill != null && (skill.GetXinfaID() >= SCLIENT_SKILLCLASS.XINFATYPE_JINGJIEBEGIN && skill.GetXinfaID() < SCLIENT_SKILLCLASS.XINFATYPE_SKILLBENGIN))
                {
                    nXinfaIndex++;
                    int nOffset = nXinfaIndex % 3;
                    if (nOffset == 0)
                    {
                        listItem = list.CreateItem(itemPrefab);
                        listItem.gameObject.name = "XinfaListItem" + nXinfaIndex;
                        for (int j = 0; j < 3; j++)
                        {
                            listItem.gameObject.transform.FindChild("Item" + j).gameObject.SetActiveRecursively(false);
                        }
                    }
                    GameObject item = listItem.gameObject.transform.FindChild("Item" + nOffset).gameObject;
                    item.SetActiveRecursively(true);
                    ActionButton skillAction = item.GetComponentInChildren <ActionButton>();
                    if (skillAction != null)
                    {
                        skillAction.SetActionItemByActionId(skill.GetID());
                        skillAction.DisableDrag();
                        skillAction.EnableDoAction = false;
                    }
                    UIButton bg = item.transform.FindChild("Bg").gameObject.GetComponent <UIButton>();
                    if (bg != null)
                    {
                        bg.SetInputDelegate(handlerInput);
                    }

                    SpriteText txt = item.transform.FindChild("NameLabel").gameObject.GetComponent <SpriteText>();
                    if (txt != null)
                    {
                        txt.Text = skill.GetName() + "\n" + "等级:" + skill.GetSkillLevel();
                    }

                    UIButton levelBtn = item.transform.FindChild("LevelUp").gameObject.GetComponent <UIButton>();
                    if (levelBtn != null)
                    {
                        levelBtn.SetInputDelegate(levelUpInputDelegate);
                        //LogManager.LogWarning("Set Delegate : " + levelBtn.gameObject.name);
                    }


                    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))
                    {
                        item.transform.FindChild("LevelUp").gameObject.GetComponent <UIButton>().controlIsEnabled = false;
                        //toolText[showIndex] = UIString.Instance.ParserString_Runtime(error);
                    }
                    else
                    {
                        item.transform.FindChild("LevelUp").gameObject.GetComponent <UIButton>().controlIsEnabled = true;
                        //toolText[showIndex] = null;
                    }
                }
            }
        }
        else if (tabMode == TAB_MODE.TAB_PETXINFA)
        {
            //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++;
            //    }
            //}
        }
        if (list.UnviewableArea > 0)
        {
            list.slider.Hide(false);
        }
        else
        {
            list.slider.Hide(true);
        }
    }