Пример #1
0
    // 左键指令的分析
    public override void FillMouseCommand_Left(ref SCommand_Mouse pOutCmd, tActionItem pActiveSkill)
    {
        pOutCmd.m_typeMouse = MOUSE_CMD_TYPE.MCT_NULL;
        if (pActiveSkill != null &&
            pActiveSkill.GetType() == ACTION_OPTYPE.AOT_SKILL)
        {
            SCLIENT_SKILL pSkillImpl = (SCLIENT_SKILL)pActiveSkill.GetImpl();
            if (pSkillImpl != null &&
                pSkillImpl.m_pDefine.m_nSelectType == (int)ENUM_SELECT_TYPE.SELECT_TYPE_CHARACTER)
            {
                ENUM_RELATION eCampType = GameProcedure.s_pGameInterface.GetCampType((CObject)CObjectManager.Instance.getPlayerMySelf(), (CObject)this);
                switch (eCampType)
                {
                case ENUM_RELATION.RELATION_FRIEND:
                    break;

                case ENUM_RELATION.RELATION_ENEMY:
                default:
                {
                    pOutCmd.m_typeMouse = MOUSE_CMD_TYPE.MCT_SKILL_OBJ;
                    pOutCmd.SetValue <object>(0, (object)pActiveSkill);
                    pOutCmd.SetValue <int>(1, ServerID);
                }
                break;
                }
            }
        }
    }
Пример #2
0
        //设置当前激活技能
        public virtual void Skill_SetActive(tActionItem pActiveSkill)
        {
            //设置激活技能
            GameProcedure.s_ProcMain.ActiveSkill = pActiveSkill;

            //通知UI设置按钮的Check状态
            CActionSystem.Instance.SetDefaultAction(pActiveSkill);
        }
Пример #3
0
 // 左键指令的分析
 public override void FillMouseCommand_Left(ref SCommand_Mouse pOutCmd, tActionItem pActiveSkill)
 {
     if (Tripper_CanOperation())
     {
         pOutCmd.m_typeMouse = MOUSE_CMD_TYPE.MCT_HIT_TRIPPEROBJ;
         pOutCmd.SetValue <int>(0, ServerID);
     }
     else
     {
         pOutCmd.m_typeMouse = MOUSE_CMD_TYPE.MCT_NULL;
     }
 }
Пример #4
0
 public override void FillMouseCommand_Left(ref SCommand_Mouse pOutCmd, tActionItem pActiveSkill)
 {
     if (pActiveSkill != null && pActiveSkill.GetType() == ACTION_OPTYPE.AOT_ITEM)
     {
         //鼠标上挂的是一个物品
         base.FillMouseCommand_Left(ref pOutCmd, pActiveSkill);
     }
     else
     {
         pOutCmd.m_typeMouse = MOUSE_CMD_TYPE.MCT_NULL;
     }
     //pOutCmd.m_typeMouse = MOUSE_CMD_TYPE.MCT_PLAYER_SELECT;
     // pOutCmd.SetValue(0, ServerID);
 }
Пример #5
0
 //设置缺省操作
 public abstract void SetDefaultAction(tActionItem pDefAction);
Пример #6
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;
            }
        }
    }
Пример #7
0
 public virtual void FillMouseCommand_Right(ref SCommand_Mouse pOutCmd, tActionItem pActiveSkill)
 {
     pOutCmd.m_typeMouse = MOUSE_CMD_TYPE.MCT_NULL;
 }
    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());
        }
    }
Пример #9
0
 // 右键指令的分析
 public override void FillMouseCommand_Right(ref SCommand_Mouse pOutCmd, tActionItem pActiveSkill)
 {
     pOutCmd.m_typeMouse = MOUSE_CMD_TYPE.MCT_PLAYER_SELECT;
     pOutCmd.SetValue <int>(0, ServerID);
 }
Пример #10
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;
        }
    }
