diff --git a/src/assets/styles/room.css b/src/assets/styles/room.css index fe06ac1..2675b63 100644 --- a/src/assets/styles/room.css +++ b/src/assets/styles/room.css @@ -807,7 +807,7 @@ .bottom-control-panel { position: absolute; left: 50%; - bottom: 8px; + bottom: 100px; transform: translateX(-50%); width: min(100% - 120px, 1180px); padding: 8px 14px 12px; @@ -880,17 +880,24 @@ display: flex; align-items: flex-end; justify-content: center; - gap: 4px; + gap: 12px; overflow-x: auto; padding-bottom: 2px; } +.player-hand-group { + display: flex; + align-items: flex-end; + gap: 0; + flex-shrink: 0; +} + .tile-chip { display: flex; align-items: flex-end; justify-content: center; - min-width: 90px; - height: 126px; + min-width: 74px; + height: 104px; padding: 0; border: 0; background: transparent; @@ -1083,8 +1090,8 @@ } .tile-chip { - min-width: 70px; - height: 102px; + min-width: 60px; + height: 88px; font-size: 24px; } @@ -1160,8 +1167,8 @@ } .tile-chip { - min-width: 48px; - height: 76px; + min-width: 42px; + height: 64px; font-size: 16px; } diff --git a/src/views/ChengduGamePage.vue b/src/views/ChengduGamePage.vue index a00bbe7..927a832 100644 --- a/src/views/ChengduGamePage.vue +++ b/src/views/ChengduGamePage.vue @@ -51,6 +51,7 @@ type DisplayPlayer = PlayerState & { } type GameActionPayload = Extract['payload'] +type HandSuitLabel = '万' | '筒' | '条' interface SeatViewModel { key: SeatKey @@ -132,6 +133,51 @@ const myHandTiles = computed(() => { return myPlayer.value?.handTiles ?? [] }) +const handSuitOrder: Record = { + W: 0, + T: 1, + B: 2, +} + +const handSuitLabelMap: Record = { + W: '万', + T: '筒', + B: '条', +} + +const visibleHandTileGroups = computed(() => { + const grouped = new Map() + + myHandTiles.value + .slice() + .sort((left, right) => { + const suitDiff = handSuitOrder[left.suit] - handSuitOrder[right.suit] + if (suitDiff !== 0) { + return suitDiff + } + + const valueDiff = left.value - right.value + if (valueDiff !== 0) { + return valueDiff + } + + return left.id - right.id + }) + .forEach((tile) => { + const label = handSuitLabelMap[tile.suit] + const current = grouped.get(label) ?? [] + current.push(tile) + grouped.set(label, current) + }) + + return (['万', '筒', '条'] as HandSuitLabel[]) + .map((suit) => ({ + suit, + tiles: grouped.get(suit) ?? [], + })) + .filter((group) => group.tiles.length > 0) +}) + const visibleHandTiles = computed(() => { if (gameStore.phase === 'waiting') { return [] @@ -1517,21 +1563,27 @@ onBeforeUnmount(() => {
- - + +