コード例 #1
0
        public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer)
        {
            GCDetailSkillList Packet = (GCDetailSkillList)pPacket;

            if (GameProcedure.GetActiveProcedure() == GameProcedure.s_ProcMain)
            {
                //  CUIDataPool* pDataPool = (CUIDataPool*)(CGameProcedure::s_pDataPool);
                //确认是自己的数据

                CObject_PlayerMySelf pMySelf = CObjectManager.Instance.getPlayerMySelf();
                if (pMySelf.ServerID != Packet.ObjectID)
                {
                    return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE);
                }

                //清空所有技能
                pMySelf.GetCharacterData().Skill_CleanAll();

                //刷新到用户数据
                _OWN_SKILL[] pOwnerSkill = Packet.Skill;
                byte[]       nLevel      = Packet.SkillLevel;
                for (short i = 0; i < Packet.numSkill; i++)
                {
                    //LogManager.LogWarning("GCDetailSkillList " + i + " skillID " + pOwnerSkill[i].m_nSkillID + " level " + nLevel[i]);
                    pMySelf.GetCharacterData().Set_Skill(pOwnerSkill[i].m_nSkillID, nLevel[i], true);
                }

                //刷新到UI
                CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_SKILL_UPDATE);
                //LogManager.Log("RECV GCDetailSkillList");
            }
            return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE);
        }
コード例 #2
0
        public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer)
        {
            GCSkillClass Packet = (GCSkillClass)pPacket;

            if (GameProcedure.GetActiveProcedure() == GameProcedure.s_ProcMain)
            {
                //CUIDataPool* pDataPool = (CUIDataPool*)(CGameProcedure::s_pDataPool);

                //确认是自己的数据
                CObject_PlayerMySelf pMySelf = CObjectManager.Instance.getPlayerMySelf();
                if (pMySelf.ServerID != Packet.ObjectID)
                {
                    return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE);
                }

                //刷新到用户数据
                _OWN_XINFA[] xinFa = Packet.XinFa;
                for (short i = 0; i < Packet.numXinFa; i++)
                {
                    pMySelf.GetCharacterData().Set_SkillClass(xinFa[i].m_nXinFaID, xinFa[i].m_nXinFaLevel);
                }

                CActionSystem.Instance.SkillClass_Update();

                CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_SKILL_UPDATE);
                LogManager.Log("RECV GCDetailXinFaClass");
            }
            return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE);
        }
コード例 #3
0
    public bool IsAreaTargetType()
    {
        if (m_theBaseDef == null)
        {
            return(false);
        }
        //玩家自己
        CObject_PlayerMySelf pMySlef = CObjectManager.Instance.getPlayerMySelf();

        //无需目标
        return((int)ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_POS == m_theBaseDef.nTargetType);
    }
コード例 #4
0
    //创建玩家自己
    public CObject_PlayerMySelf NewPlayerMySelf(int idServer)
    {
        if (mServerObjects.ContainsKey(idServer))
        {
            return((CObject_PlayerMySelf)mServerObjects[idServer]);
        }
        CObject_PlayerMySelf playerMySelf = new CObject_PlayerMySelf();

        add(playerMySelf, idServer);
        //mLogicalObject.AddChild(playerMySelf);
        mPlayerMySelf = playerMySelf;

        return(playerMySelf);
    }
コード例 #5
0
    /// <summary>
    /// 锁定最近的目标
    /// </summary>
    public CObject_Character LockNearestEnemy()
    {
        if (GetMainTarget() != null && IsEnemy(GetMainTarget()))
        {
            return((CObject_Character)GetMainTarget());
        }

        float fNearestDist                  = 20.0f; //最大允许距离(m)
        CObject_PlayerMySelf myself         = CObjectManager.Instance.getPlayerMySelf();
        CObject_Character    pNearestTarget = (CObject_Character)CObjectManager.Instance.GetNearestTargetByOrigin(myself, fNearestDist, true);

        //锁定该目标
        if (pNearestTarget != null && pNearestTarget != GetMainTarget())
        {
            SetMainTarget(pNearestTarget.ServerID, DESTROY_MAIN_TARGET_TYPE.DEL_OBJECT);
        }
        return(pNearestTarget);
    }
コード例 #6
0
    //清除所有CObject派生对象  [3/7/2012 ZZY]
    public void Clear()
    {
        List <CObject> delObject = new List <CObject>();

        foreach (int k in mServerObjects.Keys)
        {
            CObject obj = mServerObjects[k];
            if (obj.GetFakeObjectFlag() == false)
            {
                delObject.Add(mServerObjects[k]);
            }
        }
        foreach (CObject obj in delObject)
        {
            DestroyObject(obj);
        }
        DestroyObject(mPlayerMySelf);
        mPlayerMySelf = null;
    }
