Inheritance: global::ProtoBuf.IExtensible
コード例 #1
0
        private void EGMI_ACK_PROPERTY_VECTOR3(int id, MemoryStream stream)
        {
            NFMsg.MsgBase xMsg = NFMsg.MsgBase.Parser.ParseFrom(stream);

            NFMsg.ObjectPropertyVector3 xData = NFMsg.ObjectPropertyVector3.Parser.ParseFrom(xMsg.MsgData);

            NFIObject go = mKernelModule.GetObject(mHelpModule.PBToNF(xData.PlayerId));

            if (go == null)
            {
                Debug.LogError("error id" + xData.PlayerId);
                return;
            }

            NFIPropertyManager propertyManager = go.GetPropertyManager();

            for (int i = 0; i < xData.PropertyList.Count; i++)
            {
                string        name = xData.PropertyList[i].PropertyName.ToStringUtf8();
                NFMsg.Vector3 data = xData.PropertyList[i].Data;

                NFIProperty property = propertyManager.GetProperty(name);
                if (null == property)
                {
                    NFDataList.TData var = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_VECTOR3);
                    property = propertyManager.AddProperty(name, var);
                }

                property.SetVector3(mHelpModule.PBToNF(data));
            }
        }
コード例 #2
0
        //WSAD移动
        public void RequireMove(NFrame.NFGUID objectID, int nType, float fPosX, float fPosY, float fTarX, float fTarY)
        {
            NFMsg.ReqAckPlayerMove xData = new NFMsg.ReqAckPlayerMove();
            xData.mover    = NFNetController.NFToPB(objectID);
            xData.moveType = nType;

            NFMsg.Vector3 xNowPos = new NFMsg.Vector3();
            xNowPos.x = fPosX;
            xNowPos.y = 0.0f;
            xNowPos.z = fPosY;
            xData.source_pos.Add(xNowPos);

            NFMsg.Vector3 xTargetPos = new NFMsg.Vector3();
            xTargetPos.x = fTarX;
            xTargetPos.y = 0.0f;
            xTargetPos.z = fTarY;
            xData.target_pos.Add(xTargetPos);

            mxBody.SetLength(0);
            mxSerializer.Serialize(mxBody, xData);

            SendMsg(objectID, NFMsg.EGameMsgID.EGMI_REQ_MOVE, mxBody);

            //为了表现,客户端先走,后续同步
        }
コード例 #3
0
        //WSAD移动
        public void RequireMove(NFrame.NFGUID objectID, int nType, UnityEngine.Vector3 vPos, UnityEngine.Vector3 vTar)
        {
            NFMsg.ReqAckPlayerMove xData = new NFMsg.ReqAckPlayerMove();
            xData.mover    = NFNetController.NFToPB(objectID);
            xData.moveType = nType;

            NFMsg.Vector3 xNowPos = new NFMsg.Vector3();
            xNowPos.x = vPos.x;
            xNowPos.y = vPos.y;
            xNowPos.z = vPos.z;
            xData.source_pos.Add(xNowPos);

            NFMsg.Vector3 xTargetPos = new NFMsg.Vector3();
            xTargetPos.x = vTar.x;
            xTargetPos.y = vTar.y;
            xTargetPos.z = vTar.z;
            xData.target_pos.Add(xTargetPos);

            mxBody.SetLength(0);
            mxSerializer.Serialize(mxBody, xData);

            SendMsg(objectID, NFMsg.EGameMsgID.EGMI_REQ_MOVE, mxBody);

            //为了表现,客户端先走,后续同步
        }
コード例 #4
0
    static public NFMsg.Vector3 NFToPB(NFVector3 value)
    {
        NFMsg.Vector3 vector = new NFMsg.Vector3();
        vector.x = value.X();
        vector.y = value.Y();
        vector.z = value.Z();

        return(vector);
    }
コード例 #5
0
        public void RequireMoveImmune(NFrame.NFGUID objectID, float fX, float fZ)
        {
            NFMsg.ReqAckPlayerMove xData = new NFMsg.ReqAckPlayerMove();
            xData.mover    = NFNetController.NFToPB(objectID);
            xData.moveType = 0;
            NFMsg.Vector3 xTargetPos = new NFMsg.Vector3();
            xTargetPos.x = fX;
            xTargetPos.z = fZ;
            xData.target_pos.Add(xTargetPos);

            mxBody.SetLength(0);
            mxSerializer.Serialize(mxBody, xData);


            SendMsg(objectID, NFMsg.EGameMsgID.EGMI_REQ_MOVE_IMMUNE, mxBody);
        }
コード例 #6
0
        public void RequireMove(UnityEngine.Vector3 pos)
        {
            NFMsg.ReqAckPlayerMove xData = new NFMsg.ReqAckPlayerMove();
            xData.mover    = mHelpModule.NFToPB(mRoleID);
            xData.moveType = 0;
            xData.speed    = 4f;
            xData.time     = 0;
            NFMsg.Vector3 xTargetPos = new NFMsg.Vector3();
            xTargetPos.x = pos.x;
            xTargetPos.y = pos.y;
            xTargetPos.z = pos.z;
            xData.target_pos.Add(xTargetPos);

            MemoryStream stream = new MemoryStream();

            xData.WriteTo(stream);

            mNetModule.SendToServerByPB(NFMsg.EGameMsgID.EGMI_REQ_MOVE, stream);
        }
コード例 #7
0
        public void RequireMove(UnityEngine.Vector3 pos)
        {
            NFMsg.ReqAckPlayerMove xData = new NFMsg.ReqAckPlayerMove();
            xData.mover    = NFToPB(mRoleID);
            xData.moveType = 0;
            xData.speed    = 2f;
            xData.time     = 0;
            NFMsg.Vector3 xTargetPos = new NFMsg.Vector3();
            xTargetPos.x = pos.x;
            xTargetPos.y = pos.z;
            xTargetPos.z = pos.y;
            xData.target_pos.Add(xTargetPos);

            MemoryStream stream = new MemoryStream();

            Serializer.Serialize <NFMsg.ReqAckPlayerMove>(stream, xData);

            NFCNetLogic.Instance().SendToServerByPB(NFMsg.EGameMsgID.EGMI_REQ_MOVE, stream);
        }
コード例 #8
0
    static public NFMsg.Vector3 NFToPB(NFVector3 value)
    {
        NFMsg.Vector3 vector = new NFMsg.Vector3();
        vector.x = value.X();
        vector.y = value.Y();
        vector.z = value.Z();

        return vector;
    }