示例#1
0
        public override void Draw()
        {
            foldout = EditorGUILayout.Foldout(foldout, FOLD_NAME);

            if (!foldout)
            {
                return;
            }

            HierarchyUtil.CreateGroup(() =>
            {
                HierarchyUtil.CreateInfo(INFO);

                this.enabled = HierarchyUtil.Toggle("Enabeld", this.enabled,
                                                    @"Enable/Disable all features from this section");

                HierarchyUtil.LabelField("Bar");

                HierarchyUtil.CreateGroup(() =>
                {
                    HierarchyUtil.CreateInfo("Colorized Bar by tree level");

                    this.colorizedLine = HierarchyUtil.Toggle("Colorized Line", this.colorizedLine,
                                                              @"Enabled/Disabled to colorized bar");

                    HierarchyUtil.BeginHorizontal(() =>
                    {
                        this.lineAlpha = HierarchyUtil.Slider("Line Alpha", this.lineAlpha, 0.0f, 1.0f,
                                                              @"Alpha level for the bar");
                        HierarchyUtil.Button("Reset", ResetLineAlpha);
                    });

                    HierarchyUtil.BeginHorizontal(() =>
                    {
                        this.lineWidth = HierarchyUtil.Slider("Line Width", this.lineWidth, 0.001f, 3.0f,
                                                              @"Line width for the bar");
                        HierarchyUtil.Button("Reset", ResetLineWidth);
                    });
                });

                HierarchyUtil.LabelField("Item");

                HierarchyUtil.CreateGroup(() =>
                {
                    HierarchyUtil.CreateInfo("Colorized Item by tree level");

                    this.colorizedItem = HierarchyUtil.Toggle("Colorized Item", this.colorizedItem,
                                                              @"Enabled/Disabled to colorized item");

                    this.drawMode = (DrawMode)HierarchyUtil.EnumPopup("Draw Mode", this.drawMode,
                                                                      @"Mode for item to draw");

                    HierarchyUtil.BeginHorizontal(() =>
                    {
                        this.gradientLength = HierarchyUtil.Slider("Gradient Length", this.gradientLength, 0.01f, 1.0f,
                                                                   @"Time of the gradient faded to alpha 0");
                        HierarchyUtil.Button("Reset", ResetGradientLength);
                    });

                    HierarchyUtil.BeginHorizontal(() =>
                    {
                        this.overlayAlpha = HierarchyUtil.Slider("Overlay Alpha", this.overlayAlpha, 0.0f, 0.8f,
                                                                 @"Alpha level for the item");
                        HierarchyUtil.Button("Reset", ResetOverlayAlpha);
                    });

                    HierarchyUtil.BeginHorizontal(() =>
                    {
                        this.baseLevelColor = HierarchyUtil.ColorField("Base Level Color", this.baseLevelColor,
                                                                       @"Base color for colorized item");
                        HierarchyUtil.Button("Reset", ResetBaseLevelColor);
                    });

                    HierarchyUtil.BeginHorizontal(() =>
                    {
                        instance         = ScriptableObject.CreateInstance <Container_TreeData>();
                        serializedObject = new SerializedObject(instance);
                        propBranches     = serializedObject.FindProperty("branches");

                        DynamicRefresh();

                        serializedObject.Update();
                        EditorGUILayout.PropertyField(propBranches);
                        serializedObject.ApplyModifiedProperties();

                        HierarchyUtil.Button("Reset", ResetBranchesColor);
                    });
                });

                HierarchyUtil.LabelField("Divider");

                HierarchyUtil.CreateGroup(() =>
                {
                    HierarchyUtil.CreateInfo("Thin lines indicate each group of tree level");

                    HierarchyUtil.BeginHorizontal(() =>
                    {
                        this.dividerColor = HierarchyUtil.ColorField("Color", this.dividerColor,
                                                                     @"Color for the divider");
                        HierarchyUtil.Button("Reset", ResetDividerColor);
                    });

                    HierarchyUtil.BeginHorizontal(() =>
                    {
                        this.dividerHeight = HierarchyUtil.Slider("Divider Height", this.dividerHeight, 0.0f, 3.0f,
                                                                  @"Height of the divider");
                        HierarchyUtil.Button("Reset", ResetDividerHeight);
                    });
                });
            });
        }