games.among_us.enhanced_ui¶
Enhanced Rich UI module for Among Us game visualization.
This module provides an enhanced rich console UI for visualizing the Among Us game, with better styling, animated visualizations, and improved game information display.
Classes¶
Enhanced UI for Among Us game with rich terminal graphics. |
Module Contents¶
- class games.among_us.enhanced_ui.EnhancedAmongUsUI(console=None)¶
Enhanced UI for Among Us game with rich terminal graphics.
This class provides a visually appealing terminal UI for Among Us games, with styled components, animations, and comprehensive game information.
- Features:
Beautiful game map visualization with colored squares
Animated transitions between game states
Detailed player status display
Vent and sabotage system visualization
Meeting and voting interfaces
Game over screens with detailed statistics
Initialize the UI.
- Parameters:
console (rich.console.Console | None) – Optional Rich console instance
- animate_move(move, state_before, state_after, player_id, delay=0.5)¶
Animate a move being made.
- Parameters:
state_before (haive.games.among_us.state.AmongUsState) – State before the move
state_after (haive.games.among_us.state.AmongUsState) – State after the move
player_id (str) – ID of the player making the move
delay (float) – Delay for animation
- Returns:
None
- Return type:
None
- create_game_info_panel(state)¶
Create a panel with general game information.
- Parameters:
state (haive.games.among_us.state.AmongUsState) – Current game state
- Returns:
Rich panel containing game information
- Return type:
rich.panel.Panel
- create_game_over_panel(state)¶
Create a panel for the game over screen.
- Parameters:
state (haive.games.among_us.state.AmongUsState) – Current game state
- Returns:
Rich panel for game over
- Return type:
rich.panel.Panel
- create_layout(state, player_id=None, legal_moves=None)¶
Create the complete layout for the game UI.
- Parameters:
state (haive.games.among_us.state.AmongUsState) – Current game state
player_id (str | None) – Optional ID of the current player’s perspective
legal_moves (list[dict[str, Any]] | None) – Optional list of legal moves for the player
- Returns:
Complete rich layout
- Return type:
rich.layout.Layout
- create_legal_moves_panel(legal_moves)¶
Create a panel showing legal moves.
- create_map_visualization(state, player_id=None)¶
Create a visual representation of the map with rooms, vents, and players.
- Parameters:
state (haive.games.among_us.state.AmongUsState) – Current game state
player_id (str | None) – Optional ID of the player whose perspective to show
- Returns:
Rich panel containing the map visualization
- Return type:
rich.panel.Panel
- create_meeting_panel(state)¶
Create a panel for the meeting phase.
- Parameters:
state (haive.games.among_us.state.AmongUsState) – Current game state
- Returns:
Rich panel for the meeting
- Return type:
rich.panel.Panel
- create_other_players_panel(state, player_id)¶
Create a panel showing information about other players.
- Parameters:
state (haive.games.among_us.state.AmongUsState) – Current game state
player_id (str) – ID of the current player
- Returns:
Rich panel containing other player information
- Return type:
rich.panel.Panel
- create_player_info_panel(state, player_id)¶
Create a panel with detailed information about the player.
- Parameters:
state (haive.games.among_us.state.AmongUsState) – Current game state
player_id (str) – ID of the player to show info for
- Returns:
Rich panel containing player information
- Return type:
rich.panel.Panel
- create_sabotage_panel(state, player_id=None)¶
Create a panel showing active sabotage information if any.
- Parameters:
state (haive.games.among_us.state.AmongUsState) – Current game state
player_id (str | None) – Optional ID of the current player
- Returns:
Rich panel for sabotage or None if no active sabotage
- Return type:
rich.panel.Panel | None
- display_final_results(final_state)¶
Display enhanced final game results.
- Parameters:
final_state (Any) – Final game state
- Returns:
None
- Return type:
None
- display_state(state_data, player_id=None, legal_moves=None)¶
Display the game state using enhanced rich UI.
- Parameters:
- Returns:
True if display was successful, False otherwise
- Return type:
- display_welcome()¶
Display welcome message and game introduction.
- Returns:
None
- Return type:
None
- extract_game_state(state_data)¶
Extract AmongUsState from various input formats.
- Parameters:
state_data (Any) – State data in various formats
- Returns:
AmongUsState instance or None if extraction fails
- Return type: