Swarm/GameOverMenu.gd

27 lines
644 B
GDScript3
Raw Normal View History

2024-03-16 19:56:22 +01:00
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()
Networking.disconnect_all()
get_tree().change_scene_to_file("res://UI/main_menu.tscn")