extends Control ## Einstieg: hält den Spielstand und wechselt zwischen den Bildschirmen. var profile: Profile var screen: Control var save_path: String = Profile.SAVE_PATH var sfx: Sfx var net: Net func _ready() -> void: theme = Style.make_theme() var bg := Style.Backdrop.new() bg.set_anchors_preset(Control.PRESET_FULL_RECT) bg.mouse_filter = Control.MOUSE_FILTER_IGNORE add_child(bg) sfx = Sfx.new() add_child(sfx) # Fester Pfad /root/Net: Netzwerkaufrufe werden über den Knotenpfad zugestellt, # der bei Host und Mitspielern gleich sein muss. net = Net.new() net.name = "Net" get_tree().root.add_child.call_deferred(net) profile = Profile.load_or_new(save_path) profile.refresh_daily() sfx.set_volume(profile.settings.volume) sfx.set_music_volume(profile.settings.music) set_language(profile.settings.language) show_screen(MenuScreen.new()) func set_language(code: String) -> void: TranslationServer.set_locale(code) func show_screen(s: Control) -> void: if screen != null: screen.queue_free() screen = s s.app = self s.set_anchors_preset(Control.PRESET_FULL_RECT) add_child(s) func save() -> void: profile.save(save_path) func _exit_tree() -> void: if net != null and net.is_inside_tree(): net.leave() net.queue_free()