Ejemplo n.º 1
0
        public static MCollider Clone(this MCollider original)
        {
            MCollider clone = new MCollider()
            {
                Type = original.Type,
                BoxColliderProperties      = original.BoxColliderProperties,
                SphereColliderProperties   = original.SphereColliderProperties,
                CapsuleColliderProperties  = original.CapsuleColliderProperties,
                MeshColliderProperties     = original.MeshColliderProperties,
                ConeColliderProperties     = original.ConeColliderProperties,
                CylinderColliderProperties = original.CylinderColliderProperties,
                ID = original.ID,
                //To do
                Colliders      = original.Colliders,
                PositionOffset = original.PositionOffset.Clone(),
                RotationOffset = original.RotationOffset.Clone(),
                Properties     = original.Properties.Clone()
            };

            return(clone);
        }
Ejemplo n.º 2
0
        public void Read(TProtocol iprot)
        {
            iprot.IncrementRecursionDepth();
            try
            {
                bool   isset_ID        = false;
                bool   isset_Name      = false;
                bool   isset_Transform = false;
                TField field;
                iprot.ReadStructBegin();
                while (true)
                {
                    field = iprot.ReadFieldBegin();
                    if (field.Type == TType.Stop)
                    {
                        break;
                    }
                    switch (field.ID)
                    {
                    case 1:
                        if (field.Type == TType.String)
                        {
                            ID       = iprot.ReadString();
                            isset_ID = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.String)
                        {
                            Name       = iprot.ReadString();
                            isset_Name = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 3:
                        if (field.Type == TType.Struct)
                        {
                            Transform = new MMIStandard.MTransform();
                            Transform.Read(iprot);
                            isset_Transform = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 4:
                        if (field.Type == TType.Struct)
                        {
                            Collider = new MCollider();
                            Collider.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 5:
                        if (field.Type == TType.Struct)
                        {
                            Mesh = new MMesh();
                            Mesh.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 6:
                        if (field.Type == TType.Struct)
                        {
                            PhysicsProperties = new MPhysicsProperties();
                            PhysicsProperties.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 8:
                        if (field.Type == TType.Map)
                        {
                            {
                                Properties = new Dictionary <string, string>();
                                TMap _map113 = iprot.ReadMapBegin();
                                for (int _i114 = 0; _i114 < _map113.Count; ++_i114)
                                {
                                    string _key115;
                                    string _val116;
                                    _key115             = iprot.ReadString();
                                    _val116             = iprot.ReadString();
                                    Properties[_key115] = _val116;
                                }
                                iprot.ReadMapEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 9:
                        if (field.Type == TType.List)
                        {
                            {
                                Attachments = new List <MAttachment>();
                                TList _list117 = iprot.ReadListBegin();
                                for (int _i118 = 0; _i118 < _list117.Count; ++_i118)
                                {
                                    MAttachment _elem119;
                                    _elem119 = new MAttachment();
                                    _elem119.Read(iprot);
                                    Attachments.Add(_elem119);
                                }
                                iprot.ReadListEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 10:
                        if (field.Type == TType.List)
                        {
                            {
                                Constraints = new List <MMIStandard.MConstraint>();
                                TList _list120 = iprot.ReadListBegin();
                                for (int _i121 = 0; _i121 < _list120.Count; ++_i121)
                                {
                                    MMIStandard.MConstraint _elem122;
                                    _elem122 = new MMIStandard.MConstraint();
                                    _elem122.Read(iprot);
                                    Constraints.Add(_elem122);
                                }
                                iprot.ReadListEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    default:
                        TProtocolUtil.Skip(iprot, field.Type);
                        break;
                    }
                    iprot.ReadFieldEnd();
                }
                iprot.ReadStructEnd();
                if (!isset_ID)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA, "required field ID not set");
                }
                if (!isset_Name)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA, "required field Name not set");
                }
                if (!isset_Transform)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA, "required field Transform not set");
                }
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }
Ejemplo n.º 3
0
        public void Read(TProtocol iprot)
        {
            iprot.IncrementRecursionDepth();
            try
            {
                bool   isset_ID = false;
                TField field;
                iprot.ReadStructBegin();
                while (true)
                {
                    field = iprot.ReadFieldBegin();
                    if (field.Type == TType.Stop)
                    {
                        break;
                    }
                    switch (field.ID)
                    {
                    case 1:
                        if (field.Type == TType.String)
                        {
                            ID       = iprot.ReadString();
                            isset_ID = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.String)
                        {
                            Name = iprot.ReadString();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 3:
                        if (field.Type == TType.Struct)
                        {
                            Transform = new MTransformUpdate();
                            Transform.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 4:
                        if (field.Type == TType.Struct)
                        {
                            Collider = new MCollider();
                            Collider.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 5:
                        if (field.Type == TType.Struct)
                        {
                            Mesh = new MMesh();
                            Mesh.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 6:
                        if (field.Type == TType.Struct)
                        {
                            PhysicsProperties = new MPhysicsProperties();
                            PhysicsProperties.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 7:
                        if (field.Type == TType.List)
                        {
                            {
                                HandPoses = new List <MMIStandard.MHandPose>();
                                TList _list126 = iprot.ReadListBegin();
                                for (int _i127 = 0; _i127 < _list126.Count; ++_i127)
                                {
                                    MMIStandard.MHandPose _elem128;
                                    _elem128 = new MMIStandard.MHandPose();
                                    _elem128.Read(iprot);
                                    HandPoses.Add(_elem128);
                                }
                                iprot.ReadListEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 8:
                        if (field.Type == TType.List)
                        {
                            {
                                Properties = new List <MPropertyUpdate>();
                                TList _list129 = iprot.ReadListBegin();
                                for (int _i130 = 0; _i130 < _list129.Count; ++_i130)
                                {
                                    MPropertyUpdate _elem131;
                                    _elem131 = new MPropertyUpdate();
                                    _elem131.Read(iprot);
                                    Properties.Add(_elem131);
                                }
                                iprot.ReadListEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 9:
                        if (field.Type == TType.List)
                        {
                            {
                                Attachments = new List <MAttachment>();
                                TList _list132 = iprot.ReadListBegin();
                                for (int _i133 = 0; _i133 < _list132.Count; ++_i133)
                                {
                                    MAttachment _elem134;
                                    _elem134 = new MAttachment();
                                    _elem134.Read(iprot);
                                    Attachments.Add(_elem134);
                                }
                                iprot.ReadListEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 10:
                        if (field.Type == TType.List)
                        {
                            {
                                Constraints = new List <MMIStandard.MConstraint>();
                                TList _list135 = iprot.ReadListBegin();
                                for (int _i136 = 0; _i136 < _list135.Count; ++_i136)
                                {
                                    MMIStandard.MConstraint _elem137;
                                    _elem137 = new MMIStandard.MConstraint();
                                    _elem137.Read(iprot);
                                    Constraints.Add(_elem137);
                                }
                                iprot.ReadListEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    default:
                        TProtocolUtil.Skip(iprot, field.Type);
                        break;
                    }
                    iprot.ReadFieldEnd();
                }
                iprot.ReadStructEnd();
                if (!isset_ID)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA, "required field ID not set");
                }
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }
Ejemplo n.º 4
0
        public void Read(TProtocol iprot)
        {
            iprot.IncrementRecursionDepth();
            try
            {
                bool   isset_ID   = false;
                bool   isset_Type = false;
                TField field;
                iprot.ReadStructBegin();
                while (true)
                {
                    field = iprot.ReadFieldBegin();
                    if (field.Type == TType.Stop)
                    {
                        break;
                    }
                    switch (field.ID)
                    {
                    case 1:
                        if (field.Type == TType.String)
                        {
                            ID       = iprot.ReadString();
                            isset_ID = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.I32)
                        {
                            Type       = (MColliderType)iprot.ReadI32();
                            isset_Type = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 3:
                        if (field.Type == TType.Struct)
                        {
                            BoxColliderProperties = new MBoxColliderProperties();
                            BoxColliderProperties.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 4:
                        if (field.Type == TType.Struct)
                        {
                            SphereColliderProperties = new MSphereColliderProperties();
                            SphereColliderProperties.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 5:
                        if (field.Type == TType.Struct)
                        {
                            CapsuleColliderProperties = new MCapsuleColliderProperties();
                            CapsuleColliderProperties.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 6:
                        if (field.Type == TType.Struct)
                        {
                            ConeColliderProperties = new MConeColliderProperties();
                            ConeColliderProperties.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 7:
                        if (field.Type == TType.Struct)
                        {
                            CylinderColliderProperties = new MCylinderColliderProperties();
                            CylinderColliderProperties.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 8:
                        if (field.Type == TType.Struct)
                        {
                            MeshColliderProperties = new MMeshColliderProperties();
                            MeshColliderProperties.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 9:
                        if (field.Type == TType.Struct)
                        {
                            PositionOffset = new MMIStandard.MVector3();
                            PositionOffset.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 10:
                        if (field.Type == TType.Struct)
                        {
                            RotationOffset = new MMIStandard.MQuaternion();
                            RotationOffset.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 11:
                        if (field.Type == TType.List)
                        {
                            {
                                Colliders = new List <MCollider>();
                                TList _list104 = iprot.ReadListBegin();
                                for (int _i105 = 0; _i105 < _list104.Count; ++_i105)
                                {
                                    MCollider _elem106;
                                    _elem106 = new MCollider();
                                    _elem106.Read(iprot);
                                    Colliders.Add(_elem106);
                                }
                                iprot.ReadListEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 12:
                        if (field.Type == TType.Map)
                        {
                            {
                                Properties = new Dictionary <string, string>();
                                TMap _map107 = iprot.ReadMapBegin();
                                for (int _i108 = 0; _i108 < _map107.Count; ++_i108)
                                {
                                    string _key109;
                                    string _val110;
                                    _key109             = iprot.ReadString();
                                    _val110             = iprot.ReadString();
                                    Properties[_key109] = _val110;
                                }
                                iprot.ReadMapEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    default:
                        TProtocolUtil.Skip(iprot, field.Type);
                        break;
                    }
                    iprot.ReadFieldEnd();
                }
                iprot.ReadStructEnd();
                if (!isset_ID)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA, "required field ID not set");
                }
                if (!isset_Type)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA, "required field Type not set");
                }
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }