Beispiel #1
0
 public override void Write(NetBuffer msg)
 {
     msg.Write(netId);
     msg.Write(sceneId);
     msg.Write(assetId);
     NetSerialize.Write(msg, objectState);
 }
Beispiel #2
0
 public override void Read(NetBuffer m)
 {
     netid             = m.ReadUInt64();
     netComponentId    = m.ReadByte();
     originalMessageId = m.ReadInt32();
     messageData       = NetSerialize.ReadBytes(m);
 }
Beispiel #3
0
 public override void Read(NetBuffer msg)
 {
     netId       = msg.ReadUInt64();
     sceneId     = msg.ReadUInt64();
     assetId     = msg.ReadUInt64();
     objectState = NetSerialize.ReadBytes(msg);
 }
Beispiel #4
0
 public override void Write(NetBuffer m)
 {
     m.Write(netid);
     m.Write(netComponentId);
     m.Write(originalMessageId);
     NetSerialize.Write(m, messageData);
 }
Beispiel #5
0
        public static void WriteVectorArray(NetBuffer buffer, Vector3[] objectState)
        {
            if (objectState != null && objectState.Length > 0)
            {
                buffer.Write(objectState.Length);

                foreach (Vector3 f in objectState)
                {
                    NetSerialize.Write(buffer, f);
                }
            }
            else
            {
                buffer.Write((int)0);
            }
        }
Beispiel #6
0
        public static Vector3[] ReadVectorArray(NetBuffer buffer)
        {
            Vector3[] data = null;

            int len = buffer.ReadInt32();

            if (len > 0)
            {
                data = new Vector3[len];

                for (int i = 0; i < len; i++)
                {
                    data[i] = NetSerialize.ReadVector3(buffer);
                }
            }

            return(data);
        }
        internal void Deserialize(NetBuffer msg, bool initialState)
        {
            if (initialState)
            {
                precomputedAssetId = msg.ReadUInt64();
                sceneId            = msg.ReadUInt64();
                ownerId            = msg.ReadUInt64();
                netId = msg.ReadUInt64();

                transform.position = NetSerialize.ReadVector3(msg);
                transform.rotation = NetSerialize.ReadQuaternion(msg);
            }

            foreach (UNetworkBehaviour comp in cachedBehaviours)
            {
                comp.Deserialize(msg, initialState);
            }
        }
        internal void Serialize(NetBuffer msg, bool initialState)
        {
            if (initialState)
            {
                msg.Write(precomputedAssetId);
                msg.Write(sceneId);
                msg.Write(ownerId);
                msg.Write(netId);

                NetSerialize.Write(msg, transform.position);
                NetSerialize.Write(msg, transform.rotation);
            }

            foreach (UNetworkBehaviour comp in cachedBehaviours)
            {
                comp.Serialize(msg, initialState);
            }
        }
Beispiel #9
0
 public override void Write(NetBuffer msgOut)
 {
     msgOut.Write(targetNetID);
     msgOut.Write(netComponentId);
     NetSerialize.Write(msgOut, data);
 }
Beispiel #10
0
 public override void Read(NetBuffer msgIn)
 {
     targetNetID    = msgIn.ReadUInt64();
     netComponentId = msgIn.ReadByte();
     data           = NetSerialize.ReadBytes(msgIn);
 }
 public override void Deserialize(NetBuffer msg, bool initialState)
 {
     movePos = NetSerialize.ReadVector3(msg);
     moveRot = NetSerialize.ReadQuaternion(msg);
 }
 public override void Serialize(NetBuffer msg, bool initialState)
 {
     NetSerialize.Write(msg, transform.position);
     NetSerialize.Write(msg, transform.rotation);
 }