Inheritance: global::ProtoBuf.IExtensible
Esempio n. 1
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);

            //为了表现,客户端先走,后续同步
        }
Esempio n. 2
0
        private void OnObjectMove(UInt16 id, MemoryStream stream)
        {
            NFMsg.MsgBase xMsg = NFMsg.MsgBase.Parser.ParseFrom(stream);

            NFMsg.ReqAckPlayerMove xData = NFMsg.ReqAckPlayerMove.Parser.ParseFrom(xMsg.msg_data);
            if (xData.target_pos.Count <= 0)
            {
                return;
            }

            NFGUID mover  = mHelpModule.PBToNF(xData.mover);
            float  fSpeed = mKernelModule.QueryPropertyInt(mover, NFrame.Player.MOVE_SPEED) / 100.0f;

            NFDataList var = new NFDataList();

            var.AddObject(mHelpModule.PBToNF(xData.mover));
            var.AddFloat(fSpeed);
            var.AddInt(xData.moveType);

            NFVector3 pos = mHelpModule.PBToNF(xData.target_pos[0]);

            var.AddVector3(pos);

            mEventModule.DoEvent((int)Event.PlayerMove, var);
        }
Esempio n. 3
0
        private void OnObjectMove(UInt16 id, MemoryStream stream)
        {
            NFMsg.MsgBase xMsg = new NFMsg.MsgBase();
            xMsg = Serializer.Deserialize <NFMsg.MsgBase>(stream);

            NFMsg.ReqAckPlayerMove xData = new NFMsg.ReqAckPlayerMove();
            xData = Serializer.Deserialize <NFMsg.ReqAckPlayerMove>(new MemoryStream(xMsg.msg_data));
            if (xData.target_pos.Count <= 0)
            {
                return;
            }
            float fSpeed = NFCKernelModule.Instance().QueryPropertyInt(PBToNF(xData.mover), "MOVE_SPEED") / 10000.0f;

            Debug.LogWarning("Object Move: " + PBToNF(xData.mover).ToString());
            NFIDataList var = new NFCDataList();

            var.AddObject(PBToNF(xData.mover));
            var.AddFloat(fSpeed);
            NFVector3 pos   = PBToNF(xData.target_pos[0]);
            float     fTemp = pos.Z();

            pos.SetZ(pos.Y());
            pos.SetY(fTemp);
            var.AddVector3(pos);

            DoEvent((int)Event.PlayerMove, var);
        }
Esempio n. 4
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);

            //为了表现,客户端先走,后续同步
        }
Esempio n. 5
0
    public void RequireMoveImmune(NFCoreEx.NFIDENTID objectID, float fX, float fZ)
    {
        NFMsg.ReqAckPlayerMove xData = new NFMsg.ReqAckPlayerMove();
        xData.mover    = NFToPB(objectID);
        xData.moveType = 0;
        NFMsg.Position xTargetPos = new NFMsg.Position();
        xTargetPos.x = fX;
        xTargetPos.z = fZ;
        xData.target_pos.Add(xTargetPos);

        MemoryStream stream = new MemoryStream();

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

        SendMsg(objectID, NFMsg.EGameMsgID.EGMI_REQ_MOVE_IMMUNE, stream);

        if (NFStart.Instance.bDebugMode)
        {
            NFMsg.MsgBase xAckData = new NFMsg.MsgBase();
            xAckData.player_id = xData.mover;
            xAckData.msg_data  = stream.ToArray();

            MemoryStream xAckBody = new MemoryStream();
            Serializer.Serialize <NFMsg.MsgBase>(xAckBody, xAckData);

            MsgHead head = new MsgHead();
            head.unMsgID   = (UInt16)NFMsg.EGameMsgID.EGMI_ACK_MOVE_IMMUNE;
            head.unDataLen = (UInt32)xAckBody.Length + (UInt32)ConstDefine.NF_PACKET_HEAD_SIZE;

            xNet.mxBinMsgEvent.OnMessageEvent(head, xAckBody.ToArray());
        }
    }
Esempio n. 6
0
        //申请状态机同步
        public void RequireStateSync(NFrame.NFGUID objectID, NFMsg.ReqAckPlayerMove xData)
        {
            mxBody.SetLength(0);
            mxSerializer.Serialize(mxBody, xData);


            SendMsg(objectID, NFMsg.EGameMsgID.EGMI_REQ_STATE_SYNC, mxBody);
        }
