Unset ready status when opening character setup (#522)

* Close character setup when joining the game

* Unready when opening character setup instead
This commit is contained in:
DamianX
2020-01-20 00:15:39 +01:00
committed by Pieter-Jan Briers
parent 812654fe32
commit f08455073a

View File

@@ -220,6 +220,7 @@ namespace Content.Client.GameTicking
_lobby.CharacterPreview.CharacterSetupButton.OnPressed += args =>
{
SetReady(false);
_userInterfaceManager.StateRoot.RemoveChild(_lobby);
_userInterfaceManager.StateRoot.AddChild(_characterSetup);
};
@@ -237,12 +238,7 @@ namespace Content.Client.GameTicking
_lobby.ReadyButton.OnToggled += args =>
{
if (_gameStarted)
{
return;
}
_console.ProcessCommand($"toggleready {args.Pressed}");
SetReady(args.Pressed);
};
_lobby.LeaveButton.OnPressed += args => _console.ProcessCommand("disconnect");
@@ -250,6 +246,16 @@ namespace Content.Client.GameTicking
_updatePlayerList();
}
private void SetReady(bool newReady)
{
if (_gameStarted)
{
return;
}
_console.ProcessCommand($"toggleready {newReady}");
}
private void _joinGame(MsgTickerJoinGame message)
{
if (_tickerState == TickerState.InGame)