Пример #1
0
        internal GameUI(GameUserInterface parent, List <ISettingsProvider> settingsProviders,
                        IConsoleProvider consoleProvider, IPlayerDataProvider playerDataProvider,
                        IPerformanceProvider performanceProvider) : base(parent.Root)
        {
            this.parent              = parent;
            this.settingsProviders   = settingsProviders;
            this.playerDataProvider  = playerDataProvider;
            this.performanceProvider = performanceProvider;

            Console = new ConsoleInterface(this, consoleProvider, parent.Context);
            hud     = new InGameDisplay(this);

            Console.WindowClosed += parent.DoOverlayClose;
        }
Пример #2
0
        internal GameScene(Application.Client client, ClientWorld world, GameConsole console)
        {
            this.client = client;

            Player = null !;

            Screen.SetCursor(visible: false, locked: true);

            ui = new GameUserInterface(
                client,
                client.Keybinds.Input.Listener,
                drawBackground: false);

            List <ISettingsProvider> settingsProviders = new()
            {
                client.Settings,
                Application.Client.Instance.Keybinds
            };

            ui.SetSettingsProviders(settingsProviders);
            ui.SetConsoleProvider(console);
            ui.SetPerformanceProvider(client);

            ui.WorldExit += client.LoadStartScene;

            ui.AnyOverlayOpen += () =>
            {
                Screen.SetOverlayLock();
                Screen.SetCursor(visible: true, locked: false);
            };

            ui.AnyOverlayClosed += () =>
            {
                Screen.ClearOverlayLock();
                Screen.SetCursor(visible: false, locked: true);
            };

            World   = world;
            counter = world.UpdateCounter;

            uiToggle = client.Keybinds.GetToggle(client.Keybinds.UI);

            screenshotButton = client.Keybinds.GetPushButton(client.Keybinds.Screenshot);
            consoleToggle    = client.Keybinds.GetToggle(client.Keybinds.Console);
            escapeButton     = client.Keybinds.GetPushButton(client.Keybinds.Escape);
        }