コード例 #7
0
    //进入指定场景
    public void                             EnterScene()
    {
        //todo load scene
        //LogManager.Log("Enter Scene");

        if (!WorldManager.Instance.EnterScene(m_nSceneID, m_nSceneResID, m_nCityLevel))
        {
            return;
        }
        AssetBundleManager.AssetBundleRequestManager.releaseAssetBundles();//切换场景时释放已下载的www对象
        //转入主循环
        GameProcedure.SetActiveProc(GameProcedure.s_ProcMain);

        //创建玩家自身
        int idMySelfServer           = s_pVariableSystem.GetAs_Int("MySelf_ID");
        CObject_PlayerMySelf pMySelf = s_pObjectManager.getPlayerMySelf();

        if (pMySelf == null)
        {
            pMySelf = s_pObjectManager.NewPlayerMySelf(idMySelfServer);
        }
        s_pObjectManager.SetObjectServerID(pMySelf.ID, idMySelfServer);
        pMySelf.SetServerGUID(s_pVariableSystem.GetAs_Int("User_GUID"));

        fVector2 MySelfPos = s_pVariableSystem.GetAs_Vector2("MySelf_Pos");

        pMySelf.Initial(null);//初始化玩家,创建角色数据
        string posMsg = "玩家位置:";

        posMsg += MySelfPos.x.ToString() + " " + MySelfPos.y.ToString();
        //LogManager.Log(posMsg);
        pMySelf.SetMapPosition(MySelfPos.x, MySelfPos.y);

        //设置摄像机参数
        // TODO

        //////////////////////////////////////////////////////////////////////////
        // 检查是否在自动寻路 [8/9/2011 ivan edit]
        Interface.GameInterface.Instance.AutoMovePlayerReady();

        //产生事件
        CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_PLAYER_ENTER_WORLD);
    }
コード例 #8
0
    // 解散队伍
    public void DismissTeam()
    {
        switch (m_Type)
        {
        case TEAM_OR_GROUP_TYPE.TEAM_TYPE:
        {         // 队伍的情况
            for (int i = 0; i < m_TeamMembers.Count; i++)
            {
                // 更新队员头顶信息颜色 [10/9/2011 Ivan edit]
                CObject_Character player = CObjectManager.Instance.FindServerObject((int)m_TeamMembers[i].m_OjbID) as CObject_Character;
                if (player != null)
                {
                    player.GetCharacterData().RefreshName();
                }
            }
            m_TeamMembers.Clear();
        }
        break;

        case TEAM_OR_GROUP_TYPE.GROUP_TYPE:
        {
            m_TeamInfo.Clear();
        }
        break;

        default:
            return;
        }

        CleanUp();

        //设置角色层数据
        CObject_PlayerMySelf self = CObjectManager.Instance.getPlayerMySelf();

        if (self != null)
        {
            self.GetCharacterData().Set_HaveTeamFlag(false);
            self.GetCharacterData().Set_TeamLeaderFlag(false);
            self.GetCharacterData().Set_TeamFullFlag(false);
            self.GetCharacterData().Set_TeamFollowFlag(false);
        }
    }
コード例 #9
0
    // 得到自己的队伍信息(从自己的数据池获取)
    void FillMyInfo(TeamMemberInfo member)
    {
        if (member == null)
        {
            throw new NullReferenceException("team member in FillMyInfo(member)");
        }

        CObject_PlayerMySelf pMe = CObjectManager.Instance.getPlayerMySelf();

        CCharacterData pMyData = pMe.GetCharacterData();

        if (null == pMyData)
        {
            return;
        }
        member.m_szNick        = pMyData.Get_Name();
        member.m_uFamily       = pMyData.Get_MenPai();
        member.m_uDataID       = pMyData.Get_RaceID();
        member.m_uLevel        = pMyData.Get_Level();
        member.m_nPortrait     = pMyData.Get_PortraitID();
        member.m_WorldPos.m_fX = pMe.GetPosition().x;
        member.m_WorldPos.m_fZ = pMe.GetPosition().z;
        member.m_nHP           = pMyData.Get_HP();
        member.m_dwMaxHP       = pMyData.Get_MaxHP();
        member.m_nMP           = pMyData.Get_MP();
        member.m_dwMaxMP       = pMyData.Get_MaxMP();
        member.m_nAnger        = 100; // 客户端没有
        member.m_WeaponID      = pMyData.Get_Equip(HUMAN_EQUIP.HEQUIP_WEAPON);
        member.m_CapID         = pMyData.Get_Equip(HUMAN_EQUIP.HEQUIP_CAP);
        member.m_ArmourID      = pMyData.Get_Equip(HUMAN_EQUIP.HEQUIP_ARMOR);
        member.m_CuffID        = pMyData.Get_Equip(HUMAN_EQUIP.HEQUIP_CUFF);
        member.m_FootID        = pMyData.Get_Equip(HUMAN_EQUIP.HEQUIP_BOOT);
        member.m_uBackID       = pMyData.Get_Equip(HUMAN_EQUIP.HEQUIP_BACK);//  [8/30/2010 Sun]
        member.m_bDead         = (pMe.CharacterLogic_Get() == ENUM_CHARACTER_LOGIC.CHARACTER_LOGIC_DEAD);

        member.m_uFaceMeshID = pMyData.Get_FaceMesh();
        member.m_uHairMeshID = pMyData.Get_HairMesh();
        member.m_uHairColor  = pMyData.Get_HairColor();
    }
コード例 #10
0
    //private void    AddFriend( CObject_PlayerOther* pObj );

    //创建轨迹特效
    //private void	CreateMoveTrackProjTex();
    //private void	Tick_MoveTrack();
    //CObject_ProjTex_MoveTrack* GetFreeProjTex();
    //void	FreeMoveTrackProjTex(CObject_ProjTex_MoveTrack* pMoveTrack);
    //private void	FreeAllMoveTrackProjTex();
    //private void	ClearAllFreeProjTex();

    // 刷新地图信息 [3/19/2012 Ivan]
    public void UpdateMinimapData()
    {
        ClearMapData();

        // 更新队友列表
        //if(CUIDataPool::GetMe()->GetTeamOrGroup())
        //{
        //    for( int i = 0; i < CUIDataPool::GetMe()->GetTeamOrGroup()->GetTeamMemberCount(); i ++ )
        //    {
        //        const TeamMemberInfo* pInfo = CUIDataPool::GetMe()->GetTeamOrGroup()->GetMemberByIndex( i );
        //        if( pInfo )
        //        {
        //            /*if( pInfo->m_SceneID != m_pActiveScene->GetSceneDefine()->nID )
        //                continue;*/
        //            if( pInfo->m_OjbID == CObjectManager::GetMe()->GetMySelf()->GetServerID() )
        //                continue;
        //            data.pos.x = pInfo->m_WorldPos.m_fX;
        //            data.pos.z = pInfo->m_WorldPos.m_fZ;
        //            _snprintf( data.name, 128, "%s", pInfo->m_szNick );
        //            data.nServerID = pInfo->m_OjbID;
        //            data.dwSceneID = pInfo->m_SceneID;
        //            m_FriendlistObj.push_back( data );
        //        }
        //    }
        //}

        MAP_POS_DEFINE       data;
        CObject_PlayerMySelf mySelf = CObjectManager.Instance.getPlayerMySelf();

        // 遍历所有的对象 [3/19/2012 Ivan]
        foreach (KeyValuePair <int, CObject> obj in CObjectManager.Instance.ServerObjects)
        {
            data = new MAP_POS_DEFINE();
            // 如果是角色 [3/19/2012 Ivan]
            if (obj.Value is CObject_Character)
            {
                CObject curObj = obj.Value;
                if (curObj == mySelf)
                {
                    continue;
                }
                ENUM_RELATION sCamp = GameInterface.Instance.GetCampType(curObj, mySelf);

                // 如果已经死了,就不加如列表了。
                if (((CObject_Character)curObj).CharacterLogic_Get() == ENUM_CHARACTER_LOGIC.CHARACTER_LOGIC_DEAD)
                {
                    continue;
                }
                if (((CObject_Character)curObj).GetFakeObjectFlag() == true)
                {
                    continue;
                }
                // 判断是不是宠物

                // 此处还有判断m_FlashlistObj和m_ActivelistObj的逻辑,没有使用,屏蔽 [3/19/2012 Ivan]

                data.pos.x     = curObj.GetPosition().x;
                data.pos.y     = curObj.GetPosition().z;
                data.name      = ((CObject_Character)curObj).GetCharacterData().Get_Name();
                data.nServerID = ((CObject_PlayerNPC)curObj).ServerID;

                if (curObj is CObject_PlayerOther)              // 如果是玩家
                {
                    if (sCamp == ENUM_RELATION.RELATION_FRIEND) // 如果是同一阵营的
                    {
                        // 如果是队友,就替掉本来已经存在的位置
                        //                      if( CheckIsFriend( pCurObj->GetServerID() ) )
                        //                      {
                        //                          AddFriend( (CObject_PlayerOther*)pCurObj );
                        //                          continue;
                        //                      }
                        m_PlayerlistObj.Add(data);
                    }
                    else if (sCamp == ENUM_RELATION.RELATION_ENEMY) // 敌人
                    {
                        m_AnimylistObj.Add(data);
                    }
                }
                else if (curObj is CObject_PlayerNPC) // 如果是npc
                {
                    //data.nServerID = ((CObject_PlayerNPC)curObj).GetCharacterData().Get_RaceID();
                    if (((CObject_PlayerNPC)curObj).IsDisplayBoard() == false)
                    {
                        continue;
                    }
                    // 如果是宠物
                    if (((CObject_PlayerNPC)curObj).GetNpcType() == ENUM_NPC_TYPE.NPC_TYPE_PET)
                    {
                        if (((CObject_PlayerNPC)curObj).GetOwnerId() == -1) // 还没有主人
                        {
                            m_PetlistObj.Add(data);
                        }
                    }
                    else if (sCamp == ENUM_RELATION.RELATION_FRIEND) // 如果是同阵营的,是npc,否则是敌人
                    {
                        // TODO 以后要判断该npc身上是否带了任务,有的话需要放到任务列表里面去 [3/19/2012 Ivan]
                        m_ExpNPClistObj.Add(data);
                    }
                    else if (sCamp == ENUM_RELATION.RELATION_ENEMY)
                    {
                        m_AnimylistObj.Add(data);
                    }
                }
            }
            else if (obj.Value is CTripperObject_Resource)
            {
                CTripperObject_Resource resource = obj.Value as CTripperObject_Resource;
                data.pos.x     = resource.GetPosition().x;
                data.pos.y     = resource.GetPosition().z;
                data.name      = resource.GetLifeAbility().szName;
                data.nServerID = resource.ServerID;
                m_ExpObjlistObj.Add(data);
            }
            //          else if( obj.Value is CTripperObject_Transport  )
            //          {
            //              data.pos.x = (( CObject*)pCurObj)->GetPosition().x;
            //              data.pos.z = (( CObject*)pCurObj)->GetPosition().z;
            //              _snprintf( data.name, 128, "传送点" );
            //          }
        }
    }
