Example #1
0
        public override void Startup()
        {
            base.Startup();

            _gameChat = new ChatBox();

            _userInterfaceManager.StateRoot.AddChild(_gameChat);
            LayoutContainer.SetAnchorAndMarginPreset(_gameChat, LayoutContainer.LayoutPreset.TopRight, margin: 10);
            LayoutContainer.SetAnchorAndMarginPreset(_gameChat, LayoutContainer.LayoutPreset.TopRight, margin: 10);
            LayoutContainer.SetMarginLeft(_gameChat, -475);
            LayoutContainer.SetMarginBottom(_gameChat, 235);

            _userInterfaceManager.StateRoot.AddChild(_gameHud.RootControl);
            _chatManager.SetChatBox(_gameChat);
            _voteManager.SetPopupContainer(_gameHud.VoteContainer);
            _gameChat.DefaultChatFormat = "say \"{0}\"";
            _gameChat.Input.PlaceHolder = Loc.GetString("Say something! [ for OOC");

            _inputManager.SetInputCommand(ContentKeyFunctions.FocusChat,
                                          InputCmdHandler.FromDelegate(_ => FocusChat(_gameChat)));

            _inputManager.SetInputCommand(ContentKeyFunctions.FocusOOC,
                                          InputCmdHandler.FromDelegate(_ => FocusOOC(_gameChat)));

            _inputManager.SetInputCommand(ContentKeyFunctions.FocusAdminChat,
                                          InputCmdHandler.FromDelegate(_ => FocusAdminChat(_gameChat)));

            _configurationManager.OnValueChanged(CCVars.OocEnabled, OnOocEnabledChanged, true);
            _configurationManager.OnValueChanged(CCVars.AdminOocEnabled, OnAdminOocEnabledChanged, true);
            _adminManager.AdminStatusUpdated += OnAdminStatusUpdated;

            SetupPresenters();
        }
Example #2
0
        public void Initialize()
        {
            _commandWindows = new List <SS14Window>();
            // Reset the AdminMenu Window on disconnect
            _netManager.Disconnect += (sender, channel) => ResetWindow();

            _inputManager.SetInputCommand(ContentKeyFunctions.OpenAdminMenu,
                                          InputCmdHandler.FromDelegate(session => Toggle()));

            _clientAdminManager.AdminStatusUpdated += () =>
            {
                // when status changes, show the top button if we can open admin menu.
                // if we can't or we lost admin status, close it and hide the button.
                _gameHud.AdminButtonVisible = CanOpen();
                if (!_gameHud.AdminButtonVisible)
                {
                    Close();
                }
            };
            _gameHud.AdminButtonToggled += (open) =>
            {
                if (open)
                {
                    TryOpen();
                }
                else
                {
                    Close();
                }
            };
            _gameHud.AdminButtonVisible = CanOpen();
            _gameHud.AdminButtonDown    = false;
        }
Example #3
0
        public override void Startup()
        {
            IoCManager.InjectDependencies(this);

            inputManager.KeyBindStateChanged += OnKeyBindStateChanged;

            escapeMenu = new EscapeMenu
            {
                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);
        }
        /// <inheritdoc />
        public override void Initialize()
        {
            EntityQuery = new TypeEntityQuery(typeof(IMoverComponent));

            var moveUpCmdHandler = InputCmdHandler.FromDelegate(
                session => HandleDirChange(session, Direction.North, true),
                session => HandleDirChange(session, Direction.North, false));
            var moveLeftCmdHandler = InputCmdHandler.FromDelegate(
                session => HandleDirChange(session, Direction.West, true),
                session => HandleDirChange(session, Direction.West, false));
            var moveRightCmdHandler = InputCmdHandler.FromDelegate(
                session => HandleDirChange(session, Direction.East, true),
                session => HandleDirChange(session, Direction.East, false));
            var moveDownCmdHandler = InputCmdHandler.FromDelegate(
                session => HandleDirChange(session, Direction.South, true),
                session => HandleDirChange(session, Direction.South, false));
            var runCmdHandler = InputCmdHandler.FromDelegate(
                session => HandleRunChange(session, true),
                session => HandleRunChange(session, false));

            var input = EntitySystemManager.GetEntitySystem <InputSystem>();

            input.BindMap.BindFunction(EngineKeyFunctions.MoveUp, moveUpCmdHandler);
            input.BindMap.BindFunction(EngineKeyFunctions.MoveLeft, moveLeftCmdHandler);
            input.BindMap.BindFunction(EngineKeyFunctions.MoveRight, moveRightCmdHandler);
            input.BindMap.BindFunction(EngineKeyFunctions.MoveDown, moveDownCmdHandler);
            input.BindMap.BindFunction(EngineKeyFunctions.Run, runCmdHandler);

            SubscribeEvent <PlayerAttachSystemMessage>(PlayerAttached);
            SubscribeEvent <PlayerDetachedSystemMessage>(PlayerDetached);

            _audioSystem = EntitySystemManager.GetEntitySystem <AudioSystem>();
        }
Example #5
0
        private void _joinGame(MsgTickerJoinGame message)
        {
            if (_tickerState == TickerState.InGame)
            {
                return;
            }

            _tickerState = TickerState.InGame;

            if (_lobby != null)
            {
                _lobby.Chat.TextSubmitted -= _chatConsole.ParseChatMessage;
                _chatConsole.AddString    -= _lobby.Chat.AddLine;
                _lobby.Dispose();
                _lobby = null;
            }

            _inputManager.SetInputCommand(EngineKeyFunctions.FocusChat,
                                          InputCmdHandler.FromDelegate(session => { _gameChat.Input.GrabKeyboardFocus(); }));

            _gameChat = new Chatbox();
            _userInterfaceManager.StateRoot.AddChild(_gameChat);
            _gameChat.TextSubmitted    += _chatConsole.ParseChatMessage;
            _chatConsole.AddString     += _gameChat.AddLine;
            _gameChat.DefaultChatFormat = "say \"{0}\"";
        }
        public void Initialize()
        {
            UIScale       = _configurationManager.GetCVar <float>("display.uiScale");
            ThemeDefaults = new UIThemeDummy();

            _initializeCommon();

            DebugConsole = new DebugConsole(_console, _resourceManager);
            RootControl.AddChild(DebugConsole);

            _debugMonitors = new DebugMonitors(_gameTiming, _playerManager, _eyeManager, _inputManager, _stateManager, _displayManager, _netManager, _mapManager);
            RootControl.AddChild(_debugMonitors);

            _inputManager.SetInputCommand(EngineKeyFunctions.ShowDebugConsole,
                                          InputCmdHandler.FromDelegate(session => DebugConsole.Toggle()));

            _inputManager.SetInputCommand(EngineKeyFunctions.ShowDebugMonitors,
                                          InputCmdHandler.FromDelegate(enabled: session => { DebugMonitors.Visible = true; },
                                                                       disabled: session => { DebugMonitors.Visible = false; }));

            _inputManager.SetInputCommand(EngineKeyFunctions.HideUI,
                                          InputCmdHandler.FromDelegate(
                                              enabled: session => _rendering  = false,
                                              disabled: session => _rendering = true));

            _inputManager.UIKeyBindStateChanged += OnUIKeyBindStateChanged;
        }
Example #7
0
        /// <summary>
        /// Create the window with all character UIs and bind it to a keypress
        /// </summary>
        public override void Initialize()
        {
            base.Initialize();

            //Use all the character ui interfaced components to create the character window
            var UIcomponents = Owner.GetAllComponents <ICharacterUI>();

            _window = new CharacterWindow(UIcomponents);

            _window.AddToScreen();

            //Toggle window visible/invisible on keypress
            _openMenuCmdHandler = InputCmdHandler.FromDelegate(session => {
                if (_window.Visible)
                {
                    _window.Close();
                }
                else
                {
                    _window.Open();
                }
            });

            //Set keybind to open character menu
            var inputMgr = IoCManager.Resolve <IInputManager>();

            inputMgr.SetInputCommand(ContentKeyFunctions.OpenCharacterMenu, _openMenuCmdHandler);
        }
