Пример #1
0
        public TreeContainer()
            : base("Draw Visualiser", "(Ctrl+F1 to toggle)")
        {
            AddInternal(waitingText = new SpriteText
            {
                Text   = @"Waiting for target selection...",
                Anchor = Anchor.Centre,
                Origin = Anchor.Centre,
            });

            AddButton(@"choose target", () => ChooseTarget?.Invoke());
            AddButton(@"up one parent", () => GoUpOneParent?.Invoke());
            AddButton(@"view properties", () => ToggleProperties?.Invoke());

            MainHorizontalContent.Add(PropertyDisplay = new PropertyDisplay());
        }
Пример #2
0
        public DrawVisualiser()
        {
            RelativeSizeAxes = Axes.Both;
            Children         = new Drawable[]
            {
                overlay       = new InfoOverlay(),
                treeContainer = new TreeContainer
                {
                    ChooseTarget  = chooseTarget,
                    GoUpOneParent = delegate
                    {
                        Drawable lastHighlight = highlightedTarget?.Target;

                        var parent = Target?.Parent;
                        if (parent?.Parent != null)
                        {
                            Target = Target?.Parent;
                        }

                        // Rehighlight the last highlight
                        if (lastHighlight != null)
                        {
                            VisualisedDrawable visualised = findVisualised(lastHighlight, targetDrawable);
                            if (visualised != null)
                            {
                                propertyDisplay.State = Visibility.Visible;
                                setHighlight(visualised);
                            }
                        }
                    },
                    ToggleProperties = delegate
                    {
                        if (targetDrawable == null)
                        {
                            return;
                        }

                        propertyDisplay.ToggleVisibility();

                        if (propertyDisplay.State == Visibility.Visible)
                        {
                            setHighlight(targetDrawable);
                        }
                    },
                },
                new CursorContainer()
            };

            propertyDisplay = treeContainer.PropertyDisplay;

            propertyDisplay.StateChanged += (display, visibility) =>
            {
                switch (visibility)
                {
                case Visibility.Hidden:
                    // Dehighlight everything automatically if property display is closed
                    setHighlight(null);
                    break;
                }
            };
        }
Пример #3
0
        public DrawVisualiser()
        {
            RelativeSizeAxes = Axes.Both;
            Children         = new Drawable[]
            {
                overlay       = new InfoOverlay(),
                treeContainer = new TreeContainer
                {
                    State        = { BindTarget = State },
                    ChooseTarget = () =>
                    {
                        Searching = true;
                        Target    = null;
                    },
                    GoUpOneParent = delegate
                    {
                        Drawable lastHighlight = highlightedTarget?.Target;

                        var parent = Target?.Parent;

                        if (parent != null)
                        {
                            var lastVisualiser = targetVisualiser;

                            Target = parent;
                            lastVisualiser.SetContainer(targetVisualiser);

                            targetVisualiser.Expand();
                        }

                        // Rehighlight the last highlight
                        if (lastHighlight != null)
                        {
                            VisualisedDrawable visualised = targetVisualiser.FindVisualisedDrawable(lastHighlight);

                            if (visualised != null)
                            {
                                propertyDisplay.Show();
                                setHighlight(visualised);
                            }
                        }
                    },
                    ToggleProperties = delegate
                    {
                        if (targetVisualiser == null)
                        {
                            return;
                        }

                        propertyDisplay.ToggleVisibility();

                        if (propertyDisplay.State.Value == Visibility.Visible)
                        {
                            setHighlight(targetVisualiser);
                        }
                    },
                },
                new CursorContainer()
            };

            propertyDisplay = treeContainer.PropertyDisplay;

            propertyDisplay.State.ValueChanged += v =>
            {
                switch (v.NewValue)
                {
                case Visibility.Hidden:
                    // Dehighlight everything automatically if property display is closed
                    setHighlight(null);
                    break;
                }
            };
        }