Пример #11
0
    //--------------------------------------------------
    //在鼠标上存储命令
    public void MouseCommand_Set(bool bHoverInUI, CObject pSelectObj, Vector3 fvPos, tActionItem pActiveSkill)
    {
        m_cmdCurrent_Left.m_typeMouse  = MOUSE_CMD_TYPE.MCT_NULL;
        m_cmdCurrent_Right.m_typeMouse = MOUSE_CMD_TYPE.MCT_NULL;
        //bool bCtrlDown = CInputSystem.GetMe().IsKeyDown(KeyCode.KC_LCONTROL) || CInputSystem.GetMe().IsKeyDown(KeyCode.KC_RCONTROL);

        //在UI上空
        if (bHoverInUI)
        {
            if (UISystem.Instance.CurrHyperlink != null)
            {
                m_cmdCurrent_Left.m_typeMouse = MOUSE_CMD_TYPE.MCT_HyperLink;
                m_cmdCurrent_Left.SetValue(0, UISystem.Instance.CurrHyperlink);
            }
            else if (pActiveSkill != null)
            {
                switch (pActiveSkill.GetType())
                {
                //修理装备
                case ACTION_OPTYPE.AOT_MOUSECMD_REPARE:
                {
                    //左键挂锤子
                    m_cmdCurrent_Left.m_typeMouse = MOUSE_CMD_TYPE.MCT_REPAIR;
                    //右键取消
                    m_cmdCurrent_Right.m_typeMouse = MOUSE_CMD_TYPE.MCT_CANCLE_REPAIR;
                }
                break;

                //鉴定装备
                case ACTION_OPTYPE.AOT_MOUSECMD_IDENTIFY:
                {
                    //左键鉴定
                    m_cmdCurrent_Left.m_typeMouse = MOUSE_CMD_TYPE.MCT_UI_USE_IDENTIFY;
                    //右键取消
                    m_cmdCurrent_Right.m_typeMouse = MOUSE_CMD_TYPE.MCT_UI_USE_CANCEL_IDENTIFY;
                }
                break;

                case ACTION_OPTYPE.AOT_MOUSECMD_ADDFRIEND:
                {
                    //左键鉴定
                    m_cmdCurrent_Left.m_typeMouse = MOUSE_CMD_TYPE.MCT_UI_USE_ADDFRIEND;
                    //右键取消
                    m_cmdCurrent_Right.m_typeMouse = MOUSE_CMD_TYPE.MCT_UI_USE_CANCEL_ADDFRIEND;
                }
                break;

                case ACTION_OPTYPE.AOT_MOUSECMD_EXCHANGE:
                {
                    //左键鉴定
                    m_cmdCurrent_Left.m_typeMouse = MOUSE_CMD_TYPE.MCT_UI_USE_EXCHANGE;
                    //右键取消
                    m_cmdCurrent_Right.m_typeMouse = MOUSE_CMD_TYPE.MCT_UI_USE_CANCEL_EXCHANGE;
                }
                break;

                case ACTION_OPTYPE.AOT_MOUSECMD_SALE:
                {
                    //左键鉴定
                    m_cmdCurrent_Left.m_typeMouse = MOUSE_CMD_TYPE.MCT_SALE;
                    //右键取消
                    m_cmdCurrent_Right.m_typeMouse = MOUSE_CMD_TYPE.MCT_CANCEL_SALE;
                }
                break;

                case ACTION_OPTYPE.AOT_MOUSECMD_BUYMULT:
                {
                    //左键鉴定
                    m_cmdCurrent_Left.m_typeMouse = MOUSE_CMD_TYPE.MCT_BUYMULT;
                    //右键取消
                    m_cmdCurrent_Right.m_typeMouse = MOUSE_CMD_TYPE.MCT_CANCEL_BUYMULT;
                }
                break;

                default:
                    break;
                }
            }
            else
            {
                return;
            }
        }
        else
        {
            //计算相应obj鼠标指令
            if (pSelectObj != null)
            {
                pSelectObj.FillMouseCommand_Left(ref m_cmdCurrent_Left, pActiveSkill);
                pSelectObj.FillMouseCommand_Right(ref m_cmdCurrent_Right, pActiveSkill);
            }

            if (m_cmdCurrent_Left.m_typeMouse == MOUSE_CMD_TYPE.MCT_NULL)
            {
                if (pActiveSkill != null)
                {
                    switch (pActiveSkill.GetType())
                    {
                    case ACTION_OPTYPE.AOT_SKILL:
                    case ACTION_OPTYPE.AOT_PET_SKILL:
                    {
                        SCLIENT_SKILL skillImpl = (SCLIENT_SKILL)pActiveSkill.GetImpl();

                        if (skillImpl == null)
                        {
                            {
                                m_cmdCurrent_Left.m_typeMouse = MOUSE_CMD_TYPE.MCT_PLAYER_MOVETO;
                                m_cmdCurrent_Left.SetValue(0, fvPos.x);
                                m_cmdCurrent_Left.SetValue(1, fvPos.z);
                            }
                            return;
                        }

                        //选择类型
                        //                              ENUM_SELECT_TYPE typeSel = (ENUM_SELECT_TYPE)( pActiveSkill.type()== ACTION_OPTYPE.AOT_SKILL ?
                        //                                  ((SCLIENT_SKILL)pSkillImpl)->m_pDefine->m_nSelectType :
                        //                                  ((PET_SKILL)pSkillImpl)->m_pDefine->m_nSelectType);

                        ENUM_SELECT_TYPE typeSel = (ENUM_SELECT_TYPE)skillImpl.m_pDefine.m_nSelectType;
                        switch (typeSel)
                        {
                        //点选角色
                        case ENUM_SELECT_TYPE.SELECT_TYPE_CHARACTER:
                        {
                            //进入这里说明逻辑出错了,不然会在character里面填充
                            //如果FillMouseCommand_Left填充失败,说明目标是不可攻击对象,执行移动操作
                            if (pSelectObj == null)
                            {
                                m_cmdCurrent_Left.m_typeMouse = MOUSE_CMD_TYPE.MCT_PLAYER_MOVETO;
                                m_cmdCurrent_Left.SetValue(0, fvPos.x);
                                m_cmdCurrent_Left.SetValue(1, fvPos.z);
                            }
                        }
                        break;

                        //点选范围
                        case ENUM_SELECT_TYPE.SELECT_TYPE_POS:
                        {
                            //储存技能
                            m_cmdCurrent_Left.m_typeMouse = MOUSE_CMD_TYPE.MCT_SKILL_AREA;
                            m_cmdCurrent_Left.SetValue(0, pActiveSkill);
                            m_cmdCurrent_Left.SetValue(1, fvPos.x);
                            m_cmdCurrent_Left.SetValue(2, fvPos.z);
                            //                                      FLOAT fRingRange = (FLOAT)( pActiveSkill.type()==AOT_SKILL ?
                            //                                          ((SCLIENT_SKILL*)pSkillImpl)->m_pDefine->m_fDamageRange :
                            //                                      ((PET_SKILL*)pSkillImpl)->m_pDefine->m_fDamageRange);
                            m_cmdCurrent_Left.SetValue(5, skillImpl.m_pDefine.m_fDamageRange);

                            //取消技能
                            m_cmdCurrent_Right.m_typeMouse = MOUSE_CMD_TYPE.MCT_CANCEL_SKILL;
                        }
                        break;

                        //方向
                        case ENUM_SELECT_TYPE.SELECT_TYPE_DIR:
                        {
                            //储存技能
                            m_cmdCurrent_Left.m_typeMouse = MOUSE_CMD_TYPE.MCT_SKILL_DIR;
                            m_cmdCurrent_Left.SetValue(0, pActiveSkill);

                            //计算方向

                            //鼠标位置
                            Vector3 avatarPos = CObjectManager.Instance.getPlayerMySelf().GetPosition();

                            Vector3 avatarPosOnPlane = new Vector3(avatarPos.x, 0, avatarPos.z);
                            Vector3 PosOnPlane       = new Vector3(fvPos.x, 0, fvPos.z);
                            float   angle            = Vector3.Angle(avatarPosOnPlane, PosOnPlane);
                            m_cmdCurrent_Left.SetValue(1, angle);
                            //取消技能
                            m_cmdCurrent_Right.m_typeMouse = MOUSE_CMD_TYPE.MCT_CANCEL_SKILL;
                        }
                        break;

                        //add by ss 增加对无目标技能和只对自己的处理流程
                        case ENUM_SELECT_TYPE.SELECT_TYPE_SELF:
                        {
                            m_cmdCurrent_Left.m_typeMouse = MOUSE_CMD_TYPE.MCT_SKILL_SELF;
                            m_cmdCurrent_Left.SetValue(0, pActiveSkill);
                            m_cmdCurrent_Left.SetValue(1, CObjectManager.Instance.getPlayerMySelf().ServerID);
                        }
                        break;

                        case ENUM_SELECT_TYPE.SELECT_TYPE_NONE:
                        {
                            m_cmdCurrent_Left.m_typeMouse = MOUSE_CMD_TYPE.MCT_SKILL_NONE;
                            m_cmdCurrent_Left.SetValue(0, pActiveSkill);
                        }
                        break;
                        }
                    }
                    break;

                    case ACTION_OPTYPE.AOT_ITEM:
                    {
                        if (pActiveSkill == null || pActiveSkill.GetType() != ACTION_OPTYPE.AOT_ITEM)
                        {
                            break;
                        }

                        CObject_Item pItem = (CObject_Item)(((CActionItem_Item)pActiveSkill).GetImpl());
                        if (pItem == null)
                        {
                            break;
                        }

                        //必须是能够使用的物品,必须支持任务物品 [1/24/2011 ivan edit]
                        if (pItem.GetItemClass() != ITEM_CLASS.ICLASS_COMITEM && pItem.GetItemClass() != ITEM_CLASS.ICLASS_TASKITEM)
                        {
                            break;
                        }

                        bool bAreaItem = ((CObject_Item_Medicine)pItem).IsAreaTargetType();

                        m_cmdCurrent_Left.m_typeMouse = MOUSE_CMD_TYPE.MCT_USE_ITEM;
                        m_cmdCurrent_Left.SetValue(0, pActiveSkill);
                        m_cmdCurrent_Left.SetValue(1, 0);
                        m_cmdCurrent_Left.SetValue(2, fvPos.x);
                        m_cmdCurrent_Left.SetValue(3, fvPos.z);
                        m_cmdCurrent_Left.SetValue(4, (int)(bAreaItem ? 1 : 0));

                        m_cmdCurrent_Right.m_typeMouse = MOUSE_CMD_TYPE.MCT_CANCEL_USE_ITEM;
                    }
                    break;

                    //修理单独处理
                    case ACTION_OPTYPE.AOT_MOUSECMD_REPARE:
                    {
                        //左键挂锤子
                        m_cmdCurrent_Left.m_typeMouse = MOUSE_CMD_TYPE.MCT_REPAIR;
                        //右键取消
                        m_cmdCurrent_Right.m_typeMouse = MOUSE_CMD_TYPE.MCT_CANCLE_REPAIR;
                    }
                    break;

                    //鉴定装备
                    case ACTION_OPTYPE.AOT_MOUSECMD_IDENTIFY:
                    {
                        //左键鉴定
                        m_cmdCurrent_Left.m_typeMouse = MOUSE_CMD_TYPE.MCT_UI_USE_IDENTIFY;
                        //右键取消
                        m_cmdCurrent_Right.m_typeMouse = MOUSE_CMD_TYPE.MCT_UI_USE_CANCEL_IDENTIFY;
                    }
                    break;

                    case ACTION_OPTYPE.AOT_MOUSECMD_ADDFRIEND:
                    {
                        //左键鉴定
                        m_cmdCurrent_Left.m_typeMouse = MOUSE_CMD_TYPE.MCT_UI_USE_ADDFRIEND;
                        //右键取消
                        m_cmdCurrent_Right.m_typeMouse = MOUSE_CMD_TYPE.MCT_UI_USE_CANCEL_ADDFRIEND;
                    }
                    break;

                    case ACTION_OPTYPE.AOT_MOUSECMD_EXCHANGE:
                    {
                        //左键鉴定
                        m_cmdCurrent_Left.m_typeMouse = MOUSE_CMD_TYPE.MCT_UI_USE_EXCHANGE;
                        //右键取消
                        m_cmdCurrent_Right.m_typeMouse = MOUSE_CMD_TYPE.MCT_UI_USE_CANCEL_EXCHANGE;
                    }
                    break;

                    case ACTION_OPTYPE.AOT_MOUSECMD_CATCHPET:
                    {
                        m_cmdCurrent_Left.m_typeMouse = MOUSE_CMD_TYPE.MCT_CATCH_PET;
                        m_cmdCurrent_Left.SetValue(0, fvPos.x);
                        m_cmdCurrent_Left.SetValue(1, fvPos.z);
                    }
                    break;

                    case ACTION_OPTYPE.AOT_MOUSECMD_SALE:
                    {
                        //左键鉴定
                        m_cmdCurrent_Left.m_typeMouse = MOUSE_CMD_TYPE.MCT_SALE;
                        //右键取消
                        m_cmdCurrent_Right.m_typeMouse = MOUSE_CMD_TYPE.MCT_CANCEL_SALE;
                    }
                    break;

                    case ACTION_OPTYPE.AOT_MOUSECMD_BUYMULT:
                    {
                        //左键
                        m_cmdCurrent_Left.m_typeMouse = MOUSE_CMD_TYPE.MCT_BUYMULT;
                        //右键
                        m_cmdCurrent_Right.m_typeMouse = MOUSE_CMD_TYPE.MCT_CANCEL_BUYMULT;
                    }
                    break;

                    default:
                        //移动
                    {
                        //if (pSelectObj != CObjectManager.Instance.getPlayerMySelf())
                        {
                            m_cmdCurrent_Left.m_typeMouse = MOUSE_CMD_TYPE.MCT_PLAYER_MOVETO;
                            m_cmdCurrent_Left.SetValue(0, fvPos.x);
                            m_cmdCurrent_Left.SetValue(1, fvPos.z);
                        }
                    }
                    break;
                    }
                }
                else //temp fix 添加默认左键事件, TODO,find其他地方是否有默认左键事件
                {
                    //移动
                    {
                        if (pSelectObj == null)
                        {
                            m_cmdCurrent_Left.m_typeMouse = MOUSE_CMD_TYPE.MCT_PLAYER_MOVETO;
                            m_cmdCurrent_Left.SetValue(0, fvPos.x);
                            m_cmdCurrent_Left.SetValue(1, fvPos.z);
                        }
                    }
                }
            }
            //选择玩家
            if (m_cmdCurrent_Right.m_typeMouse == MOUSE_CMD_TYPE.MCT_NULL)
            {
                m_cmdCurrent_Right.m_typeMouse = MOUSE_CMD_TYPE.MCT_PLAYER_SELECT;
                m_cmdCurrent_Right.SetValue(0, -1);
            }
        }
    }
Пример #12
0
 public void SetActiveSkill(tActionItem pSkill)
 {
     m_pActiveSkill = pSkill;
     CActionSystem.Instance.SetDefaultAction(pSkill);
 }