예제 #1
0
    //public ObjectFadeData(Component obj, SupportedFadeTypes type, float alpha, float delay)
    //{
    //    this.type = type;
    //    this.objectToFade = obj;
    //    this.targetAlpha = alpha;
    //    this.delay = delay;
    //}

    public ZEventCreationData(ZEventType type, float alpha, float delay)
    {
        this.eventType       = type;
        this.rank            = 0;
        this.duration        = 2.0f;
        this.delay           = 0.0f;
        this.ignoreEmptyPage = false;
        this.curve           = AnimationCurve.EaseInOut(0.0f, 0.0f, 1.0f, 1.0f);
    }
예제 #2
0
    ReorderableList CreateList(string listPropertyName, string listTitle)
    {
        var list = new ReorderableList(serializedObject,
                                       serializedObject.FindProperty(listPropertyName),
                                       true, true, true, true);

        list.drawHeaderCallback = (Rect rect) =>
        {
            EditorGUI.LabelField(rect, listTitle);
        };

        list.elementHeightCallback = (index) =>
        {
            var element = list.serializedProperty.GetArrayElementAtIndex(index);
            return(3.0f * EditorGUI.GetPropertyHeight(element));
        };

        list.drawElementCallback =
            (Rect rect, int index, bool isActive, bool isFocused) =>
        {
            var element = list.serializedProperty.GetArrayElementAtIndex(index);
            rect.y += 2;

            var cellSize = rect.width / (float)propNames.Length;
            var offset   = new RectOffset(2, 5, 0, 0);
            //var dataItem = element.objectReferenceValue as System.Object as ZEventCreationData;

            //find all properties associated with the type
            int        enumIndex = element.FindPropertyRelative("eventType").enumValueIndex;
            ZEventType eType     = (ZEventType)enumIndex;
            Type       compType  = Type.GetType(eType.ToString());


            //draw
            for (int i = 0; i < propNames.Length; i++)
            {
                var cellRect = new Rect(rect.x + i * cellSize, rect.y, cellSize / 2, EditorGUIUtility.singleLineHeight);
                cellRect = offset.Remove(cellRect);
                EditorGUI.LabelField(cellRect, propNames[i]);

                cellRect = new Rect(rect.x + i * cellSize + cellSize / 2, rect.y, cellSize / 2, EditorGUIUtility.singleLineHeight);
                cellRect = offset.Remove(cellRect);
                EditorGUI.PropertyField(
                    cellRect, element.FindPropertyRelative(propNames[i]), GUIContent.none);
            }
        };

        return(list);
    }