mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-06 10:03:26 -08:00
[Client] Address tournament UI review feedback
- Drop the in-game tournament-settings button: Command_TournamentSettingsSelect has no server handler (RespContextError), the host-ness decision was evaluated once at tab construction, and the button never received a label on first show. The dialog can be re-added together with a working Server_Player override. - Pass PlayerManager::isSpectator() to TournamentWidget instead of relying on localPlayerId == -1, which never holds for spectators. - Report games per match as the total series length (Best of %1) to match the DlgTournamentSettings hint and the server's use of the value; the previous gamesPerMatch * 2 - 1 mislabeled Bo3 as Best of 5. - Block signals around read-only tournamentCheckBox setChecked so the disabled settings button is not re-enabled, and seed Command_CreateGame through mutable_tournament_settings() (field 15 became the settings message). - return after closing a sub-game that routed to its parent tab.
This commit is contained in:
parent
de983ed01b
commit
a700f8d00d
6 changed files with 21 additions and 55 deletions
|
|
@ -75,6 +75,11 @@ void TournamentWidget::setLocalPlayerId(int playerId)
|
|||
localPlayerId = playerId;
|
||||
}
|
||||
|
||||
void TournamentWidget::setIsSpectator(bool spectator)
|
||||
{
|
||||
isSpectator = spectator;
|
||||
}
|
||||
|
||||
QString TournamentWidget::getPlayerName(const Event_TournamentState &state, int playerId) const
|
||||
{
|
||||
for (int i = 0; i < state.players_size(); ++i) {
|
||||
|
|
@ -93,15 +98,15 @@ void TournamentWidget::updateTournamentState(const Event_TournamentState &state)
|
|||
QString statusText;
|
||||
switch (state.phase()) {
|
||||
case Event_TournamentState::PHASE_DECK_BUILDING:
|
||||
statusText = gamesPerMatch > 1 ? tr("Tournament - Deck building (Best of %1)").arg(gamesPerMatch * 2 - 1)
|
||||
statusText = gamesPerMatch > 1 ? tr("Tournament - Deck building (Best of %1)").arg(gamesPerMatch)
|
||||
: tr("Tournament - Deck building");
|
||||
break;
|
||||
case Event_TournamentState::PHASE_PLAYING:
|
||||
statusText = gamesPerMatch > 1 ? tr("Tournament - Playing (Best of %1)").arg(gamesPerMatch * 2 - 1)
|
||||
statusText = gamesPerMatch > 1 ? tr("Tournament - Playing (Best of %1)").arg(gamesPerMatch)
|
||||
: tr("Tournament - Playing");
|
||||
break;
|
||||
case Event_TournamentState::PHASE_FINISHED:
|
||||
statusText = gamesPerMatch > 1 ? tr("Tournament - Finished (Best of %1)").arg(gamesPerMatch * 2 - 1)
|
||||
statusText = gamesPerMatch > 1 ? tr("Tournament - Finished (Best of %1)").arg(gamesPerMatch)
|
||||
: tr("Tournament - Finished");
|
||||
break;
|
||||
default:
|
||||
|
|
@ -134,7 +139,7 @@ void TournamentWidget::updateOpenMatchButton()
|
|||
openMatchButton->setEnabled(true);
|
||||
openMatchButton->setText(tr("Open match game"));
|
||||
openMatchButton->setToolTip(tr("Switch to your current match game"));
|
||||
} else if (localPlayerId == -1 && hasAnyLivePairing) {
|
||||
} else if (isSpectator && hasAnyLivePairing) {
|
||||
// Spectators have no pairing of their own but may watch any running match.
|
||||
openMatchButton->setEnabled(true);
|
||||
openMatchButton->setText(tr("Spectate live match"));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue