26 lines
625 B
GDScript3
26 lines
625 B
GDScript3
|
|
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)
|