private void visualise(IDrawable d, VisualisedDrawable vis)
        {
            if (d == this)
            {
                return;
            }

            vis.CheckExpiry();

            var drawables = vis.Flow.Children.Cast <VisualisedDrawable>();

            foreach (var dd in drawables)
            {
                if (!dd.CheckExpiry())
                {
                    visualise(dd.Target, dd);
                }
            }

            Container dContainer = d as Container;

            if (d is SpriteText)
            {
                return;
            }

            if (dContainer == null)
            {
                return;
            }

            foreach (var c in dContainer.Children)
            {
                var dr = drawables.FirstOrDefault(x => x.Target == c);

                if (dr == null)
                {
                    var cLocal = c;
                    dr = new VisualisedDrawable(cLocal)
                    {
                        HoverGained = delegate {
                            hoveredDrawables.Add(cLocal);
                            showOverlayFor(cLocal);
                        },
                        HoverLost = delegate
                        {
                            hoveredDrawables.Remove(cLocal);
                            showOverlayFor(hoveredDrawables.Count > 0 ? hoveredDrawables.Last() : null);
                        },
                        RequestTarget = delegate { Target = cLocal; }
                    };
                    vis.Flow.Add(dr);
                }

                visualise(c, dr);
            }
        }
Beispiel #2
0
        private void visualise(IDrawable d, VisualisedDrawable vis)
        {
            if (d == this)
            {
                return;
            }

            vis.CheckExpiry();

            var drawables = vis.Flow.Children.Cast <VisualisedDrawable>();

            foreach (var dd in drawables)
            {
                if (!dd.CheckExpiry())
                {
                    visualise(dd.Target, dd);
                }
            }

            var dContainer = d as IContainerEnumerable <Drawable>;

            if (d is SpriteText)
            {
                return;
            }

            if (dContainer == null)
            {
                return;
            }

            foreach (var c in dContainer.InternalChildren)
            {
                var dr = drawables.FirstOrDefault(x => x.Target == c);

                if (dr == null)
                {
                    var cLocal = c;
                    dr = createVisualisedDrawable(cLocal);
                    vis.Flow.Add(dr);
                }

                visualise(c, dr);
            }
        }