Example #8
0
        private void _joinGame(MsgTickerJoinGame message)
        {
            if (_tickerState == TickerState.InGame)
            {
                return;
            }

            _tickerState = TickerState.InGame;

            if (_lobby != null)
            {
                _lobby.Dispose();
                _lobby = null;
            }

            _inputManager.SetInputCommand(ContentKeyFunctions.FocusChat,
                                          InputCmdHandler.FromDelegate(session =>
            {
                _gameChat.Input.IgnoreNext = true;
                _gameChat.Input.GrabKeyboardFocus();
            }));

            _gameChat = new ChatBox();
            _userInterfaceManager.StateRoot.AddChild(_gameChat);
            _chatManager.SetChatBox(_gameChat);
            _gameChat.DefaultChatFormat = "say \"{0}\"";
        }
Example #9
0
        public override void Initialize()
        {
            base.Initialize();

            // set up hotkeys for hotbar
            CommandBinds.Builder
            .Bind(ContentKeyFunctions.OpenActionsMenu,
                  InputCmdHandler.FromDelegate(_ => ToggleActionsMenu()))
            .Bind(ContentKeyFunctions.Hotbar1,
                  HandleHotbarKeybind(0))
            .Bind(ContentKeyFunctions.Hotbar2,
                  HandleHotbarKeybind(1))
            .Bind(ContentKeyFunctions.Hotbar3,
                  HandleHotbarKeybind(2))
            .Bind(ContentKeyFunctions.Hotbar4,
                  HandleHotbarKeybind(3))
            .Bind(ContentKeyFunctions.Hotbar5,
                  HandleHotbarKeybind(4))
            .Bind(ContentKeyFunctions.Hotbar6,
                  HandleHotbarKeybind(5))
            .Bind(ContentKeyFunctions.Hotbar7,
                  HandleHotbarKeybind(6))
            .Bind(ContentKeyFunctions.Hotbar8,
                  HandleHotbarKeybind(7))
            .Bind(ContentKeyFunctions.Hotbar9,
                  HandleHotbarKeybind(8))
            .Bind(ContentKeyFunctions.Hotbar0,
                  HandleHotbarKeybind(9))
            // when selecting a target, we intercept clicks in the game world, treating them as our target selection. We want to
            // take priority before any other systems handle the click.
            .BindBefore(EngineKeyFunctions.Use, new PointerInputCmdHandler(TargetingOnUse),
                        typeof(ConstructionSystem), typeof(DragDropSystem))
            .Register <ActionsSystem>();
        }
