Exemplo n.º 1
0
        public void RequireJump(UnityEngine.Vector3 pos)
        {
            NFMsg.ReqAckPlayerMove xData = new NFMsg.ReqAckPlayerMove();
            xData.mover    = mHelpModule.NFToPB(mRoleID);
            xData.moveType = 1;
            xData.speed    = 2f;
            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);
        }
Exemplo n.º 2
0
        public void SendToServerByPB(NFMsg.EGameMsgID unMsgID, MemoryStream stream)
        {
            NFMsg.MsgBase xData = new NFMsg.MsgBase();
            xData.player_id = mHelpModule.NFToPB(mOwnerID);
            xData.msg_data  = ByteString.AttachBytes(stream.ToArray());

            MemoryStream body = new MemoryStream();

            xData.WriteTo(body);

            MemoryStream pack   = new MemoryStream();
            BinaryWriter writer = new BinaryWriter(pack);
            UInt32       msgLen = (UInt32)body.Length + (UInt32)ConstDefine.NF_PACKET_HEAD_SIZE;

            writer.Write(NFCNet.ConvertUint16((UInt16)unMsgID));
            writer.Write(NFCNet.ConvertUint32((UInt32)msgLen));
            body.WriteTo(pack);

            NFCNet.Instance().sendMsg(pack);
        }