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; }
public override void Startup() { var gameTicker = EntitySystem.Get <ClientGameTicker>(); _characterSetup = new CharacterSetupGui(_entityManager, _resourceCache, _preferencesManager, _prototypeManager); LayoutContainer.SetAnchorPreset(_characterSetup, LayoutContainer.LayoutPreset.Wide); _characterSetup.CloseButton.OnPressed += _ => { _userInterfaceManager.StateRoot.AddChild(_lobby); _userInterfaceManager.StateRoot.RemoveChild(_characterSetup); }; _characterSetup.SaveButton.OnPressed += _ => { _characterSetup.Save(); _lobby?.CharacterPreview.UpdateUI(); }; _lobby = new LobbyGui(_entityManager, _preferencesManager); _userInterfaceManager.StateRoot.AddChild(_lobby); LayoutContainer.SetAnchorPreset(_lobby, LayoutContainer.LayoutPreset.Wide); _chatManager.SetChatBox(_lobby.Chat); _voteManager.SetPopupContainer(_lobby.VoteContainer); _lobby.Chat.DefaultChatFormat = "ooc \"{0}\""; _lobby.ServerName.Text = _baseClient.GameInfo?.ServerName; _inputManager.SetInputCommand(ContentKeyFunctions.FocusChat, InputCmdHandler.FromDelegate(_ => GameScreen.FocusChat(_lobby.Chat))); _inputManager.SetInputCommand(ContentKeyFunctions.FocusOOC, InputCmdHandler.FromDelegate(_ => GameScreen.FocusChannel(_lobby.Chat, ChatChannel.OOC))); _inputManager.SetInputCommand(ContentKeyFunctions.FocusAdminChat, InputCmdHandler.FromDelegate(_ => GameScreen.FocusChannel(_lobby.Chat, ChatChannel.AdminChat))); _inputManager.SetInputCommand(ContentKeyFunctions.CycleChatChannelForward, InputCmdHandler.FromDelegate(_ => _lobby.Chat.CycleChatChannel(true))); _inputManager.SetInputCommand(ContentKeyFunctions.CycleChatChannelBackward, InputCmdHandler.FromDelegate(_ => _lobby.Chat.CycleChatChannel(false))); UpdateLobbyUi(); _lobby.CharacterPreview.CharacterSetupButton.OnPressed += _ => { SetReady(false); _userInterfaceManager.StateRoot.RemoveChild(_lobby); _userInterfaceManager.StateRoot.AddChild(_characterSetup); }; _lobby.ObserveButton.OnPressed += _ => _consoleHost.ExecuteCommand("observe"); _lobby.ReadyButton.OnPressed += _ => { if (!gameTicker.IsGameStarted) { return; } new LateJoinGui().OpenCentered(); }; _lobby.ReadyButton.OnToggled += args => { SetReady(args.Pressed); }; _lobby.LeaveButton.OnPressed += _ => _consoleHost.ExecuteCommand("disconnect"); _lobby.OptionsButton.OnPressed += _ => new OptionsMenu().Open(); UpdatePlayerList(); _playerManager.PlayerListUpdated += PlayerManagerOnPlayerListUpdated; gameTicker.InfoBlobUpdated += UpdateLobbyUi; gameTicker.LobbyStatusUpdated += LobbyStatusUpdated; gameTicker.LobbyReadyUpdated += LobbyReadyUpdated; gameTicker.LobbyLateJoinStatusUpdated += LobbyLateJoinStatusUpdated; }
public override void Startup() { var gameTicker = EntitySystem.Get <ClientGameTicker>(); _characterSetup = new CharacterSetupGui(_entityManager, _resourceCache, _preferencesManager, _prototypeManager); LayoutContainer.SetAnchorPreset(_characterSetup, LayoutContainer.LayoutPreset.Wide); _characterSetup.CloseButton.OnPressed += _ => { _userInterfaceManager.StateRoot.AddChild(_lobby); _userInterfaceManager.StateRoot.RemoveChild(_characterSetup); }; _characterSetup.SaveButton.OnPressed += _ => { _characterSetup.Save(); _lobby?.CharacterPreview.UpdateUI(); }; _lobby = new LobbyGui(_entityManager, _preferencesManager); _userInterfaceManager.StateRoot.AddChild(_lobby); LayoutContainer.SetAnchorPreset(_lobby, LayoutContainer.LayoutPreset.Wide); _chatManager.SetChatBox(_lobby.Chat); _voteManager.SetPopupContainer(_lobby.VoteContainer); _lobby.ServerName.Text = _baseClient.GameInfo?.ServerName; ChatInput.SetupChatInputHandlers(_inputManager, _lobby.Chat); UpdateLobbyUi(); _lobby.CharacterPreview.CharacterSetupButton.OnPressed += _ => { SetReady(false); _userInterfaceManager.StateRoot.RemoveChild(_lobby); _userInterfaceManager.StateRoot.AddChild(_characterSetup); }; _lobby.ObserveButton.OnPressed += _ => _consoleHost.ExecuteCommand("observe"); _lobby.ReadyButton.OnPressed += _ => { if (!gameTicker.IsGameStarted) { return; } new LateJoinGui().OpenCentered(); }; _lobby.ReadyButton.OnToggled += args => { SetReady(args.Pressed); }; _lobby.LeaveButton.OnPressed += _ => _consoleHost.ExecuteCommand("disconnect"); _lobby.OptionsButton.OnPressed += _ => new OptionsMenu().Open(); UpdatePlayerList(); _playerManager.PlayerListUpdated += PlayerManagerOnPlayerListUpdated; gameTicker.InfoBlobUpdated += UpdateLobbyUi; gameTicker.LobbyStatusUpdated += LobbyStatusUpdated; gameTicker.LobbyReadyUpdated += LobbyReadyUpdated; gameTicker.LobbyLateJoinStatusUpdated += LobbyLateJoinStatusUpdated; }
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(); }