layout, card, and design camera fixes
This commit is contained in:
@@ -123,6 +123,9 @@ func _connect_signals() -> void:
|
||||
GameManager.phase_changed.connect(_on_phase_changed)
|
||||
GameManager.damage_dealt.connect(_on_damage_dealt)
|
||||
|
||||
# Field card action signal (deferred to ensure game_ui is ready)
|
||||
call_deferred("_connect_field_card_signals")
|
||||
|
||||
func _start_game() -> void:
|
||||
GameManager.start_new_game()
|
||||
# Force an update of visuals after a frame to ensure everything is ready
|
||||
@@ -137,6 +140,11 @@ func _on_game_started() -> void:
|
||||
_sync_visuals()
|
||||
_update_hand_display()
|
||||
|
||||
# Set initial camera to first player's perspective
|
||||
if GameManager.game_state and table_setup:
|
||||
var player_index = GameManager.game_state.turn_manager.current_player_index
|
||||
table_setup.switch_camera_to_player(player_index)
|
||||
|
||||
func _on_game_ended(winner_name: String) -> void:
|
||||
game_ui.show_message(winner_name + " wins the game!")
|
||||
|
||||
@@ -145,9 +153,16 @@ func _on_turn_changed(_player_name: String, _turn_number: int) -> void:
|
||||
_update_hand_display()
|
||||
_update_cp_display()
|
||||
|
||||
# Rotate camera to face the current player's mat
|
||||
if GameManager.game_state and table_setup:
|
||||
var player_index = GameManager.game_state.turn_manager.current_player_index
|
||||
table_setup.switch_camera_to_player(player_index)
|
||||
|
||||
func _on_phase_changed(_phase_name: String) -> void:
|
||||
_update_playable_highlights()
|
||||
_update_cp_display()
|
||||
# Refresh hand after draw phase completes (hand updates on entering main phase)
|
||||
_update_hand_display()
|
||||
|
||||
func _on_damage_dealt(player_name: String, _amount: int) -> void:
|
||||
# Find player index
|
||||
@@ -229,7 +244,9 @@ func _on_hand_card_unhovered() -> void:
|
||||
game_ui.hide_card_detail()
|
||||
|
||||
func _on_hand_card_selected(_card: CardInstance) -> void:
|
||||
# Selection panel is now visible - ensure any stale hover preview is hidden
|
||||
# Close field card panel if open
|
||||
game_ui.hide_field_card_selection()
|
||||
# Ensure any stale hover preview is hidden
|
||||
game_ui.hide_card_detail()
|
||||
|
||||
func _on_undo_requested() -> void:
|
||||
@@ -248,32 +265,49 @@ func _on_undo_available_changed(available: bool) -> void:
|
||||
func _on_table_card_clicked(card: CardInstance, zone_type: Enums.ZoneType, player_index: int) -> void:
|
||||
var input_mode = GameManager.input_mode
|
||||
|
||||
# Handle special input modes first (these take priority)
|
||||
match input_mode:
|
||||
GameManager.InputMode.SELECT_CP_SOURCE:
|
||||
# Check if it's a backup we can dull
|
||||
if zone_type == Enums.ZoneType.FIELD_BACKUPS:
|
||||
if player_index == GameManager.game_state.turn_manager.current_player_index:
|
||||
GameManager.dull_backup_for_cp(card)
|
||||
_sync_visuals()
|
||||
_update_cp_display()
|
||||
return
|
||||
|
||||
GameManager.InputMode.SELECT_ATTACKER:
|
||||
# Select attacker
|
||||
if zone_type == Enums.ZoneType.FIELD_FORWARDS:
|
||||
if player_index == GameManager.game_state.turn_manager.current_player_index:
|
||||
GameManager.declare_attack(card)
|
||||
_sync_visuals()
|
||||
return
|
||||
|
||||
GameManager.InputMode.SELECT_BLOCKER:
|
||||
# Select blocker
|
||||
if zone_type == Enums.ZoneType.FIELD_FORWARDS:
|
||||
var opponent_index = 1 - GameManager.game_state.turn_manager.current_player_index
|
||||
if player_index == opponent_index:
|
||||
GameManager.declare_block(card)
|
||||
_sync_visuals()
|
||||
return
|
||||
|
||||
# Show card detail on any click
|
||||
game_ui.show_card_detail(card)
|
||||
# Close hand selection panel if open
|
||||
hand_display.deselect()
|
||||
# Show field card selection panel with card image and actions
|
||||
game_ui.show_field_card_selection(card, zone_type, player_index)
|
||||
|
||||
func _connect_field_card_signals() -> void:
|
||||
if game_ui:
|
||||
game_ui.field_card_action_requested.connect(_on_field_card_action)
|
||||
|
||||
func _on_field_card_action(card: CardInstance, zone_type: Enums.ZoneType, player_index: int, action: String) -> void:
|
||||
match action:
|
||||
"dull_cp":
|
||||
GameManager.dull_backup_for_cp(card)
|
||||
_sync_visuals()
|
||||
_update_cp_display()
|
||||
"attack":
|
||||
GameManager.declare_attack(card)
|
||||
_sync_visuals()
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
# Keyboard shortcuts
|
||||
@@ -301,3 +335,4 @@ func _input(event: InputEvent) -> void:
|
||||
GameManager.clear_selection()
|
||||
table_setup.clear_all_highlights()
|
||||
hand_display.clear_highlights()
|
||||
game_ui.hide_field_card_selection()
|
||||
|
||||
Reference in New Issue
Block a user