Example #10
0
        public static void SetupChatInputHandlers(IInputManager inputManager, ChatBox chatBox)
        {
            inputManager.SetInputCommand(ContentKeyFunctions.FocusChat,
                                         InputCmdHandler.FromDelegate(_ => GameScreen.FocusChat(chatBox)));

            inputManager.SetInputCommand(ContentKeyFunctions.FocusLocalChat,
                                         InputCmdHandler.FromDelegate(_ => GameScreen.FocusChannel(chatBox, ChatSelectChannel.Local)));

            inputManager.SetInputCommand(ContentKeyFunctions.FocusWhisperChat,
                                         InputCmdHandler.FromDelegate(_ => GameScreen.FocusChannel(chatBox, ChatSelectChannel.Whisper)));

            inputManager.SetInputCommand(ContentKeyFunctions.FocusOOC,
                                         InputCmdHandler.FromDelegate(_ => GameScreen.FocusChannel(chatBox, ChatSelectChannel.OOC)));

            inputManager.SetInputCommand(ContentKeyFunctions.FocusAdminChat,
                                         InputCmdHandler.FromDelegate(_ => GameScreen.FocusChannel(chatBox, ChatSelectChannel.Admin)));

            inputManager.SetInputCommand(ContentKeyFunctions.FocusRadio,
                                         InputCmdHandler.FromDelegate(_ => GameScreen.FocusChannel(chatBox, ChatSelectChannel.Radio)));

            inputManager.SetInputCommand(ContentKeyFunctions.FocusDeadChat,
                                         InputCmdHandler.FromDelegate(_ => GameScreen.FocusChannel(chatBox, ChatSelectChannel.Dead)));

            inputManager.SetInputCommand(ContentKeyFunctions.FocusConsoleChat,
                                         InputCmdHandler.FromDelegate(_ => GameScreen.FocusChannel(chatBox, ChatSelectChannel.Console)));

            inputManager.SetInputCommand(ContentKeyFunctions.CycleChatChannelForward,
                                         InputCmdHandler.FromDelegate(_ => chatBox.CycleChatChannel(true)));

            inputManager.SetInputCommand(ContentKeyFunctions.CycleChatChannelBackward,
                                         InputCmdHandler.FromDelegate(_ => chatBox.CycleChatChannel(false)));
        }
Example #11
0
        private void _joinGame(MsgTickerJoinGame message)
        {
            if (_tickerState == TickerState.InGame)
            {
                return;
            }

            _tickerState = TickerState.InGame;

            if (_lobby != null)
            {
                _lobby.Dispose();
                _lobby = null;
            }

            _inputManager.SetInputCommand(ContentKeyFunctions.FocusChat,
                                          InputCmdHandler.FromDelegate(session =>
            {
                _gameChat.Input.IgnoreNext = true;
                _gameChat.Input.GrabKeyboardFocus();
            }));

            _gameChat = new ChatBox();
            _userInterfaceManager.StateRoot.AddChild(_gameChat);
            _chatManager.SetChatBox(_gameChat);
            _tutorialButton = new TutorialButton();
            _userInterfaceManager.StateRoot.AddChild(_tutorialButton);
            _tutorialButton.SetAnchorAndMarginPreset(Control.LayoutPreset.BottomLeft, Control.LayoutPresetMode.MinSize, 50);
            _gameChat.DefaultChatFormat = "say \"{0}\"";
        }
Example #12
0
        public override void Startup()
        {
            _characterSetup = new CharacterSetupGui(_entityManager, _resourceCache, _preferencesManager,
                                                    _prototypeManager);
            LayoutContainer.SetAnchorPreset(_characterSetup, LayoutContainer.LayoutPreset.Wide);
            _characterSetup.CloseButton.OnPressed += args =>
            {
                _characterSetup.Save();
                _lobby.CharacterPreview.UpdateUI();
                _userInterfaceManager.StateRoot.AddChild(_lobby);
                _userInterfaceManager.StateRoot.RemoveChild(_characterSetup);
            };

            _lobby = new LobbyGui(_entityManager, _resourceCache, _preferencesManager);
            _userInterfaceManager.StateRoot.AddChild(_lobby);

            LayoutContainer.SetAnchorPreset(_lobby, LayoutContainer.LayoutPreset.Wide);

            _chatManager.SetChatBox(_lobby.Chat);
            _lobby.Chat.DefaultChatFormat = "ooc \"{0}\"";

            _lobby.ServerName.Text = _baseClient.GameInfo.ServerName;

            _inputManager.SetInputCommand(ContentKeyFunctions.FocusChat,
                                          InputCmdHandler.FromDelegate(s => GameScreen.FocusChat(_lobby.Chat)));

            UpdateLobbyUi();

            _lobby.CharacterPreview.CharacterSetupButton.OnPressed += args =>
            {
                SetReady(false);
                _userInterfaceManager.StateRoot.RemoveChild(_lobby);
                _userInterfaceManager.StateRoot.AddChild(_characterSetup);
            };

            _lobby.ObserveButton.OnPressed += args => _console.ProcessCommand("observe");
            _lobby.ReadyButton.OnPressed   += args =>
            {
                if (!_clientGameTicker.IsGameStarted)
                {
                    return;
                }

                _console.ProcessCommand("joingame");
            };

            _lobby.ReadyButton.OnToggled += args =>
            {
                SetReady(args.Pressed);
            };

            _lobby.LeaveButton.OnPressed   += args => _console.ProcessCommand("disconnect");
            _lobby.CreditsButton.OnPressed += args => new CreditsWindow().Open();

            UpdatePlayerList();

            _playerManager.PlayerListUpdated     += PlayerManagerOnPlayerListUpdated;
            _clientGameTicker.InfoBlobUpdated    += UpdateLobbyUi;
            _clientGameTicker.LobbyStatusUpdated += UpdateLobbyUi;
        }
