private void load()
        {
            Children = new[]
            {
                display = new GlobalStatisticsDisplay(),
            };

            display.ToggleVisibility();

            GlobalStatistic <double> stat = null;

            AddStep("Register test statistic", () => stat = GlobalStatistics.Get <double>("TestCase", "Test Statistic"));

            AddStep("Change value once", () => stat.Value  = 10);
            AddStep("Change value again", () => stat.Value = 20);

            AddStep("Register statistics non-alphabetically", () =>
            {
                GlobalStatistics.Get <int>("ZZZZZ", "BBBBB");
                GlobalStatistics.Get <int>("ZZZZZ", "AAAAA");
            });

            AddStep("Register groups non-alphabetically", () =>
            {
                GlobalStatistics.Get <int>("XXXXX", "BBBBB");
                GlobalStatistics.Get <int>("TTTTT", "AAAAA");
            });
        }
Exemplo n.º 2
0
        public bool OnPressed(FrameworkAction action)
        {
            switch (action)
            {
            case FrameworkAction.CycleFrameStatistics:
                switch (FrameStatistics.Value)
                {
                case FrameStatisticsMode.None:
                    FrameStatistics.Value = FrameStatisticsMode.Minimal;
                    break;

                case FrameStatisticsMode.Minimal:
                    FrameStatistics.Value = FrameStatisticsMode.Full;
                    break;

                case FrameStatisticsMode.Full:
                    FrameStatistics.Value = FrameStatisticsMode.None;
                    break;
                }

                return(true);

            case FrameworkAction.ToggleGlobalStatistics:

                if (globalStatistics == null)
                {
                    LoadComponentAsync(globalStatistics = new GlobalStatisticsDisplay
                    {
                        Depth    = float.MinValue / 2,
                        Position = new Vector2(100 + ToolWindow.WIDTH, 100)
                    }, AddInternal);
                }

                globalStatistics.ToggleVisibility();
                return(true);

            case FrameworkAction.ToggleDrawVisualiser:

                if (drawVisualiser == null)
                {
                    LoadComponentAsync(drawVisualiser = new DrawVisualiser
                    {
                        ToolPosition = new Vector2(100),
                        Depth        = float.MinValue / 2,
                    }, AddInternal);
                }

                drawVisualiser.ToggleVisibility();
                return(true);

            case FrameworkAction.ToggleLogOverlay:
                logOverlayVisibility.Value = !logOverlayVisibility.Value;
                return(true);

            case FrameworkAction.ToggleFullscreen:
                Window?.CycleMode();
                return(true);
            }

            return(false);
        }
Exemplo n.º 3
0
        public bool OnPressed(KeyBindingPressEvent <FrameworkAction> e)
        {
            switch (e.Action)
            {
            case FrameworkAction.CycleFrameStatistics:

                switch (FrameStatistics.Value)
                {
                case FrameStatisticsMode.None:
                    FrameStatistics.Value = FrameStatisticsMode.Minimal;
                    break;

                case FrameStatisticsMode.Minimal:
                    FrameStatistics.Value = FrameStatisticsMode.Full;
                    break;

                case FrameStatisticsMode.Full:
                    FrameStatistics.Value = FrameStatisticsMode.None;
                    break;
                }

                return(true);

            case FrameworkAction.ToggleDrawVisualiser:

                if (drawVisualiser == null)
                {
                    LoadComponentAsync(drawVisualiser = new DrawVisualiser
                    {
                        ToolPosition = getCascadeLocation(0),
                        Depth        = float.MinValue / 2,
                    }, AddInternal);
                }

                drawVisualiser.ToggleVisibility();
                return(true);

            case FrameworkAction.ToggleGlobalStatistics:

                if (globalStatistics == null)
                {
                    LoadComponentAsync(globalStatistics = new GlobalStatisticsDisplay
                    {
                        Depth    = float.MinValue / 2,
                        Position = getCascadeLocation(1),
                    }, AddInternal);
                }

                globalStatistics.ToggleVisibility();
                return(true);

            case FrameworkAction.ToggleAtlasVisualiser:

                if (textureVisualiser == null)
                {
                    LoadComponentAsync(textureVisualiser = new TextureVisualiser
                    {
                        Position = getCascadeLocation(2),
                        Depth    = float.MinValue / 2,
                    }, AddInternal);
                }

                textureVisualiser.ToggleVisibility();
                return(true);

            case FrameworkAction.ToggleAudioMixerVisualiser:
                if (audioMixerVisualiser == null)
                {
                    LoadComponentAsync(audioMixerVisualiser = new AudioMixerVisualiser
                    {
                        Position = getCascadeLocation(3),
                        Depth    = float.MinValue / 2,
                    }, AddInternal);
                }

                audioMixerVisualiser.ToggleVisibility();
                return(true);

            case FrameworkAction.ToggleLogOverlay:
                logOverlayVisibility.Value = !logOverlayVisibility.Value;
                return(true);

            case FrameworkAction.ToggleFullscreen:
                Window?.CycleMode();
                return(true);

            case FrameworkAction.CycleFrameSync:
                var nextFrameSync = frameSyncMode.Value + 1;

                if (nextFrameSync > FrameSync.Unlimited)
                {
                    nextFrameSync = FrameSync.VSync;
                }

                frameSyncMode.Value = nextFrameSync;
                break;

            case FrameworkAction.CycleExecutionMode:
                var nextExecutionMode = executionMode.Value + 1;

                if (nextExecutionMode > ExecutionMode.MultiThreaded)
                {
                    nextExecutionMode = ExecutionMode.SingleThread;
                }

                executionMode.Value = nextExecutionMode;
                break;
            }

            return(false);

            Vector2 getCascadeLocation(int index)
            => new Vector2(100 + index * (TitleBar.HEIGHT + 10));
        }
