protected override void DrawElement(Rect rect, int index)
            {
                Dictionary <string, Rect> rects = AdvancedRect.GetRects(rect, AdvancedRect.Orientation.Horizontal,
                                                                        new AdvancedRect.ProportionalItem("Name", 50),
                                                                        new AdvancedRect.FixedSpace(2),
                                                                        new AdvancedRect.ExpandedItem("Float"),
                                                                        new AdvancedRect.FixedSpace(2),
                                                                        new AdvancedRect.FixedItem("Bool", 50)
                                                                        );

                EditorGUIUtility.labelWidth = 35;

                SerializedObject.Update();

                if (index >= ElementCount)
                {
                    return;
                }

                SerializedProperty property = GetElementAtIndex(index);

                EditorGUI.PropertyField(rects["Name"], property.FindPropertyRelative("name"), GUIContent.none);
                EditorGUI.Slider(rects["Float"], property.FindPropertyRelative("value"), -10, 10, "Value");
                EditorGUI.PropertyField(rects["Bool"], property.FindPropertyRelative("boolean"), new GUIContent("Bool"));

                SerializedObject.ApplyModifiedProperties();

                EditorGUIUtility.labelWidth = 0;
            }
示例#2
0
        public void Draw(Rect rect)
        {
            InitDefaults();

            Dictionary <string, Rect> rects = AdvancedRect.GetRects(rect, AdvancedRect.Orientation.Vertical,
                                                                    new AdvancedRect.FixedItem("Header", Config.headerHeight),
                                                                    new AdvancedRect.FixedItem("Elements", Config.elementHeight * Count),
                                                                    new AdvancedRect.FixedItem("Footer", Config.footerHeight)
                                                                    );

            DrawHeader(rects["Header"]);
            DrawElements(rects["Elements"]);
            DrawFooter(rects["Footer"]);
        }
        private void OnGUI()
        {
            if (nonSerializableReorderableList == null || serializableReorderableList == null)
            {
                Initialize();
            }

            Dictionary <string, Rect> rects = AdvancedRect.GetRects(Rect, AdvancedRect.Orientation.Horizontal,
                                                                    new AdvancedRect.ExpandedItem("Object"),
                                                                    new AdvancedRect.FixedSpace(4),
                                                                    new AdvancedRect.ExpandedItem("Serialized")
                                                                    );

            nonSerializableReorderableList.Draw(rects["Object"]);
            serializableReorderableList.Draw(rects["Serialized"]);
        }
            protected override void DrawElement(Rect rect, int index)
            {
                Dictionary <string, Rect> rects = AdvancedRect.GetRects(rect, AdvancedRect.Orientation.Horizontal,
                                                                        new AdvancedRect.ProportionalItem("Name", 50),
                                                                        new AdvancedRect.FixedSpace(2),
                                                                        new AdvancedRect.ExpandedItem("Float"),
                                                                        new AdvancedRect.FixedSpace(2),
                                                                        new AdvancedRect.FixedItem("Bool", 50)
                                                                        );

                EditorGUIUtility.labelWidth = 35;

                ReorderableListExampleClass element = elements[index];

                element.name    = EditorGUI.TextField(rects["Name"], element.name);
                element.value   = EditorGUI.Slider(rects["Float"], "Value", element.value, -10, 10);
                element.boolean = EditorGUI.Toggle(rects["Bool"], "Bool", element.boolean);

                EditorGUIUtility.labelWidth = 0;
            }