Ejemplo n.º 1
0
        public override void Shutdown()
        {
            escapeMenu.Dispose();
            _gameChat.TextSubmitted -= console.ParseChatMessage;
            console.AddString       -= _gameChat.AddLine;

            playerManager.LocalPlayer.DetachEntity();

            _entityManager.Shutdown();
            mapManager.Shutdown();
            userInterfaceManager.StateRoot.DisposeAllChildren();

            var maps = mapManager.GetAllMaps().ToArray();

            foreach (var map in maps)
            {
                if (map.Index != MapId.Nullspace)
                {
                    mapManager.DeleteMap(map.Index);
                }
            }

            inputManager.SetInputCommand(EngineKeyFunctions.EscapeMenu, null);
            inputManager.SetInputCommand(EngineKeyFunctions.FocusChat, null);

            inputManager.KeyBindStateChanged -= OnKeyBindStateChanged;
        }
Ejemplo n.º 2
0
        public override void Shutdown()
        {
            escapeMenu.Dispose();

            playerManager.LocalPlayer.DetachEntity();

            userInterfaceManager.StateRoot.DisposeAllChildren();

            inputManager.SetInputCommand(EngineKeyFunctions.EscapeMenu, null);

            inputManager.KeyBindStateChanged -= OnKeyBindStateChanged;
        }
Ejemplo n.º 3
0
        public override void Shutdown()
        {
            escapeMenu.Dispose();
            _gameChat.TextSubmitted -= console.ParseChatMessage;
            console.AddString       -= _gameChat.AddLine;

            playerManager.LocalPlayer.DetachEntity();

            userInterfaceManager.StateRoot.DisposeAllChildren();

            inputManager.SetInputCommand(EngineKeyFunctions.EscapeMenu, null);
            inputManager.SetInputCommand(EngineKeyFunctions.FocusChat, null);

            inputManager.KeyBindStateChanged -= OnKeyBindStateChanged;
        }
Ejemplo n.º 4
0
        private void StateManagerOnOnStateChanged(StateChangedEventArgs obj)
        {
            if (obj.NewState is GameScreen)
            {
                // Switched TO GameScreen.
                _escapeMenu = new EscapeMenu(_clientConsole, _tileDefinitionManager, _placementManager,
                                             _prototypeManager, _resourceCache, _configurationManager)
                {
                    Visible = false
                };

                _escapeMenu.AddToScreen();

                var escapeMenuCommand = InputCmdHandler.FromDelegate(session =>
                {
                    if (_escapeMenu.Visible)
                    {
                        if (_escapeMenu.IsAtFront())
                        {
                            _escapeMenu.Visible = false;
                        }
                        else
                        {
                            _escapeMenu.MoveToFront();
                        }
                    }
                    else
                    {
                        _escapeMenu.OpenCentered();
                    }
                });

                _inputManager.SetInputCommand(EngineKeyFunctions.EscapeMenu, escapeMenuCommand);
            }
            else if (obj.OldState is GameScreen)
            {
                // Switched FROM GameScreen.
                _escapeMenu.Dispose();
                _escapeMenu = null;

                _inputManager.SetInputCommand(EngineKeyFunctions.EscapeMenu, null);
            }
        }
Ejemplo n.º 5
0
        private void StateManagerOnOnStateChanged(StateChangedEventArgs obj)
        {
            if (obj.NewState is GameScreenBase)
            {
                // Switched TO GameScreen.
                _escapeMenu = new EscapeMenu(_consoleHost);

                _escapeMenu.OnClose += () => _gameHud.EscapeButtonDown = false;

                _inputManager.SetInputCommand(EngineKeyFunctions.EscapeMenu,
                                              InputCmdHandler.FromDelegate(s => Enabled()));
            }
            else if (obj.OldState is GameScreenBase)
            {
                // Switched FROM GameScreen.
                _escapeMenu.Dispose();
                _escapeMenu = null;

                _inputManager.SetInputCommand(EngineKeyFunctions.EscapeMenu, null);
            }
        }
Ejemplo n.º 6
0
        public override void Shutdown()
        {
            escapeMenu.Dispose();
            _gameChat.TextSubmitted -= console.ParseChatMessage;
            console.AddString       -= _gameChat.AddLine;

            playerManager.LocalPlayer.DetachEntity();

            _entityManager.Shutdown();
            userInterfaceManager.StateRoot.DisposeAllChildren();

            var maps = mapManager.GetAllMaps().ToArray();

            foreach (var map in maps)
            {
                if (map.Index != MapId.Nullspace)
                {
                    mapManager.DeleteMap(map.Index);
                }
            }
        }
Ejemplo n.º 7
0
        private void StateManagerOnOnStateChanged(StateChangedEventArgs obj)
        {
            if (obj.NewState is GameScreen)
            {
                // Switched TO GameScreen.
                _escapeMenu = new EscapeMenu(_clientConsole, _tileDefinitionManager, _placementManager,
                                             _prototypeManager, _resourceCache, _configurationManager, _localizationManager);

                _escapeMenu.OnClose += () => _gameHud.EscapeButtonDown = false;

                _inputManager.SetInputCommand(EngineKeyFunctions.EscapeMenu,
                                              InputCmdHandler.FromDelegate(s => Enabled()));
            }
            else if (obj.OldState is GameScreen)
            {
                // Switched FROM GameScreen.
                _escapeMenu.Dispose();
                _escapeMenu = null;

                _inputManager.SetInputCommand(EngineKeyFunctions.EscapeMenu, null);
            }
        }