From 4e30e939ce87a53ad8265cf5b7881b7535adfe46 Mon Sep 17 00:00:00 2001 From: Poleric Date: Fri, 5 Jun 2026 17:23:49 +0800 Subject: [PATCH] feat: add case if the round end without guesses --- .../gui/InventoryWars/OngoingView.qml | 15 +++++++++++++-- src/inventory_wars/gui/app.py | 4 ++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/inventory_wars/gui/InventoryWars/OngoingView.qml b/src/inventory_wars/gui/InventoryWars/OngoingView.qml index ae8f4dc..e798009 100644 --- a/src/inventory_wars/gui/InventoryWars/OngoingView.qml +++ b/src/inventory_wars/gui/InventoryWars/OngoingView.qml @@ -147,7 +147,7 @@ Rectangle { font.pixelSize: UIStyle.fontSizeM font.bold: true color: UIStyle.textColor - visible: root.gameService.state != GameService.GameState.Hidden + visible: root.gameService.revealed text: "Fastest guess: " + root.guessed.seconds + "s (by " + root.guessed.username + ")" } @@ -158,11 +158,22 @@ Rectangle { font.pixelSize: UIStyle.fontSizeM font.bold: true color: UIStyle.textColor - visible: root.gameService.state != GameService.GameState.Hidden && root.round.mode == GameService.GameScoring.FirstGuessThenHighestAmount + visible: root.gameService.revealed && root.round.mode == GameService.GameScoring.FirstGuessThenHighestAmount text: "Highest count: " + root.highest.count + " (by " + root.highest.username + ")" } + Text { + Layout.alignment: Qt.AlignHCenter + + font.pixelSize: UIStyle.fontSizeM + font.bold: true + color: UIStyle.textColor + visible: root.gameService.state == GameService.GameState.Ended && !root.gameService.revealed + + text: "No one guessed the item ;w;" + } + Item { Layout.fillHeight: true } Button { diff --git a/src/inventory_wars/gui/app.py b/src/inventory_wars/gui/app.py index af49963..90b7040 100644 --- a/src/inventory_wars/gui/app.py +++ b/src/inventory_wars/gui/app.py @@ -124,6 +124,10 @@ class GameService(QObject): self.m_revealed = True self.stateChanged.emit() + @Property(bool, notify=stateChanged) + def revealed(self) -> bool: + return self.m_revealed + @Slot() def end(self): self.m_game.end()