Show display names everywhere accountId was shown in GameScreen
Server: - PlayerState: add DisplayName property (populated from identity DB) - PlayerStateDto: add DisplayName field (falls back to truncated ID) - GameEngine.ToDto: include DisplayName in player DTO - GameReadyHandler: resolve display names from identity DB after state initialization so every subsequent state push carries them Client: - Game.gd: add get_display_name(account_id) helper — reads displayName from player state, falls back to substr(0,8) - game_screen.gd: replace all 5 pid/eid/elim_id.substr(0,8) UI sites with Game.get_display_name() — HUD opp name, turn order strip, game-over outcome list, discard scope selector, elimination dialog - Turn order strip chips: use resolved display name; add mouse_filter STOP + tooltip_text showing SP/ST/Hand/Deck for opponent chips on hover Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -123,6 +123,18 @@ func get_opponent() -> Dictionary:
|
||||
return opps[0] if not opps.is_empty() else {}
|
||||
|
||||
|
||||
## Returns the display name for an account ID, using the name embedded in the game state.
|
||||
## Falls back to the first 8 characters of the ID if no name is available.
|
||||
func get_display_name(account_id: String) -> String:
|
||||
if account_id.is_empty(): return "?"
|
||||
for p: Dictionary in state.get("players", []):
|
||||
if str(p.get("accountId", "")) == account_id:
|
||||
var dn : String = str(p.get("displayName", ""))
|
||||
if not dn.is_empty(): return dn
|
||||
break
|
||||
return account_id.substr(0, min(8, account_id.length()))
|
||||
|
||||
|
||||
## Returns true when it is the local player's turn.
|
||||
func is_my_turn() -> bool:
|
||||
return str(state.get("activePlayerAccountId", "")) == Auth.user_id
|
||||
|
||||
Reference in New Issue
Block a user