mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-07 02:23:25 -08:00
[Client] Add tournament UI for creating and following lobby tournaments
Wires the tournament protocol into the client: - DlgCreateGame gains a tournament checkbox with a games-per-match settings sub-dialog; both values are sent with Command_CreateGame and mirrored in the join-info variant of the dialog - TournamentWidget renders live standings (with deck-submission state) and pairings for the local player's perspective, and asks to open the current match game via openMatchGameRequested() - TournamentTabGameExtension attaches an overview page to TabGame's stacked views, mirrors phase and submission progress onto a deck-view status strip, and provides round-trip navigation between game view and standings; hosts get an in-game settings dialog during deck building - Open-match falls back to joining as spectator through TabSupervisor; sub-games now return to their parent tab on close, falling back to the normal leave-game flow when the parent is gone
This commit is contained in:
parent
dfa0edfcdb
commit
de983ed01b
11 changed files with 706 additions and 3 deletions
|
|
@ -39,6 +39,7 @@
|
|||
#include "libcockatrice/protocol/pb/serverinfo_playerproperties.pb.h"
|
||||
#include "libcockatrice/utility/card_ref.h"
|
||||
#include "tab_supervisor.h"
|
||||
#include "tournament_tab_game_extension.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QApplication>
|
||||
|
|
@ -168,6 +169,10 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor,
|
|||
createMenuItems();
|
||||
createViewMenuItems();
|
||||
|
||||
if (game->getGameMetaInfo()->isTournament()) {
|
||||
tournamentExtension = new TournamentTabGameExtension(this);
|
||||
}
|
||||
|
||||
connectToGameState();
|
||||
connectToPlayerManager();
|
||||
connectToGameEventHandler();
|
||||
|
|
@ -184,6 +189,10 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor,
|
|||
gameTypes.append(game->getGameMetaInfo()->findRoomGameType(i));
|
||||
}
|
||||
|
||||
if (tournamentExtension) {
|
||||
tournamentExtension->initializeTournamentMode();
|
||||
}
|
||||
|
||||
QTimer::singleShot(0, this, &TabGame::loadLayout);
|
||||
}
|
||||
|
||||
|
|
@ -441,6 +450,10 @@ void TabGame::retranslateUi()
|
|||
}
|
||||
|
||||
scene->retranslateUi();
|
||||
|
||||
if (tournamentExtension) {
|
||||
tournamentExtension->retranslateUi();
|
||||
}
|
||||
}
|
||||
|
||||
void TabGame::refreshShortcuts()
|
||||
|
|
@ -968,8 +981,22 @@ void TabGame::stopGame()
|
|||
}
|
||||
}
|
||||
|
||||
bool TabGame::switchToGameTab(int gameId)
|
||||
{
|
||||
return tabSupervisor->switchToGameTabIfAlreadyExists(gameId);
|
||||
}
|
||||
|
||||
void TabGame::closeGame()
|
||||
{
|
||||
int parentId = game->getGameMetaInfo()->parentGameId();
|
||||
if (parentId >= 0) {
|
||||
if (switchToGameTab(parentId)) {
|
||||
close();
|
||||
}
|
||||
// If the parent tab is gone, fall through to the normal leave-game
|
||||
// flow instead of stranding the user on a dead sub-game tab.
|
||||
}
|
||||
|
||||
gameMenu->clear();
|
||||
gameMenu->addAction(aLeaveGame);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue