Esempio n. 1
0
        private NetGameObjectData(ByteBuffer buffer)
        {
            using (SafeUnwrapByteBuffer.Get(buffer, this.GetError))
            {
                this.gameObjectInstanceID = buffer.ReadInt32();
                this.tag      = buffer.ReadUnicodeString();
                this.layer    = buffer.ReadInt32();
                this.isStatic = buffer.ReadBoolean();

                int length = buffer.ReadInt32();

                this.components = new NetComponent[length];

                for (int i = 0; i < length; i++)
                {
                    try
                    {
                        this.components[i] = NetComponent.Deserialize(buffer);
                    }
                    catch (Exception ex)
                    {
                        InternalNGDebug.LogException("GameObject failed on Component " + (i + 1) + "/" + length + ".", ex);
                        throw;
                    }
                }
            }
        }
Esempio n. 2
0
        public static void      Serialize(ByteBuffer buffer, ServerGameObject NGGameObject)
        {
            using (SafeWrapByteBuffer.Get(buffer))
            {
                NGGameObject.ProcessComponents();

                buffer.Append(NGGameObject.instanceID);
                buffer.AppendUnicodeString(NGGameObject.gameObject.tag);
                buffer.Append(NGGameObject.gameObject.layer);
                buffer.Append(NGGameObject.gameObject.isStatic);
                buffer.Append(NGGameObject.components.Count);

                for (int i = NGGameObject.components.Count - 1; i >= 0; --i)
                {
                    try
                    {
                        NetComponent.Serialize(buffer, NGGameObject.components[i]);
                    }
                    catch (Exception ex)
                    {
                        InternalNGDebug.LogException("GameObject \"" + NGGameObject.gameObject.name + "\" failed on Component \"" + NGGameObject.components[i].component.name + "\" (" + (i + 1) + "/" + NGGameObject.components.Count + ").", ex);
                        throw;
                    }
                }
            }
        }
 public override void    In(ByteBuffer buffer)
 {
     if (this.InResponseStatus(buffer) == true)
     {
         this.gameObjectInstanceID = buffer.ReadInt32();
         this.component            = NetComponent.Deserialize(buffer);
     }
 }
 public override void    Out(ByteBuffer buffer)
 {
     if (this.OutResponseStatus(buffer) == true)
     {
         buffer.Append(this.gameObjectInstanceID);
         NetComponent.Serialize(buffer, this.serverComponent);
     }
 }
Esempio n. 5
0
 public override void    In(ByteBuffer buffer)
 {
     this.networkId            = buffer.ReadInt32();
     this.gameObjectInstanceID = buffer.ReadInt32();
     this.component            = NetComponent.Deserialize(buffer);
 }
Esempio n. 6
0
 public override void    Out(ByteBuffer buffer)
 {
     buffer.Append(this.networkId);
     buffer.Append(this.gameObjectInstanceID);
     NetComponent.Serialize(buffer, this.serverComponent);
 }