Example #13
0
        /// <inheritdoc />
        public override void Initialize()
        {
            _pauseManager = IoCManager.Resolve <IPauseManager>();
            EntityQuery   = new TypeEntityQuery(typeof(PlayerInputMoverComponent));

            var moveUpCmdHandler = InputCmdHandler.FromDelegate(
                session => HandleDirChange(session, Direction.North, true),
                session => HandleDirChange(session, Direction.North, false));
            var moveLeftCmdHandler = InputCmdHandler.FromDelegate(
                session => HandleDirChange(session, Direction.West, true),
                session => HandleDirChange(session, Direction.West, false));
            var moveRightCmdHandler = InputCmdHandler.FromDelegate(
                session => HandleDirChange(session, Direction.East, true),
                session => HandleDirChange(session, Direction.East, false));
            var moveDownCmdHandler = InputCmdHandler.FromDelegate(
                session => HandleDirChange(session, Direction.South, true),
                session => HandleDirChange(session, Direction.South, false));
            var runCmdHandler = InputCmdHandler.FromDelegate(
                session => HandleRunChange(session, true),
                session => HandleRunChange(session, false));

            var input = EntitySystemManager.GetEntitySystem <InputSystem>();

            input.BindMap.BindFunction(EngineKeyFunctions.MoveUp, moveUpCmdHandler);
            input.BindMap.BindFunction(EngineKeyFunctions.MoveLeft, moveLeftCmdHandler);
            input.BindMap.BindFunction(EngineKeyFunctions.MoveRight, moveRightCmdHandler);
            input.BindMap.BindFunction(EngineKeyFunctions.MoveDown, moveDownCmdHandler);
            input.BindMap.BindFunction(EngineKeyFunctions.Run, runCmdHandler);
        }
Example #14
0
        public override void Startup()
        {
            base.Startup();

            _gameChat = new ChatBox();

            _userInterfaceManager.StateRoot.AddChild(_gameChat);
            LayoutContainer.SetAnchorAndMarginPreset(_gameChat, LayoutContainer.LayoutPreset.TopRight, margin: 10);
            LayoutContainer.SetAnchorAndMarginPreset(_gameChat, LayoutContainer.LayoutPreset.TopRight, margin: 10);
            LayoutContainer.SetMarginLeft(_gameChat, -475);
            LayoutContainer.SetMarginBottom(_gameChat, 235);

            _userInterfaceManager.StateRoot.AddChild(_gameHud.RootControl);
            _chatManager.SetChatBox(_gameChat);
            _gameChat.DefaultChatFormat = "say \"{0}\"";
            _gameChat.Input.PlaceHolder = Loc.GetString("Say something! [ for OOC");

            _inputManager.SetInputCommand(ContentKeyFunctions.FocusChat,
                                          InputCmdHandler.FromDelegate(s => FocusChat(_gameChat)));

            _inputManager.SetInputCommand(ContentKeyFunctions.FocusOOC,
                                          InputCmdHandler.FromDelegate(s => FocusOOC(_gameChat)));

            _inputManager.SetInputCommand(ContentKeyFunctions.FocusAdminChat,
                                          InputCmdHandler.FromDelegate(s => FocusAdminChat(_gameChat)));
        }
        private void _joinGame(MsgTickerJoinGame message)
        {
            if (_tickerState == TickerState.InGame)
            {
                return;
            }

            _tickerState = TickerState.InGame;

            if (_lobby != null)
            {
                _lobby.Dispose();
                _lobby = null;
            }

            _gameChat = new ChatBox();
            _userInterfaceManager.StateRoot.AddChild(_gameChat);
            _userInterfaceManager.StateRoot.AddChild(_gameHud.RootControl);
            _chatManager.SetChatBox(_gameChat);
            _gameChat.DefaultChatFormat = "say \"{0}\"";
            _gameChat.Input.PlaceHolder = _localization.GetString("Say something! [ for OOC");

            _inputManager.SetInputCommand(ContentKeyFunctions.FocusChat,
                                          InputCmdHandler.FromDelegate(s => _focusChat(_gameChat)));
        }