コード例 #11
0
    //该物品是否能够在某对象上使用
    public bool     IsValidTarget(CObject pSelectObj, ref fVector2 fvPos, ref int objID, ref PET_GUID_t petID)
    {
        if (m_theBaseDef == null)
        {
            return(false);
        }
        //玩家自己
        CObject_PlayerMySelf pMySlef = CObjectManager.Instance.getPlayerMySelf();

        ENUM_ITEM_TARGET_TYPE targetType = (ENUM_ITEM_TARGET_TYPE)m_theBaseDef.nTargetType;

        //无需目标
        if (ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_NONE == targetType)
        {
            return(true);
        }

        //需要选择一个场景位置
        if (ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_POS == targetType)
        {
            return(WorldManager.Instance.ActiveScene.IsValidPosition(ref fvPos));
        }

        //目前不支持的方式
        if (ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_DIR == targetType ||         //方向
            ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_ITEM == targetType)          //物品->物品
        {
            return(false);
        }

        switch (targetType)
        {
        case ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_SELF:       //自已
        {
            objID = pMySlef.ServerID;
        }
            return(true);

        case ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_SELF_PET:           //自己的宠物
        {
            //petID = pMySlef.GetCharacterData().Get_CurrentPetGUID();
            ////宠物尚未释放
            //if(petID.IsNull())
            //    return false;

            objID = pMySlef.ServerID;
            return(true);
        }
        //break;

        case ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_FRIEND:     //友好的目标
        case ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_ENEMY:      //敌对目标
        {
            //必须需要一个目标
            if (pSelectObj == null)
            {
                return(false);
            }
            //必须是角色
            if (!(pSelectObj is CObject_Character))
            {
                return(false);
            }

            //检查阵营
            ENUM_RELATION eCampType =
                GameProcedure.s_pGameInterface.GetCampType(pMySlef, pSelectObj);

            //必须是友好目标/敌对目标
            if ((targetType == ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_FRIEND &&
                 (pSelectObj == pMySlef || eCampType == ENUM_RELATION.RELATION_FRIEND)) ||
                (targetType == ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_ENEMY &&
                 (eCampType == ENUM_RELATION.RELATION_ENEMY)))
            {
                objID = pSelectObj.ServerID;
                return(true);
            }
        }
            return(false);

        case ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_FRIEND_PLAYER:     // 友好玩家
        case ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_ENEMY_PLAYER:      //	敌对玩家
        {
            //必须需要一个目标
            if (pSelectObj == null)
            {
                return(false);
            }
            //必须是玩家
            if (!(pSelectObj is CObject_PlayerOther))
            {
                return(false);
            }

            //检查阵营
            ENUM_RELATION eCampType =
                GameProcedure.s_pGameInterface.GetCampType(pMySlef, pSelectObj);

            //必须是友好玩家/敌对玩家
            if ((targetType == ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_FRIEND_PLAYER &&
                 (pSelectObj == pMySlef || eCampType == ENUM_RELATION.RELATION_FRIEND)) ||
                (targetType == ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_ENEMY_PLAYER &&
                 (eCampType == ENUM_RELATION.RELATION_ENEMY)))
            {
                objID = pSelectObj.ServerID;
                return(true);
            }
        }
            return(false);

        case ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_FRIEND_MONSTER:     //友好怪物
        case ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_ENEMY_MONSTER:      //敌对怪物
        {
            //必须需要一个目标
            if (pSelectObj == null)
            {
                return(false);
            }
            //必须是角色
            if (!(pSelectObj is CObject_Character))
            {
                return(false);
            }
            //必须是NPC
            if (((CObject_Character)pSelectObj).GetCharacterType() !=
                CHARACTER_TYPE.CT_MONSTER)
            {
                return(false);
            }

            //检查阵营
            ENUM_RELATION eCampType =
                GameProcedure.s_pGameInterface.GetCampType(pMySlef, pSelectObj);

            //必须是友好NPC
            if ((targetType == ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_FRIEND_MONSTER &&
                 eCampType == ENUM_RELATION.RELATION_FRIEND) ||
                (targetType == ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_ENEMY_MONSTER &&
                 eCampType == ENUM_RELATION.RELATION_ENEMY))
            {
                objID = pSelectObj.ServerID;
                return(true);
            }
        }
            return(false);

        case ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_FRIEND_PET:         //友好宠物
        case ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_ENEMY_PET:          //敌对宠物
        {
            //必须需要一个目标
            if (pSelectObj == null)
            {
                return(false);
            }
            //必须是角色
            if (!(pSelectObj is CObject_Character))
            {
                return(false);
            }
            //必须是NPC
            if (((CObject_Character)pSelectObj).GetCharacterType() !=
                CHARACTER_TYPE.CT_MONSTER)
            {
                return(false);
            }
            //必须是宠物
            if (((CObject_PlayerNPC)pSelectObj).GetNpcType() !=
                ENUM_NPC_TYPE.NPC_TYPE_PET)
            {
                return(false);
            }

            //检查阵营
            ENUM_RELATION eCampType =
                GameProcedure.s_pGameInterface.GetCampType(pMySlef, pSelectObj);

            //必须是友好宠物
            if ((targetType == ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_FRIEND_MONSTER &&
                 eCampType == ENUM_RELATION.RELATION_FRIEND) ||
                (targetType == ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_ENEMY_PET &&
                 eCampType == ENUM_RELATION.RELATION_ENEMY))
            {
                objID = pSelectObj.ServerID;
                return(true);
            }
        }
            return(false);

        case ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_ALL_CHARACTER:      //所有角色
        {
            //必须需要一个目标
            if (pSelectObj == null)
            {
                return(false);
            }
            //必须是角色
            if (!(pSelectObj is CObject_Character))
            {
                return(false);
            }

            return(true);
        }
        //return false;

        default:
            break;
        }

        return(false);
    }