Esempio n. 7
0
        //////////////////////////////////
        ///
        private void EGMI_ACK_MOVE(NFMsg.MsgBase xMsg)
        {
            NFMsg.ReqAckPlayerMove xData = new NFMsg.ReqAckPlayerMove();
            xData = mxSerializer.Deserialize(new MemoryStream(xMsg.msg_data), null, typeof(NFMsg.ReqAckPlayerMove)) as NFMsg.ReqAckPlayerMove;

            if (xData.target_pos.Count <= 0)
            {
                return;
            }

            float fSpeed = NFCKernelModule.Instance.QueryPropertyInt(NFNetController.PBToNF(xData.mover), "MOVE_SPEED") / 10000.0f;
            //NFRender.Instance.MoveTo(PBToNF(xData.mover), new Vector3(xData.target_pos[0].x, xData.target_pos[0].y, xData.target_pos[0].z), fSpeed, true);
        }
Esempio n. 8
0
        private void EGMI_ACK_MOVE(MsgHead head, MemoryStream stream)
        {
            NFMsg.MsgBase xMsg = new NFMsg.MsgBase();
            xMsg = Serializer.Deserialize <NFMsg.MsgBase>(stream);

            NFMsg.ReqAckPlayerMove xData = new NFMsg.ReqAckPlayerMove();
            xData = Serializer.Deserialize <NFMsg.ReqAckPlayerMove>(new MemoryStream(xMsg.msg_data));
            if (xData.target_pos.Count <= 0)
            {
                return;
            }
            float fSpeed = NFCKernel.Instance.QueryPropertyInt(PBToNF(xData.mover), "MOVE_SPEED") / 10000.0f;
            //NFCRenderInterface.Instance.MoveTo(PBToNF(xData.mover), new Vector3(xData.target_pos[0].x, xData.target_pos[0].y, xData.target_pos[0].z), fSpeed, true);
        }
Esempio n. 9
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);
        }
    public void RequireMoveImmune(NFrame.NFGUID objectID, float fX, float fZ)
    {
        NFMsg.ReqAckPlayerMove xData = new NFMsg.ReqAckPlayerMove();
        xData.mover    = NFToPB(objectID);
        xData.moveType = 0;
        NFMsg.Position xTargetPos = new NFMsg.Position();
        xTargetPos.x = fX;
        xTargetPos.z = fZ;
        xData.target_pos.Add(xTargetPos);

        MemoryStream stream = new MemoryStream();

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

        SendMsg(objectID, NFMsg.EGameMsgID.EGMI_REQ_MOVE_IMMUNE, stream);
    }
Esempio n. 11
0
        private void EGMI_ACK_STATE_SYNC(NFMsg.MsgBase xMsg)
        {
            NFMsg.ReqAckPlayerMove xData = new NFMsg.ReqAckPlayerMove();
            xData = mxSerializer.Deserialize(new MemoryStream(xMsg.msg_data), null, typeof(NFMsg.ReqAckPlayerMove)) as NFMsg.ReqAckPlayerMove;

            if (xData.target_pos.Count <= 0)
            {
                return;
            }

            NFGUID    xGUID   = NFNetController.PBToNF(xData.mover);
            NFIObject xObject = NFCKernelModule.Instance.GetObject(xGUID);

            if (xObject != null)
            {
            }
        }
Esempio n. 12
0
        public void RequireMove(UnityEngine.Vector3 pos)
        {
            NFMsg.ReqAckPlayerMove xData = new NFMsg.ReqAckPlayerMove();
            xData.mover    = NFToPB(mRoleID);
            xData.moveType = 0;
            NFMsg.Position xTargetPos = new NFMsg.Position();
            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);
        }
Esempio n. 13
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);
        }
Esempio n. 14
0
        private void OnObjectJump(UInt16 id, MemoryStream stream)
        {
            NFMsg.MsgBase xMsg = new NFMsg.MsgBase();
            xMsg = Serializer.Deserialize <NFMsg.MsgBase>(stream);

            NFMsg.ReqAckPlayerMove xData = new NFMsg.ReqAckPlayerMove();
            xData = Serializer.Deserialize <NFMsg.ReqAckPlayerMove>(new MemoryStream(xMsg.msg_data));
            if (xData.target_pos.Count <= 0)
            {
                return;
            }
            float fSpeed = NFCKernelModule.Instance().QueryPropertyInt(PBToNF(xData.mover), "MOVE_SPEED") / 10000.0f;

            NFIDataList var = new NFCDataList();

            var.AddObject(PBToNF(xData.mover));
            var.AddFloat(fSpeed);
            var.AddVector3(PBToNF(xData.target_pos[0]));
            DoEvent((int)Event.PlayerJump, var);
        }
