Esempio n. 1
0
 //根据美术提供的参数设置人物位置和朝向
 public static void setLoginPlayerTransform(CObject_PlayerOther player)
 {
     if (player != null)
     {
         player.SetPosition(new Vector3(27.41f, 3.37f, 6.48f));
         player.SetFaceDir((216.02f) * Mathf.Deg2Rad);
     }
 }
 // 删除ui模型
 public void DestroyUIModel()
 {
     if (m_pAvatar != null)
     {
         CObjectManager.Instance.DestroyObject(m_pAvatar);
     }
     m_pAvatar = null;
 }
Esempio n. 3
0
 CObject_PlayerOther m_pAvatar;//用于在UI显示
 public override void Initial(object pInit)
 {
     //解决部分情况下默认技能丢失的问题
     SetActiveSkill(null);
     base.Initial(pInit);
     SetFaceDir(3.1416f);                                      //初始创建的玩家朝向x轴
     m_pAvatar = CObjectManager.Instance.NewFakePlayerOther(); //创建用于UI显示的人物
 }
 // 创建新的模型
 public void CreateNewUIModel()
 {
     if (m_pAvatar != null)
     {
         DestroyUIModel();
     }
     m_pAvatar = CObjectManager.Instance.NewFakePlayerOther();
     m_pAvatar.Disalbe((uint)ObjectStatusFlags.OSF_VISIABLE);
 }
Esempio n. 5
0
    public CObject_PlayerOther NewFakePlayerOther()
    {
        CObject_PlayerOther newFakePlayerOther = new CObject_PlayerOther();

        newFakePlayerOther.ServerID = -1;
        newFakePlayerOther.SetFakeObjectFlag(true);
        newFakePlayerOther.Initial(null);
        newFakePlayerOther.SetPosition(new Vector3(0, 0, 0));
        return(newFakePlayerOther);
    }
Esempio n. 6
0
    //创建其他玩家
    public CObject_PlayerOther NewPlayerOther(int idServer)
    {
        if (mServerObjects.ContainsKey(idServer))
        {
            return((CObject_PlayerOther)mServerObjects[idServer]);
        }
        CObject_PlayerOther playerOther = new CObject_PlayerOther();

        add(playerOther, idServer);
        mPlayerOther.AddChild(playerOther);
        return(playerOther);
    }
Esempio n. 7
0
        public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer)
        {
            if (GameProcedure.GetActiveProcedure() == GameProcedure.s_ProcMain)
            {
                LogManager.Log("RECV GCNewPlayer_Death");
            }
            //当前流程是主流程
            if (GameProcedure.GetActiveProcedure() == (GameProcedure)GameProcedure.s_ProcMain)
            {
                GCNewPlayer_Death newPlayerPacket = (GCNewPlayer_Death)pPacket;
                CObjectManager    pObjectManager  = GameProcedure.s_pObjectManager;
                ////检查位置是否合法
                //if(!CWorldManager::GetMe().GetActiveScene().IsValidPosition(fVector2(newPlayerPacket.getWorldPos().m_fX, newPlayerPacket.getWorldPos().m_fZ)))
                //{
                //    TDThrow("ERROR POSITION @ GCNewMonsterHandler");
                //}

                //创建玩家
                CObject_PlayerOther pOther = (CObject_PlayerOther)pObjectManager.FindServerObject((int)newPlayerPacket.ObjectID);

                if (pOther == null)
                {
                    pOther = pObjectManager.NewPlayerOther((int)newPlayerPacket.ObjectID);
                    pOther.Initial(null);
                }
                else
                {
                    // pOther.Enable( OSF_VISIABLE );
                    // pOther.Disalbe( OSF_OUT_VISUAL_FIELD );
                }
                //设置怪物位置和面向
                pOther.SetMapPosition(newPlayerPacket.Position.m_fX, newPlayerPacket.Position.m_fZ);

                pOther.SetFaceDir(newPlayerPacket.Dir);

                //更新装备信息
                pOther.GetCharacterData().Set_EquipVer(newPlayerPacket.EquipVer);
                pOther.GetCharacterData().Set_MoveSpeed(newPlayerPacket.MoveSpeed);

                SCommand_Object cmdTemp = new SCommand_Object();
                cmdTemp.m_wID = (int)OBJECTCOMMANDDEF.OC_DEATH;
                cmdTemp.SetValue <bool>(0, false);
                pOther.PushCommand(cmdTemp);

                //放入Ask队列
                pObjectManager.LoadQueue.TryAddLoadTask(pOther.ID);
                //pObjectManager.GetLoadQueue().TryAddLoadTask(pOther.GetID(), CObject_Character::CT_MONSTER);

                //此版不做服务器繁忙客户端延后发消息的处理
                //              CGCharAskBaseAttrib msgAskBaseAttrib = new CGCharAskBaseAttrib();
                //              msgAskBaseAttrib.setTargetID( (uint)newPlayerPacket.ObjectID);
                //              GameProcedure.s_NetManager.SendPacket(msgAskBaseAttrib );

                //              char szTemp[MAX_PATH];
                //              _snprintf(szTemp, MAX_PATH, "GCNewMonster(%.1f,%.1f)",
                //                  newPlayerPacket.getWorldPos().m_fX, newPlayerPacket.getWorldPos().m_fZ);
                //              pOther.PushDebugString(szTemp);
                pOther.SetMsgTime(GameProcedure.s_pTimeSystem.GetTimeNow());
            }
            return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE);
        }
Esempio n. 8
0
 public override void Release()
 {
     base.Release();
     CObjectManager.Instance.DestroyObject(m_pAvatar);
     m_pAvatar = null;
 }