2020-12-23 12:01:07 +01:00
|
|
|
extends Control
|
|
|
|
|
2021-09-08 17:00:51 +02:00
|
|
|
onready var popup = $VBoxContainer/Language
|
|
|
|
|
2020-12-23 12:01:07 +01:00
|
|
|
func _ready():
|
2021-09-15 16:26:41 +02:00
|
|
|
check_correct_lang_item()
|
2021-01-28 12:08:12 +01:00
|
|
|
if !OS.has_feature("standalone") and !game.skipped_title:
|
|
|
|
game.skipped_title = true
|
|
|
|
get_tree().change_scene("res://scenes/level_select.tscn")
|
2021-09-08 17:00:51 +02:00
|
|
|
|
|
|
|
make_popup_item()
|
2020-12-23 12:01:07 +01:00
|
|
|
|
|
|
|
func quit():
|
|
|
|
get_tree().quit()
|
|
|
|
|
|
|
|
func levels():
|
|
|
|
get_tree().change_scene("res://scenes/level_select.tscn")
|
2021-01-28 11:55:53 +01:00
|
|
|
|
|
|
|
|
|
|
|
func on_survey_pressed():
|
|
|
|
game.open_survey()
|
2021-02-04 15:19:54 +01:00
|
|
|
|
|
|
|
|
|
|
|
func sandbox():
|
|
|
|
game.current_chapter = levels.chapters.size() - 1
|
|
|
|
game.current_level = levels.chapters[game.current_chapter].levels.size() -1
|
|
|
|
get_tree().change_scene("res://scenes/main.tscn")
|
2021-09-08 17:00:51 +02:00
|
|
|
|
|
|
|
|
2021-09-15 16:26:41 +02:00
|
|
|
# Check the apropriate locale
|
|
|
|
func check_correct_lang_item():
|
|
|
|
for i in game.langs.keys():
|
|
|
|
if game.lang == game.langs[i]:
|
|
|
|
popup.get_popup().set_item_checked(i, true)
|
|
|
|
|
|
|
|
# Set all items to unchecked
|
2021-09-08 17:00:51 +02:00
|
|
|
func uncheck_all_item():
|
2021-09-15 16:26:41 +02:00
|
|
|
for i in game.langs.keys():
|
|
|
|
popup.get_popup().set_item_checked(i, false)
|
2021-09-08 17:00:51 +02:00
|
|
|
|
|
|
|
|
2021-09-15 16:26:41 +02:00
|
|
|
# Create popup items width allowed locales
|
2021-09-08 17:00:51 +02:00
|
|
|
func make_popup_item():
|
2021-09-15 16:26:41 +02:00
|
|
|
for i in game.langs.keys():
|
|
|
|
popup.get_popup().add_radio_check_item(game.langs[i], i)
|
2021-09-08 17:00:51 +02:00
|
|
|
|
|
|
|
uncheck_all_item()
|
|
|
|
|
2021-09-15 16:26:41 +02:00
|
|
|
check_correct_lang_item()
|
2021-09-08 17:00:51 +02:00
|
|
|
|
|
|
|
popup.get_popup().connect("id_pressed", self, "_on_item_pressed")
|
|
|
|
|
|
|
|
|
2021-09-15 16:26:41 +02:00
|
|
|
# Change the translations and localizations of the cards and strings
|
2021-09-08 17:00:51 +02:00
|
|
|
func _on_item_pressed(id):
|
|
|
|
uncheck_all_item()
|
|
|
|
|
|
|
|
popup.get_popup().set_item_checked(id, true)
|
|
|
|
game.lang = popup.get_popup().get_item_text(id)
|
|
|
|
|
|
|
|
|
|
|
|
TranslationServer.set_locale(game.lang)
|
2021-09-15 16:26:41 +02:00
|
|
|
|