Example #16
0
        public override void Initialize()
        {
            base.Initialize();

            SubscribeLocalEvent <HandsComponent, ExaminedEvent>(HandleExamined);
            SubscribeNetworkEvent <ActivateInHandMsg>(HandleActivateInHand);
            SubscribeNetworkEvent <ClientInteractUsingInHandMsg>(HandleInteractUsingInHand);
            SubscribeNetworkEvent <UseInHandMsg>(HandleUseInHand);
            SubscribeNetworkEvent <MoveItemFromHandMsg>(HandleMoveItemFromHand);
            SubscribeLocalEvent <HandsComponent, DisarmedEvent>(OnDisarmed, before: new[] { typeof(StunSystem) });

            SubscribeLocalEvent <HandsComponent, PullAttemptMessage>(HandlePullAttempt);
            SubscribeLocalEvent <HandsComponent, PullStartedMessage>(HandlePullStarted);
            SubscribeLocalEvent <HandsComponent, PullStoppedMessage>(HandlePullStopped);

            SubscribeLocalEvent <HandsComponent, ComponentGetState>(GetComponentState);

            CommandBinds.Builder
            .Bind(ContentKeyFunctions.ActivateItemInHand, InputCmdHandler.FromDelegate(s => HandleActivateItem(s)))
            .Bind(ContentKeyFunctions.AltActivateItemInHand, InputCmdHandler.FromDelegate(s => HandleActivateItem(s, true)))
            .Bind(ContentKeyFunctions.ThrowItemInHand, new PointerInputCmdHandler(HandleThrowItem))
            .Bind(ContentKeyFunctions.SmartEquipBackpack, InputCmdHandler.FromDelegate(HandleSmartEquipBackpack))
            .Bind(ContentKeyFunctions.SmartEquipBelt, InputCmdHandler.FromDelegate(HandleSmartEquipBelt))
            .Register <HandsSystem>();
        }
Example #17
0
#pragma warning restore 649

        public override void Initialize()
        {
            base.Initialize();

            var inputSystem = EntitySystemManager.GetEntitySystem <InputSystem>();

            inputSystem.BindMap.BindFunction(ContentKeyFunctions.ToggleCombatMode,
                                             InputCmdHandler.FromDelegate(CombatModeToggled));
        }
#pragma warning restore 649

        public override void Initialize()
        {
            base.Initialize();

            var inputSys = EntitySystemManager.GetEntitySystem <InputSystem>();

            inputSys.BindMap.BindFunction(ContentKeyFunctions.OpenInventoryMenu,
                                          InputCmdHandler.FromDelegate(s => HandleOpenInventoryMenu()));
        }
        public override void Initialize()
        {
            base.Initialize();

            CommandBinds.Builder
            .Bind(ContentKeyFunctions.OpenCharacterMenu,
                  InputCmdHandler.FromDelegate(s => HandleOpenCharacterMenu()))
            .Register <CharacterInterfaceSystem>();
        }
        private void _joinLobby(MsgTickerJoinLobby message)
        {
            if (_tickerState == TickerState.InLobby)
            {
                return;
            }

            if (_gameChat != null)
            {
                _gameChat.Dispose();
                _gameChat = null;
            }

            _gameHud.RootControl.Orphan();

            _tickerState = TickerState.InLobby;

            _lobby = new LobbyGui(_localization, _resourceCache);
            _userInterfaceManager.StateRoot.AddChild(_lobby);

            _lobby.SetAnchorAndMarginPreset(Control.LayoutPreset.Wide, margin: 20);

            _chatManager.SetChatBox(_lobby.Chat);
            _lobby.Chat.DefaultChatFormat = "ooc \"{0}\"";

            _lobby.ServerName.Text = _baseClient.GameInfo.ServerName;

            _inputManager.SetInputCommand(ContentKeyFunctions.FocusChat,
                                          InputCmdHandler.FromDelegate(s => _focusChat(_lobby.Chat)));

            _updateLobbyUi();

            _lobby.ObserveButton.OnPressed += args => _console.ProcessCommand("observe");
            _lobby.ReadyButton.OnPressed   += args =>
            {
                if (!_gameStarted)
                {
                    return;
                }

                _console.ProcessCommand("joingame");
            };

            _lobby.ReadyButton.OnToggled += args =>
            {
                if (_gameStarted)
                {
                    return;
                }

                _console.ProcessCommand($"toggleready {args.Pressed}");
            };

            _lobby.LeaveButton.OnPressed += args => _console.ProcessCommand("disconnect");

            _updatePlayerList();
        }
Example #21
0
        public override void Initialize()
        {
            base.Initialize();

            CommandBinds.Builder
            .Bind(ContentKeyFunctions.OpenInventoryMenu,
                  InputCmdHandler.FromDelegate(_ => HandleOpenInventoryMenu()))
            .Register <ClientInventorySystem>();
        }
Example #22
0
        public void Initialize()
        {
            _commandWindows = new List <SS14Window>();
            // Reset the AdminMenu Window on disconnect
            _netManager.Disconnect += (sender, channel) => ResetWindow();

            _inputManager.SetInputCommand(ContentKeyFunctions.OpenAdminMenu,
                                          InputCmdHandler.FromDelegate(session => Toggle()));
        }
Example #23
0
        private void _joinLobby(MsgTickerJoinLobby message)
        {
            if (_tickerState == TickerState.InLobby)
            {
                return;
            }

            if (_gameChat != null)
            {
                _gameChat.Dispose();
                _gameChat = null;
            }

            _tickerState = TickerState.InLobby;

            _lobby = new LobbyGui();
            _userInterfaceManager.StateRoot.AddChild(_lobby);

            _chatManager.SetChatBox(_lobby.Chat);
            _lobby.Chat.DefaultChatFormat = "ooc \"{0}\"";

            _lobby.ServerName.Text = _baseClient.GameInfo.ServerName;

            _inputManager.SetInputCommand(ContentKeyFunctions.FocusChat,
                                          InputCmdHandler.FromDelegate(session =>
            {
                _lobby.Chat.Input.IgnoreNext = true;
                _lobby.Chat.Input.GrabKeyboardFocus();
            }));

            _updateLobbyUi();

            _lobby.ObserveButton.OnPressed += args => _console.ProcessCommand("observe");
            _lobby.ReadyButton.OnPressed   += args =>
            {
                if (!_gameStarted)
                {
                    return;
                }

                _console.ProcessCommand("joingame");
            };

            _lobby.ReadyButton.OnToggled += args =>
            {
                if (_gameStarted)
                {
                    return;
                }

                _console.ProcessCommand($"toggleready {args.Pressed}");
            };

            _lobby.LeaveButton.OnPressed += args => _console.ProcessCommand("disconnect");
        }
        public override void Initialize()
        {
            base.Initialize();

            _gameHud.OnCombatModeChanged    = OnCombatModeChanged;
            _gameHud.OnTargetingZoneChanged = OnTargetingZoneChanged;

            _inputSystem = EntitySystemManager.GetEntitySystem <InputSystem>();
            _inputSystem.BindMap.BindFunction(ContentKeyFunctions.ToggleCombatMode,
                                              InputCmdHandler.FromDelegate(CombatModeToggled));
        }
        private const float ThrowForce = 1.5f; // Throwing force of mobs in Newtons

        /// <inheritdoc />
        public override void Initialize()
        {
            base.Initialize();

            var input = EntitySystemManager.GetEntitySystem <InputSystem>();

            input.BindMap.BindFunction(ContentKeyFunctions.SwapHands, InputCmdHandler.FromDelegate(HandleSwapHands));
            input.BindMap.BindFunction(ContentKeyFunctions.Drop, new PointerInputCmdHandler(HandleDrop));
            input.BindMap.BindFunction(ContentKeyFunctions.ActivateItemInHand, InputCmdHandler.FromDelegate(HandleActivateItem));
            input.BindMap.BindFunction(ContentKeyFunctions.ThrowItemInHand, new PointerInputCmdHandler(HandleThrowItem));
        }
