Refactor game mode scoring and win conditions
* Add overridable hooks for sunk/reaped ball handling and turn behavior. * Implement default scoring and game-over messaging across game modes. * Add pretty game mode names for win-condition messages. * Update Free Ball, Last Ball, and Snooker modes to return win-condition messages. * Move the reset button lookup to the scene root for multiplayer setup. * Move camera controller scene to shared base UI. Move parts of it to new game_data UI node. * Add commented test state generation for end-state testing.
This commit is contained in:
25
scenes/ui_controls/base_ui.gd
Normal file
25
scenes/ui_controls/base_ui.gd
Normal file
@@ -0,0 +1,25 @@
|
||||
extends Control
|
||||
|
||||
|
||||
@onready var panel: Panel = $panel
|
||||
@onready var win_message_lbl: RichTextLabel = $panel/win_message_lbl
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
setup_signals()
|
||||
setup_multiplayer()
|
||||
|
||||
func setup_signals() -> void:
|
||||
MessageBus.subscribe("declare_win_condition", _on_declare_win_condition)
|
||||
|
||||
func setup_multiplayer() -> void:
|
||||
if not Globals.multiplayer_data.is_multiplayer_active: return
|
||||
|
||||
|
||||
func _on_declare_win_condition(message: String) -> void:
|
||||
panel.visible = true
|
||||
win_message_lbl.text = message
|
||||
|
||||
await get_tree().create_timer(5).timeout
|
||||
|
||||
MessageBus.emit_local("game_peer_disconnected", null)
|
||||
Reference in New Issue
Block a user