Example #1
0
 public DrawVisualiser()
 {
     RelativeSizeAxes = Axes.Both;
     Children         = new Drawable[]
     {
         overlay       = new InfoOverlay(),
         treeContainer = new TreeContainer
         {
             Depth         = float.MinValue,
             ChooseTarget  = chooseTarget,
             GoUpOneParent = delegate { Target = Target?.Parent ?? Target; }
         },
         new CursorContainer()
     };
 }
        private void showOverlayFor(Drawable target)
        {
            if (target != null)
            {
                if (overlay == null)
                {
                    Add(overlay = new InfoOverlay());
                }

                overlay.Target = target;
            }
            else if (overlay != null)
            {
                Remove(overlay);
                overlay.Dispose();
                overlay = null;
            }
        }
Example #3
0
 public DrawVisualiser()
 {
     RelativeSizeAxes = Axes.Both;
     Children         = new Drawable[]
     {
         overlay       = new InfoOverlay(),
         treeContainer = new TreeContainer
         {
             Depth         = float.MinValue,
             ChooseTarget  = chooseTarget,
             GoUpOneParent = delegate
             {
                 var parent = Target?.Parent;
                 if (parent != null && !(parent is BasicGameHost))
                 {
                     Target = Target?.Parent;
                 }
             }
         },
         new CursorContainer()
     };
 }
Example #4
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;
                }
            };
        }
        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;
                }
            };
        }