public StratusOdinSerializedProperty(FieldInfo field, object target)
        {
            this.field        = field;
            this.type         = this.field.FieldType;
            this.propertyType = SerializedSystemObject.DeducePropertyType(this.field);
            this.displayName  = ObjectNames.NicifyVariableName(this.field.Name);
            this.target       = target;

            // Enum
            if (this.propertyType == SerializedPropertyType.Enum)
            {
                this.enumDisplayNames = StratusSearchableEnum.GetEnumDisplayNames(this.type);
            }

            // Array
            this.isArray = typeof(IList).IsAssignableFrom(this.type);
            if (this.isArray)
            {
                this.list            = this.field.GetValue(target) as IList;
                this.listElementType = Utilities.Reflection.GetIndexedType(list);
            }

            // Set the drawer
            this.drawer = SerializedSystemObject.GetObjectDrawer(this.isArray ? this.listElementType : this.type);
        }
示例#2
0
 public static void EnumToolbar <T>(ref T enumValue)
 {
     string[] options = StratusSearchableEnum.GetEnumDisplayNames((Enum)(object)enumValue);
     enumValue = (T)(object)GUILayout.Toolbar(Convert.ToInt32(enumValue), options, GUILayout.ExpandWidth(false));
 }