Пример #1
0
        private void DrawFields(Type type, ComponentSystemBase effectiveInstance)
        {
            foreach (var field in cachedFields)
            {
                if (field.FieldType == typeof(System.Int32))
                {
                    IntField.Draw(type, field, effectiveInstance);
                }
                else if (field.FieldType == typeof(System.Single))
                {
                    FloatField.Draw(type, field, effectiveInstance);
                }
                else if (field.FieldType == typeof(System.String))
                {
                    StringField.Draw(type, field, effectiveInstance);
                }
                else if (field.FieldType == typeof(System.Boolean))
                {
                    BoolField.Draw(type, field, effectiveInstance);
                }
                else if (field.FieldType.IsEnum)
                {
                    var underlyingType = Enum.GetUnderlyingType(field.FieldType);
                    if (underlyingType == typeof(short))
                    {
                        MaskField.Draw(type, field, effectiveInstance);
                    }
                    else
                    {
                        EnumField.Draw(type, field, effectiveInstance);
                    }
                }
                else
                {
                    // monobehaviours
                    switch (field.FieldType.ToString())
                    {
                    case "UnityEngine.Mesh":
                        MeshField.Draw(type, field, effectiveInstance);
                        break;

                    case "UnityEngine.Material":
                        MaterialField.Draw(type, field, effectiveInstance);
                        break;
                    }
                }
            }
        }