Exemple #1
0
    public ES2EditorProperty(PropertyInfo info)
    {
        this.name        = info.Name;
        this.isSelected  = false;
        this.type        = info.PropertyType;
        this.isComponent = typeof(Component).IsAssignableFrom(this.type);

        this.collectionType         = ES2EditorReflection.GetSupportedCollectionType(this.type);
        this.isCollection           = (collectionType != "");
        this.collectionContentTypes = ES2EditorReflection.GetSupportedCollectionTypes(type);

        bool hasGetter = (info.GetGetMethod() != null);
        bool hasSetter = (info.GetSetMethod() != null);

        // Determine if property can be saved.
        if (info.GetGetMethod().IsStatic)
        {
            isSupported            = false;
            unsupportedDescription = "Static properties should not be saved from an ES2Type.";
        }
        else if (!hasSetter || !hasGetter)
        {
            isSupported            = false;
            unsupportedDescription = "This property needs a getter and a setter to be able to save it.";
        }
        else
        {
            this.unsupportedDescription = ES2EditorManageTypes.TypeIsSupported(this.type);
            isSupported = (unsupportedDescription == "");
        }
    }
Exemple #2
0
    public ES2EditorProperty(FieldInfo info)
    {
        this.name        = info.Name;
        this.isSelected  = false;
        this.type        = info.FieldType;
        this.isComponent = typeof(Component).IsAssignableFrom(this.type);

        this.collectionType         = ES2EditorReflection.GetSupportedCollectionType(this.type);
        this.isCollection           = (collectionType != "");
        this.collectionContentTypes = ES2EditorReflection.GetSupportedCollectionTypes(type);

        // Determine if property can be saved.
        if (info.IsStatic)
        {
            isSupported            = false;
            unsupportedDescription = "Static properties should not be saved from an ES2Type.";
        }
        else if (info.IsInitOnly)
        {
            isSupported            = false;
            unsupportedDescription = "This field needs to be writable and readable to be able to save it.";
        }
        else
        {
            this.unsupportedDescription = ES2EditorManageTypes.TypeIsSupported(this.type);
            isSupported = (unsupportedDescription == "");
        }
    }
    public static void OpenWindow()
    {
        // Get existing open window or if none, make a new one:
        ES2EditorManageTypes window = (ES2EditorManageTypes)EditorWindow.GetWindow(typeof(ES2EditorManageTypes));

        window.minSize = new Vector2(720f, 512f);
    }