2023-04-09 12:00:52 +00:00
|
|
|
extends Node
|
|
|
|
|
2023-04-09 15:57:37 +00:00
|
|
|
@export var game_scene : Resource
|
|
|
|
@export var settings_scene : Resource
|
2023-04-10 21:31:07 +00:00
|
|
|
@export var default_focus : Control
|
2023-04-11 08:33:19 +00:00
|
|
|
@export var autostart_animations : Array[NodePath]
|
2023-04-16 07:53:02 +00:00
|
|
|
@export var music_player : AudioStreamPlayer
|
2023-04-09 12:00:52 +00:00
|
|
|
|
|
|
|
# Engine Callbackss
|
|
|
|
func _ready():
|
2023-04-10 21:55:55 +00:00
|
|
|
GlobalSettings.set_controls_from_save_file()
|
2023-04-09 12:00:52 +00:00
|
|
|
GlobalSettings.set_display_mode(Save.game_data.display_mode)
|
|
|
|
GlobalSettings.toggle_vsync(Save.game_data.vsync_on)
|
2023-04-09 13:04:49 +00:00
|
|
|
GlobalSettings.set_resolution(Save.game_data.current_resolution_index)
|
2023-04-11 14:54:04 +00:00
|
|
|
DisplayServer.window_set_min_size(Vector2(640,480))
|
2023-04-09 12:00:52 +00:00
|
|
|
GlobalSettings.update_master_volume(Save.game_data.master_volume)
|
|
|
|
GlobalSettings.update_music_volume(Save.game_data.music_volume)
|
|
|
|
GlobalSettings.update_sfx_volume(Save.game_data.sfx_volume)
|
2023-04-09 15:57:37 +00:00
|
|
|
default_focus.grab_focus()
|
2023-04-11 08:33:19 +00:00
|
|
|
for animation in autostart_animations:
|
|
|
|
(get_node(animation) as AnimationPlayer).play("Autostart")
|
2023-04-16 07:53:02 +00:00
|
|
|
music_player.play(0.0)
|
2023-04-09 12:00:52 +00:00
|
|
|
pass
|
|
|
|
|
|
|
|
func _on_play_button_pressed():
|
2023-04-09 15:57:37 +00:00
|
|
|
load(game_scene.resource_path)
|
|
|
|
get_tree().change_scene_to_file(game_scene.resource_path)
|
2023-04-09 12:00:52 +00:00
|
|
|
pass
|
|
|
|
|
|
|
|
func _on_settings_button_pressed():
|
2023-04-09 15:57:37 +00:00
|
|
|
var settings_scene_instance = load(settings_scene.resource_path).instantiate()
|
2023-04-10 20:46:15 +00:00
|
|
|
settings_scene_instance.on_back = Callable(func(): default_focus.grab_focus())
|
2023-04-09 15:57:37 +00:00
|
|
|
get_tree().current_scene.add_child(settings_scene_instance)
|
2023-04-09 12:00:52 +00:00
|
|
|
pass
|
|
|
|
|
|
|
|
func _on_about_button_pressed():
|
|
|
|
OS.shell_open("https://git.euph.dev/GameDev/HoppyEaster")
|
|
|
|
pass
|
|
|
|
|
|
|
|
func _on_quit_button_pressed():
|
|
|
|
get_tree().quit()
|
|
|
|
pass
|