Exemplo n.º 4
0
        public bool OnPressed(FrameworkAction action)
        {
            switch (action)
            {
            case FrameworkAction.CycleFrameStatistics:
                switch (FrameStatistics.Value)
                {
                case FrameStatisticsMode.None:
                    FrameStatistics.Value = FrameStatisticsMode.Minimal;
                    break;

                case FrameStatisticsMode.Minimal:
                    FrameStatistics.Value = FrameStatisticsMode.Full;
                    break;

                case FrameStatisticsMode.Full:
                    FrameStatistics.Value = FrameStatisticsMode.None;
                    break;
                }

                return(true);

            case FrameworkAction.ToggleGlobalStatistics:

                if (globalStatistics == null)
                {
                    LoadComponentAsync(globalStatistics = new GlobalStatisticsDisplay
                    {
                        Depth    = float.MinValue / 2,
                        Position = new Vector2(100 + ToolWindow.WIDTH, 100)
                    }, AddInternal);
                }

                globalStatistics.ToggleVisibility();
                return(true);

            case FrameworkAction.ToggleDrawVisualiser:

                if (drawVisualiser == null)
                {
                    LoadComponentAsync(drawVisualiser = new DrawVisualiser
                    {
                        ToolPosition = new Vector2(100),
                        Depth        = float.MinValue / 2,
                    }, AddInternal);
                }

                drawVisualiser.ToggleVisibility();
                return(true);

            case FrameworkAction.ToggleAtlasVisualiser:

                if (textureVisualiser == null)
                {
                    LoadComponentAsync(textureVisualiser = new TextureVisualiser
                    {
                        Position = new Vector2(100 + 2 * ToolWindow.WIDTH, 100),
                        Depth    = float.MinValue / 2,
                    }, AddInternal);
                }

                textureVisualiser.ToggleVisibility();
                return(true);

            case FrameworkAction.ToggleLogOverlay:
                logOverlayVisibility.Value = !logOverlayVisibility.Value;
                return(true);

            case FrameworkAction.ToggleFullscreen:
                Window?.CycleMode();
                return(true);

            case FrameworkAction.CycleFrameSync:
                var nextFrameSync = frameSyncMode.Value + 1;

                if (nextFrameSync > FrameSync.Unlimited)
                {
                    nextFrameSync = FrameSync.VSync;
                }

                frameSyncMode.Value = nextFrameSync;
                break;

            case FrameworkAction.CycleExecutionMode:
                var nextExecutionMode = executionMode.Value + 1;

                if (nextExecutionMode > ExecutionMode.MultiThreaded)
                {
                    nextExecutionMode = ExecutionMode.SingleThread;
                }

                executionMode.Value = nextExecutionMode;
                break;
            }

            return(false);
        }