コード例 #12
0
    public override void Init()
    {
        base.Init();
        m_pMySelf = s_pObjectManager.getPlayerMySelf();
        int m_nID = m_pMySelf.ServerID;
        //      m_pActiveSkill = NULL;
        //      m_pSkillArea = NULL;
        //      m_pMouseTarget = NULL;
        //      m_bAutoRun = FALSE;
        //      m_bAutoMoveAlong = FALSE;
        //------------------------------------------------------------------
        //重置LogicCount
        //	    m_pMySelf->ResetLogicCount();

        //------------------------------------------------------------------
        //清空加载队列
        //	    CObjectManager::GetMe()->GetLoadQueue()->ClearAllTask();

        //------------------------------------------------------------------
        //发送环境请求
        //	    CGEnvRequest msgEnvRequest;
        //	    CNetManager::GetMe()->SendPacket(&msgEnvRequest);

        //------------------------------------------------------------------
        //发送自身数据请求

        //自身基本信息
        CGCharAskBaseAttrib msgMyBaseAttrib = new CGCharAskBaseAttrib();

        msgMyBaseAttrib.setTargetID((uint)m_nID);
        s_NetManager.SendPacket(msgMyBaseAttrib);

        //基本属性
        CGAskDetailAttrib msgMyAttrib = new CGAskDetailAttrib();

        msgMyAttrib.ObjID = (uint)m_nID;
        s_NetManager.SendPacket(msgMyAttrib);

        ////自身装备(用于创建渲染层外形)
        //CGCharAskEquipment msgAskMyEquip;
        //msgAskMyEquip.setObjID(m_nID);
        //CNetManager::GetMe()->SendPacket(&msgAskMyEquip);

        //生活技能
        CGAskDetailAbilityInfo msgAbility = new CGAskDetailAbilityInfo();

        msgAbility.ObjID = m_nID;
        NetManager.GetNetManager().SendPacket(msgAbility);
        //
        //      //技能系
        CGAskSkillClass msgMySkillClass = new CGAskSkillClass();

        msgMySkillClass.ObjID = m_nID;
        s_NetManager.SendPacket(msgMySkillClass);

        //技能
        CGAskDetailSkillList msgMyDetailSkill = new CGAskDetailSkillList();

        msgMyDetailSkill.ObjID = m_nID;
        s_NetManager.SendPacket(msgMyDetailSkill);
        //
        //      //组队数据
        //      CUIDataPool::GetMe()->ClearTeamInfo();
        //      CGAskTeamInfo msgTeamInfo;
        //      msgTeamInfo.SetObjID( m_nID );
        //      CNetManager::GetMe()->SendPacket(&msgTeamInfo);
        //
        //      //如果是城市向服务器请求城市数据
        //      CGCityAskAttr	MsgCityBuilding;
        //      CNetManager::GetMe()->SendPacket( &MsgCityBuilding );
        //
        //      //所有称号
        //      CGCharAllTitles	msgAllTitles;
        //      msgAllTitles.setTargetID( m_nID );
        //      CNetManager::GetMe()->SendPacket(&msgAllTitles);

        //是第一次登陆
        if (GameProcedure.s_ProcEnter.GetEnterType() == (uint)ENTER_TYPE.ENTER_TYPE_FIRST)
        {
            //详细装备(用于在数据池中存储物品详细属性)
            CGAskDetailEquipList msgAskEquip = new CGAskDetailEquipList();
            msgAskEquip.ObjId = (uint)m_nID;
            msgAskEquip.Mode  = ASK_EQUIP_MODE.ASK_EQUIP_ALL;
            s_NetManager.SendPacket(msgAskEquip);

            //背包
            CGAskMyBagList msgMyBag = new CGAskMyBagList();
            msgMyBag.Mode = ASK_BAG_MODE.ASK_ALL;
            s_NetManager.SendPacket(msgMyBag);

            CGAskMail msgAskMail = new CGAskMail();
            msgAskMail.AskType = (byte)ASK_TYPE.ASK_TYPE_LOGIN;
            s_NetManager.SendPacket(msgAskMail);

            //MissionList
            CGAskMissionList msgMissionList = new CGAskMissionList();
            msgMissionList.ObjID = (uint)m_nID;
            s_NetManager.SendPacket(msgMissionList);

            //向服务器请求快捷栏数据
            CGAskSetting msgSetting = new CGAskSetting();
            s_NetManager.SendPacket(msgSetting);
            //请求法宝栏数据
            CGAskTalismanBag AskTalismanBag = new CGAskTalismanBag();
            s_NetManager.SendPacket(AskTalismanBag);



            //向服务器请求关系人列表
            CGRelation MsgRelation           = new CGRelation();
            MsgRelation.GetRelation().m_Type = (byte)RELATION_REQUEST_TYPE.REQ_RELATIONLIST;
            NetManager.GetNetManager().SendPacket(MsgRelation);

            //想服务器请求符印信息
            CGAskFlushCharmInfo msgFlushCharmInfo = new CGAskFlushCharmInfo();
            NetManager.GetNetManager().SendPacket(msgFlushCharmInfo);

            //广播第一次进入游戏,用来初始化ui或者一些组件
            CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_APPLICATION_INITED);
        }
    }
コード例 #13
0
    //激活动作
    public override void DoAction()
    {
        SCLIENT_SKILL pSkill = (SCLIENT_SKILL)GetSkillImpl();

        if (pSkill == null)
        {
            return;
        }

        OPERATE_RESULT oResult;

        //
        oResult = pSkill.IsCanUse_Leaned();
        if (GameDefineResult.Instance.OR_FAILED(oResult))
        {
            CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_INFO_SELF, GameDefineResult.Instance.GetOResultText(oResult));
            return;
        }
        ////检查冷却是否结束
        oResult = pSkill.IsCanUse_CheckCoolDown();
        if (GameDefineResult.Instance.OR_FAILED(oResult))
        {
            CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_INFO_SELF, GameDefineResult.Instance.GetOResultText(oResult));
            return;
        }



        // 消耗检测
        int idUser;
        CObject_PlayerMySelf pMySelf = CObjectManager.Instance.getPlayerMySelf();

        idUser  = (pMySelf != null) ? (pMySelf.ID) : (MacroDefine.INVALID_ID);
        oResult = pSkill.IsCanUse_CheckDeplete(idUser);
        if (GameDefineResult.Instance.OR_FAILED(oResult))
        {
            CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_INFO_SELF, GameDefineResult.Instance.GetOResultText(oResult));
            return;
        }

        oResult = pSkill.IsCanUse_CheckLevel(idUser, pSkill.m_nLevel);
        if (GameDefineResult.Instance.OR_FAILED(oResult))
        {
            CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_INFO_SELF, GameDefineResult.Instance.GetOResultText(oResult));
            return;
        }

        //如果是连续的那么就换为选中状态。
        AutoKeepOn();
        //根据操作类型
        switch ((ENUM_SELECT_TYPE)pSkill.m_pDefine.m_nSelectType)
        {
        case ENUM_SELECT_TYPE.SELECT_TYPE_NONE:
        {
            CObjectManager.Instance.getPlayerMySelf().Player_UseSkill(GetDefineID());
            //恢复激活Action
            CActionSystem.Instance.SetDefaultAction(CObjectManager.Instance.getPlayerMySelf().GetActiveSkill());
        }
        break;

        case ENUM_SELECT_TYPE.SELECT_TYPE_CHARACTER:
        {
            //取得技能数据
            int idMyself = CObjectManager.Instance.getPlayerMySelf().ServerID;

            if (CObjectManager.Instance.GetMainTarget() != null)
            {
                int idTarget = CObjectManager.Instance.GetMainTarget().ServerID;
                // 陈治要求使用增益型技能的时候,选中为敌人的情况下,强制改为自己 [11/14/2011 Ivan edit]
                if (pSkill.m_pDefine.m_nFriendness >= 0 &&
                    idTarget != idMyself)        // 减少判断
                {
                    CObject_Character pTargetObj = (CObject_Character)CObjectManager.Instance.FindServerObject(idTarget);
                    //阵营判断
                    ENUM_RELATION eCampType = pTargetObj.GetCampType(CObjectManager.Instance.getPlayerMySelf());

                    // 通过PK模式判断是否为敌人 [8/19/2011 edit by ZL]
                    if (eCampType != ENUM_RELATION.RELATION_ENEMY)
                    {
                        int tempRelation = CObjectManager.Instance.getPlayerMySelf().GetRelationOther(pTargetObj);
                        eCampType = (ENUM_RELATION)tempRelation;
                    }
                    // 增益型技能:目标不是友好对象的情况下必须强制对自己使用 [11/14/2011 Ivan edit]
                    if (eCampType != ENUM_RELATION.RELATION_FRIEND)
                    {
                        idTarget = idMyself;
                    }
                }
                CObjectManager.Instance.getPlayerMySelf().Player_UseSkill(GetDefineID(), idTarget);
            }
            else
            {
                // 陈治要求如果增益型技能没有选中对象,则默认目标为自己 [11/14/2011 Ivan edit]
                if (pSkill.m_pDefine.m_nFriendness >= 0)
                {
                    CObjectManager.Instance.getPlayerMySelf().Player_UseSkill(GetDefineID(), idMyself);
                }
                else
                {
                    CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_INFO_SELF, GameDefineResult.Instance.GetOResultText(OPERATE_RESULT.OR_NO_TARGET));
                    CObjectManager.Instance.getPlayerMySelf().Player_UseSkill(GetDefineID(), (uint)idMyself);
                }
            }
            //恢复激活Action
            CActionSystem.Instance.SetDefaultAction(CObjectManager.Instance.getPlayerMySelf().GetActiveSkill());
        }
        break;

        case ENUM_SELECT_TYPE.SELECT_TYPE_POS:
            CActionSystem.Instance.SetDefaultAction(this);
            break;

        case ENUM_SELECT_TYPE.SELECT_TYPE_DIR:
            CActionSystem.Instance.SetDefaultAction(this);
            //CActionSystem.Instance.SetDefaultAction(CObjectManager.Instance.getPlayerMySelf().GetActiveSkill());
            //		CGameProcedure::s_pGameInterface->Skill_SetActive(this);
            break;

        case ENUM_SELECT_TYPE.SELECT_TYPE_SELF:
        {
            CObjectManager.Instance.getPlayerMySelf().Player_UseSkill(GetDefineID(), CObjectManager.Instance.getPlayerMySelf().ServerID);
            //恢复激活Action
            //  CActionSystem.Instance.SetDefaultAction(GameProcedure.Skill_GetActive());
        }
        break;

        case ENUM_SELECT_TYPE.SELECT_TYPE_HUMAN_GUID:
        {
            //待实现
            //当前是否已经选择了一个队友
            //uint guid;
            //CObjectManager::GetMe()->GetMainTarget(guid);
            //if(guid == (GUID_t)-1)
            //{
            //    //尚未选择合法的对象
            //    CEventSystem::GetMe()->PushEvent(GE_INFO_SELF, "无效目标");
            //    return;
            //}

            //CGameProcedure::s_pGameInterface->Player_UseSkill(GetID(), (GUID_t)guid);
            ////恢复激活Action
            //CActionSystem::GetMe()->SetDefaultAction(CGameProcedure::s_pGameInterface->Skill_GetActive());
        }
        break;
        }
    }
