34 lines
868 B
GDScript3
34 lines
868 B
GDScript3
|
|
extends Control
|
||
|
|
|
||
|
|
|
||
|
|
@onready var player_lbl: Label = $vbox/hbox/hbox/player_lbl
|
||
|
|
@onready var active_lbl: Label = $vbox/hbox/hbox/active_lbl
|
||
|
|
@onready var reset_bttn: Button = $vbox/hbox/hbox2/reset_bttn
|
||
|
|
|
||
|
|
|
||
|
|
func _ready() -> void:
|
||
|
|
setup_signals()
|
||
|
|
setup_multiplayer()
|
||
|
|
|
||
|
|
MessageBus.emit_local("update_active_lbl", null)
|
||
|
|
|
||
|
|
|
||
|
|
func setup_signals() -> void:
|
||
|
|
MessageBus.subscribe("update_active_lbl", _on_update_active_lbl)
|
||
|
|
|
||
|
|
func setup_multiplayer() -> void:
|
||
|
|
player_lbl.text = Globals.game_data.player_id
|
||
|
|
|
||
|
|
if not Globals.multiplayer_data.is_multiplayer_active: return
|
||
|
|
|
||
|
|
reset_bttn.pressed.disconnect(_on_reset_bttn_pressed)
|
||
|
|
reset_bttn.visible = false
|
||
|
|
|
||
|
|
|
||
|
|
func _on_update_active_lbl() -> void:
|
||
|
|
active_lbl.visible = \
|
||
|
|
Globals.multiplayer_data.current_turn_player_id == multiplayer.get_unique_id()
|
||
|
|
|
||
|
|
func _on_reset_bttn_pressed() -> void:
|
||
|
|
Globals.game_state.reload_scene.emit()
|