25 lines
611 B
GDScript
25 lines
611 B
GDScript
extends CanvasLayer
|
|
|
|
@onready var label = $Control/PanelContainer/VBoxContainer/Label
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
visible = false
|
|
GameEvents.game_over.connect(_on_game_over)
|
|
|
|
func _on_game_over(black_lost: bool, white_lost: bool) -> void:
|
|
visible = true
|
|
|
|
if black_lost and white_lost:
|
|
# draw
|
|
label.text = "Draw!"
|
|
elif black_lost:
|
|
label.text = "White won!"
|
|
elif white_lost:
|
|
label.text = "Black won!"
|
|
else:
|
|
print("should never happen...")
|
|
|
|
func _on_button_pressed():
|
|
WSClient.close()
|
|
get_tree().change_scene_to_file("res://main_menu.tscn")
|