コード例 #14
0
    bool IsMyPet(uint serverId)
    {
        CObject_PlayerMySelf mySelf = CObjectManager.Instance.getPlayerMySelf();

        return(mySelf.GetCharacterData().IsMyPet(serverId));
    }
コード例 #15
0
    public void UpdateFuncEnable()
    {
        if (funcList.Count == 0)
        {
            UnRegistConditions();
            return;
        }

        CObject_PlayerMySelf mySelf = CObjectManager.Instance.getPlayerMySelf();
        CDetailAttrib_Player myData = CDetailAttrib_Player.Instance;

        if (mySelf == null || myData == null)
        {
            return;
        }
        //////////////////////////////////////////////////////////////////////////
        // 由于界面表现要有特殊标示,所以特殊对待
        int x1Pos = 0;
        int y2Pos = 45;
        int index = -1;

        //////////////////////////////////////////////////////////////////////////
        foreach (_DBC_FUNC_OPEN_LIST enumerator in funcList)
        {
            index++;
            bool showEnable          = true;
            _DBC_FUNC_OPEN_LIST func = enumerator;
            if (func.needLevel != MacroDefine.INVALID_ID && mySelf.GetCharacterData().Get_Level() < func.needLevel)
            {
                showEnable = false;
            }
            else if (func.receiveMission != MacroDefine.INVALID_ID)
            {
                if ((myData.GetMissionIndexByID(func.receiveMission) == MacroDefine.INVALID_ID) &&
                    !myData.IsMissionHaveDone((uint)func.receiveMission))
                {
                    showEnable = false;
                }
            }
            else if (func.finishMission != MacroDefine.INVALID_ID)
            {
                if (!myData.IsMissionHaveDone((uint)func.finishMission))
                {
                    showEnable = false;
                }
            }

            if (uiGoList[index] == null)
            {
                uiGoList[index] = GameObject.Find(enumerator.uiName);
            }

            if (uiGoList[index] != null)
            {
                if (showEnable)
                {
                    if (uiGoList[index].layer != LayerManager.UILayer)
                    {
                        uiGoList[index].layer = LayerManager.UILayer;
                    }

                    //////////////////////////////////////////////////////////////////////////
                    Vector3 pos = uiGoList[index].transform.localPosition;
                    switch (enumerator.specialTag)
                    {
                    case 1:
                        pos.x  = x1Pos;
                        x1Pos -= 45;
                        break;

                    case 2:
                        pos.y  = y2Pos;
                        y2Pos += 45;
                        break;

                    default:
                        break;
                    }
                    uiGoList[index].transform.localPosition = pos;
                    //////////////////////////////////////////////////////////////////////////

                    //                 funcList.Remove(enumerator.Current.Key);
                    //                 enumerator = funcList.GetEnumerator();
                }
                else
                {
                    if (uiGoList[index].layer == LayerManager.UILayer)
                    {
                        uiGoList[index].layer = LayerManager.DefaultLayer;
                    }
                }
            }
        }
    }
コード例 #16
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;
        }
    }
コード例 #17
0
    /// <summary>
    /// 过滤任务
    /// </summary>
    public void Sort()
    {
        oldNpcIds.Clear();
        foreach (_DBC_MISSION_DEMAND_LIST miss in sceneMissions)
        {
            if (!oldNpcIds.Contains(miss.n_AcceptNpcID))
            {
                oldNpcIds.Add(miss.n_AcceptNpcID);
            }
            if (!oldNpcIds.Contains(miss.n_FinishNpcID))
            {
                oldNpcIds.Add(miss.n_FinishNpcID);
            }
        }

        sortMissions.Clear();
        sceneMissions.Clear();

        CObject_PlayerMySelf mySelf = CObjectManager.Instance.getPlayerMySelf();
        CDetailAttrib_Player myData = CDetailAttrib_Player.Instance;

        // 没有玩家数据无法过滤 [6/14/2011 ivan edit]
        if (mySelf == null || myData == null)
        {
            return;
        }

        int currentScene = GameProcedure.s_pWorldManager.GetActiveSceneID();

        foreach (_DBC_MISSION_DEMAND_LIST miss in allMissions)
        {
            // 是否已经接了该任务
//             if (myData.GetMissionIndexByID(miss.n_MissionID) != MacroDefine.INVALID_ID)
//                 continue;
            // 是否已经完成
            if (myData.IsMissionHaveDone((uint)miss.n_MissionID))
            {
                continue;
            }
            // 最低等级
            if (miss.n_MinLevel != MacroDefine.INVALID_ID && !(mySelf.GetCharacterData().Get_Level() >= miss.n_MinLevel))
            {
                continue;
            }
            // 最高等级
            if (miss.n_MaxLevel != MacroDefine.INVALID_ID && !(mySelf.GetCharacterData().Get_Level() < miss.n_MaxLevel))
            {
                continue;
            }
            // 前置任务
            if (miss.n_PreMissionID != MacroDefine.INVALID_ID && !myData.IsMissionHaveDone((uint)miss.n_PreMissionID))
            {
                continue;
            }

            sortMissions.Add(miss);

            // 整理出当前场景相关的任务 [4/6/2012 Ivan]
            if (miss.n_AcceptSceneId == currentScene || miss.n_FinishSceneId == currentScene)
            {
                sceneMissions.Add(miss);
            }
        }

        UpdateNpcState();

        oldNpcIds.Clear();

        // 刷新地图和可接任务列表 [4/6/2012 Ivan]
        CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_UI_INFOS, "SortMission");
    }
