diff --git a/backend/src/game/game.py b/backend/src/game/game.py index 212a8fe..e1fa00f 100644 --- a/backend/src/game/game.py +++ b/backend/src/game/game.py @@ -97,8 +97,27 @@ class Game: pass def get_hand(self, player_id): - """Retourne la main d'un joueur.""" - pass + """Retourne la main d'un joueur (0 = joueur humain, 1-3 = bots).""" + if player_id == 0: + hand = list(getattr(self.hand_player, 'tiles', [])) + if getattr(self.hand_player, 'draw', None) is not None: + hand = hand + [self.hand_player.draw] + elif 1 <= player_id <= 3: + hand_obj = self.hands_bots[player_id - 1] + hand = list(getattr(hand_obj, 'tiles', [])) + if getattr(hand_obj, 'draw', None) is not None: + hand = hand + [hand_obj.draw] + else: + return [] + return [ + { + 'id': tile.id, + 'family': str(tile.family), + 'value': str(tile.value), + 'svg': tile.get_img() + } + for tile in hand + ] def get_discards(self, player_id): """Retourne les tuiles défaussées d'un joueur.""" diff --git a/frontend/pages/riichi/chap5.html b/frontend/pages/riichi/chap5.html index 790a12f..a7cc405 100644 --- a/frontend/pages/riichi/chap5.html +++ b/frontend/pages/riichi/chap5.html @@ -40,14 +40,6 @@ display: flex; } - [id^="hand"] { - display: flex; - justify-content: center; - align-items: center; - gap: 5px; - padding: 20px; - } - #tiles-container { display: flex; justify-content: center; @@ -55,6 +47,69 @@ gap: 10px; padding: 20px; } + + :root { + --game_radius: 1100px; + } + #game-center { + display: flex; + align-items: center; + justify-content: center; + min-height: 100vh; + } + #game { + position: relatives; + width: var(--game_radius); + height: var(--game_radius); + } + + #hand-0 { + position: absolute; + transform: translate(-50%, 50%); + bottom: -10%; + left: 50%; + display: flex; + flex-direction: row; + align-items: flex-end; + gap: 5px; + padding: 20px 0 0 20px; + } + + #hand-1 { + position: absolute; + transform: translate(-50%, -400%) rotate(-90deg) translate(0%, 450%); + bottom: -10%; + left: 50%; + display: flex; + flex-direction: row; + align-items: flex-end; + gap: 5px; + padding: 20px 0 0 20px; + } + + #hand-2 { + position: absolute; + transform: translate(-50%, -400%) rotate(180deg) translate(0%, 450%); + bottom: -10%; + left: 50%; + display: flex; + flex-direction: row; + align-items: flex-end; + gap: 5px; + padding: 20px 0 0 20px; + } + + #hand-3 { + position: absolute; + transform: translate(-50%, -400%) rotate(90deg) translate(0%, 450%); + bottom: -10%; + left: 50%; + display: flex; + flex-direction: row; + align-items: flex-end; + gap: 5px; + padding: 20px 0 0 20px; + } @@ -65,7 +120,14 @@
-
+
+
+
+
+
+
+
+