public override void Shutdown() { base.Shutdown(); _gameChat.Dispose(); _gameHud.RootControl.Orphan(); }
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(); }
public override void Shutdown() { DisposePresenters(); base.Shutdown(); _gameChat?.Dispose(); _gameHud.RootControl.Orphan(); }
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"); }
private void BaseClientOnRunLevelChanged(object sender, RunLevelChangedEventArgs e) { if (e.NewLevel != ClientRunLevel.Initialize) { return; } _tickerState = TickerState.Unset; _lobby?.Dispose(); _lobby = null; _gameChat?.Dispose(); _gameChat = null; }
private void BaseClientOnRunLevelChanged(object sender, RunLevelChangedEventArgs e) { if (e.NewLevel != ClientRunLevel.Initialize) { _inputManager.SetInputCommand(ContentKeyFunctions.FocusChat, null); return; } _tickerState = TickerState.Unset; _lobby?.Dispose(); _lobby = null; _gameChat?.Dispose(); _gameChat = null; _gameHud.RootControl.Orphan(); }
private void _joinLobby(MsgTickerJoinLobby message) { if (_tickerState == TickerState.InLobby) { return; } if (_gameChat != null) { _gameChat.Dispose(); _gameChat = null; } _gameHud.RootControl.Orphan(); _tickerState = TickerState.InLobby; _characterSetup = new CharacterSetupGui(_entityManager, _localization, _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, _localization, _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 => _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 (!_gameStarted) { return; } _console.ProcessCommand("joingame"); }; _lobby.ReadyButton.OnToggled += args => { SetReady(args.Pressed); }; _lobby.LeaveButton.OnPressed += args => _console.ProcessCommand("disconnect"); _updatePlayerList(); }