コード例 #18
0
    // 增加一个组员,如果是团队的话,需要传入团队所在的小组号
    public void AddMember(TeamMemberInfo member, short TeamID, byte TeamIndex)
    {
        TeamMemberInfo pTMInfo = new TeamMemberInfo();

        pTMInfo.m_GUID      = member.m_GUID;
        pTMInfo.m_OjbID     = member.m_OjbID;                                   //
        pTMInfo.m_SceneID   = member.m_SceneID;
        pTMInfo.m_uFamily   = member.m_uFamily;                                 // 2.五行属性
        pTMInfo.m_uDataID   = member.m_uDataID;                                 // 3.性别
        pTMInfo.m_nPortrait = member.m_nPortrait;                               // 5.头像
        pTMInfo.m_szNick    = member.m_szNick;

        CObject_PlayerMySelf pObj = CObjectManager.Instance.getPlayerMySelf();

        switch (m_Type)
        {
        case TEAM_OR_GROUP_TYPE.INVAILD_TYPE:
        {
            if (CreateTeam(pTMInfo, TeamID) == false)
            {
                pTMInfo = null;
            }
        }
        break;

        case TEAM_OR_GROUP_TYPE.TEAM_TYPE:
        {         // 队伍加人的情况
            if (m_TeamMembers.Count >= GAMEDEFINE.MAX_TEAM_MEMBER)
            {
                pTMInfo = null;
                CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_INFO_SELF, "队伍已满,无法加人");
                return;
            }

            m_TeamMembers.Add(pTMInfo);
            // 队伍满人标记 [6/14/2011 edit by ZL]
            if (m_TeamMembers.Count == GAMEDEFINE.MAX_TEAM_MEMBER)
            {
                CObjectManager.Instance.getPlayerMySelf().GetCharacterData().Set_TeamFullFlag(true);
            }
            // 更新队伍信息 [9/26/2011 Ivan edit]
            CObject_Character player = CObjectManager.Instance.FindServerObject((int)pTMInfo.m_OjbID) as CObject_Character;
            if (player != null)
            {
                player.GetCharacterData().RefreshName();
            }
        }
        break;

        case TEAM_OR_GROUP_TYPE.GROUP_TYPE:
        {         // 团队加人的情况
            if (TeamIndex < 0 || TeamIndex >= GAMEDEFINE.MAX_TEAMS_IN_GROUP)
            {
                pTMInfo = null;
                return;
            }

            ++TeamIndex;         // 默认传入的数字为 0 ~ MAX_TEAMS_IN_GROUP-1

            TeamInfo pTeamInfo = GetTeam(TeamIndex);

            if (pTeamInfo != null)
            {
                if (pTeamInfo.m_TeamMembers.Count >= GAMEDEFINE.MAX_TEAM_MEMBER)
                {
                    pTMInfo = null;
                    return;
                }
            }
            else
            {         // 如果该小组不存在,则创建,并添加入团队
                pTeamInfo          = new TeamInfo();
                pTeamInfo.m_TeamID = TeamIndex;
                m_TeamInfo.Add(pTeamInfo);

                //队伍满
                if (pTeamInfo.m_TeamMembers.Count >= GAMEDEFINE.MAX_TEAM_MEMBER)
                {
                    CObjectManager.Instance.getPlayerMySelf().GetCharacterData().Set_TeamFullFlag(true);
                }
            }

            pTeamInfo.m_TeamMembers.Add(pTMInfo);

            if (pTMInfo.m_GUID == pObj.GetServerGUID())
            {
                m_MyTeamID = TeamIndex;
            }
        }
        break;

        default:
            return;
        }

        if (pTMInfo.m_GUID != pObj.GetServerGUID())
        { // 需要加载队友的头像窗口
            // 请求该队友的数据
            CGAskTeamMemberInfo Msg = new CGAskTeamMemberInfo();
            Msg.SceneID = pTMInfo.m_SceneID;
            Msg.ObjID   = (uint)pTMInfo.m_OjbID;
            Msg.GUID    = pTMInfo.m_GUID;

            NetManager.GetNetManager().SendPacket(Msg);
        }
        else
        {
            FillMyInfo(pTMInfo);
        }

        //// 创建一个界面的模型.
        //pTMInfo.m_UIModel.CreateNewUIModel();
        //// 设置ui模型
        //// 设置性别
        //pTMInfo.m_UIModel.m_pAvatar.GetCharacterData().Set_RaceID(pTMInfo.m_uDataID);
    }