#pragma warning restore 649

        public override void Initialize()
        {
            base.Initialize();

            SubscribeNetworkEvent <SetTargetZoneMessage>(SetTargetZoneHandler);
            SubscribeNetworkEvent <SetCombatModeActiveMessage>(SetCombatModeActiveHandler);

            var inputSystem = EntitySystemManager.GetEntitySystem <InputSystem>();

            inputSystem.BindMap.BindFunction(ContentKeyFunctions.ToggleCombatMode,
                                             InputCmdHandler.FromDelegate(CombatModeToggled));
        }
#pragma warning restore 649

        public override void Initialize()
        {
            base.Initialize();

            _gameHud.OnCombatModeChanged    = OnCombatModeChanged;
            _gameHud.OnTargetingZoneChanged = OnTargetingZoneChanged;

            CommandBinds.Builder
            .Bind(ContentKeyFunctions.ToggleCombatMode,
                  InputCmdHandler.FromDelegate(CombatModeToggled))
            .Register <CombatModeSystem>();
        }
        public void Initialize()
        {
            _inputManager.SetInputCommand(ContentKeyFunctions.TakeScreenshot, InputCmdHandler.FromDelegate(_ =>
            {
                Take(ScreenshotType.AfterUI);
            }));

            _inputManager.SetInputCommand(ContentKeyFunctions.TakeScreenshotNoUI, InputCmdHandler.FromDelegate(_ =>
            {
                Take(ScreenshotType.BeforeUI);
            }));
        }
Example #29
0
        public override void Initialize()
        {
            base.Initialize();

            SubscribeLocalEvent <HandsComponent, PlayerAttachedEvent>((_, component, _) => component.SettupGui());
            SubscribeLocalEvent <HandsComponent, PlayerDetachedEvent>((_, component, _) => component.ClearGui());

            CommandBinds.Builder
            .Bind(ContentKeyFunctions.SwapHands, InputCmdHandler.FromDelegate(SwapHandsPressed))
            .Bind(ContentKeyFunctions.Drop, new PointerInputCmdHandler(DropPressed))
            .Register <HandsSystem>();
        }
        public override void Initialize()
        {
            base.Initialize();

            CommandBinds.Builder
            .Bind(ContentKeyFunctions.OpenCharacterMenu,
                  InputCmdHandler.FromDelegate(s => HandleOpenCharacterMenu()))
            .Register <CharacterInterfaceSystem>();

            SubscribeLocalEvent <CharacterInterfaceComponent, PlayerAttachedEvent>((_, component, _) => component.PlayerAttached());
            SubscribeLocalEvent <CharacterInterfaceComponent, PlayerDetachedEvent>((_, component, _) => component.PlayerDetached());
        }