Esempio n. 15
0
        private void OnObjectJump(UInt16 id, MemoryStream stream)
        {
            NFMsg.MsgBase xMsg = NFMsg.MsgBase.Parser.ParseFrom(stream);

            NFMsg.ReqAckPlayerMove xData = NFMsg.ReqAckPlayerMove.Parser.ParseFrom(xMsg.msg_data);
            if (xData.target_pos.Count <= 0)
            {
                return;
            }
            float fSpeed = mKernelModule.QueryPropertyInt(mHelpModule.PBToNF(xData.mover), "MOVE_SPEED") / 100.0f;

            NFDataList var = new NFDataList();

            var.AddObject(mHelpModule.PBToNF(xData.mover));
            var.AddFloat(fSpeed);
            var.AddVector3(mHelpModule.PBToNF(xData.target_pos[0]));

            mEventModule.DoEvent((int)Event.PlayerJump, var);
            //DoEvent((int)Event.PlayerJump, var);
        }
Esempio n. 16
0
        private void EGMI_ACK_MOVE_IMMUNE(MsgHead head, MemoryStream stream)
        {
            NFMsg.MsgBase xMsg = new NFMsg.MsgBase();
            xMsg = Serializer.Deserialize<NFMsg.MsgBase>(stream);

            NFMsg.ReqAckPlayerMove xData = new NFMsg.ReqAckPlayerMove();
            xData = Serializer.Deserialize<NFMsg.ReqAckPlayerMove>(new MemoryStream(xMsg.msg_data));
            if (xData.target_pos.Count <= 0)
            {
                return;
            }

            //其实就是jump
            float fSpeed = NFCKernelModule.Instance.QueryPropertyInt(PBToNF(xData.mover), "MOVE_SPEED") / 10000.0f;
            fSpeed *= 1.5f;

            //NFCRenderInterface.Instance.MoveImmuneBySpeed(PBToNF(xData.mover), new Vector3(xData.target_pos[0].x, xData.target_pos[0].y, xData.target_pos[0].z), fSpeed, true);

        }
    public void RequireMoveImmune(NFCoreEx.NFIDENTID objectID, float fX, float fZ)
    {
        NFMsg.ReqAckPlayerMove xData = new NFMsg.ReqAckPlayerMove();
        xData.mover = NFToPB(objectID);
        xData.moveType = 0;
        NFMsg.Position xTargetPos = new NFMsg.Position();
        xTargetPos.x = fX;
        xTargetPos.z = fZ;
        xData.target_pos.Add(xTargetPos);

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

        SendMsg(objectID, NFMsg.EGameMsgID.EGMI_REQ_MOVE_IMMUNE, stream);
    }
Esempio n. 18
0
    public void RequireMoveImmune(NFCoreEx.NFIDENTID objectID, float fX, float fZ)
    {
        NFMsg.ReqAckPlayerMove xData = new NFMsg.ReqAckPlayerMove();
        xData.mover = NFToPB(objectID);
        xData.moveType = 0;
        NFMsg.Position xTargetPos = new NFMsg.Position();
        xTargetPos.x = fX;
        xTargetPos.z = fZ;
        xData.target_pos.Add(xTargetPos);

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

        SendMsg(objectID, NFMsg.EGameMsgID.EGMI_REQ_MOVE_IMMUNE, stream);

        if (NFStart.Instance.bDebugMode)
        {
            NFMsg.MsgBase xAckData = new NFMsg.MsgBase();
            xAckData.player_id = xData.mover;
            xAckData.msg_data = stream.ToArray();

            MemoryStream xAckBody = new MemoryStream();
            Serializer.Serialize<NFMsg.MsgBase>(xAckBody, xAckData);

            MsgHead head = new MsgHead();
            head.unMsgID = (UInt16)NFMsg.EGameMsgID.EGMI_ACK_MOVE_IMMUNE;
            head.unDataLen = (UInt32)xAckBody.Length + (UInt32)ConstDefine.NF_PACKET_HEAD_SIZE;

            xNet.mxBinMsgEvent.OnMessageEvent(head, xAckBody.ToArray());

        }
    }