2021-10-01 14:23:48 +00:00
|
|
|
extends PanelContainer
|
|
|
|
|
|
|
|
onready var stage_label = $CenterContainer/HBoxContainer/VBoxContainer/StageName
|
|
|
|
onready var score = $CenterContainer/HBoxContainer/VBoxContainer/ScoreLabel
|
|
|
|
onready var play = $CenterContainer/HBoxContainer/PlayButton
|
2021-09-14 10:22:39 +00:00
|
|
|
|
|
|
|
func _ready():
|
|
|
|
var _game_stats = GameStats.connect("current_stage_changed", self, "update_info")
|
|
|
|
|
|
|
|
func update_info(stage):
|
2021-10-01 14:23:48 +00:00
|
|
|
play.disabled = false
|
2021-09-14 10:22:39 +00:00
|
|
|
var Stage = load(stage)
|
|
|
|
stage = Stage.instance()
|
|
|
|
|
2021-10-01 14:23:48 +00:00
|
|
|
score.text = String(stage.high_score)
|
|
|
|
play.visible = true
|
|
|
|
|
|
|
|
var filename = "user://" + stage.stage_name + ".dat"
|
|
|
|
var file = File.new()
|
|
|
|
if file.file_exists(filename):
|
|
|
|
var err = file.open(filename, File.READ)
|
|
|
|
if err == OK:
|
|
|
|
var data = file.get_var()
|
|
|
|
file.close()
|
|
|
|
score.text = String(data.high_score)
|
|
|
|
stage_label.text = String(stage.stage_name)
|