33 lines
1 KiB
GDScript3
33 lines
1 KiB
GDScript3
|
|
extends Node2D
|
||
|
|
|
||
|
|
@onready var play_button: IconButton = $UI/PlayButton
|
||
|
|
@onready var editor_button: IconButton = $UI/EditorButton
|
||
|
|
@onready var quit_button: IconButton = $UI/QuitButton
|
||
|
|
@onready var status_label: Label = $UI/StatusLabel
|
||
|
|
|
||
|
|
|
||
|
|
func _ready() -> void:
|
||
|
|
play_button.pressed.connect(_on_play_pressed)
|
||
|
|
editor_button.pressed.connect(_on_editor_pressed)
|
||
|
|
# #48 wires the real map editor scene up to this button; until then it
|
||
|
|
# stays visible but explains itself instead of silently doing nothing
|
||
|
|
# or pointing at a scene that doesn't exist yet.
|
||
|
|
editor_button.enabled = false
|
||
|
|
quit_button.pressed.connect(_on_quit_pressed)
|
||
|
|
quit_button.visible = not OS.has_feature("web")
|
||
|
|
|
||
|
|
|
||
|
|
func _on_play_pressed() -> void:
|
||
|
|
GameState.reset_new_game()
|
||
|
|
get_tree().change_scene_to_file("res://Main.tscn")
|
||
|
|
|
||
|
|
|
||
|
|
func _on_editor_pressed() -> void:
|
||
|
|
if editor_button.enabled:
|
||
|
|
get_tree().change_scene_to_file("res://PlanetSetupEditor.tscn")
|
||
|
|
return
|
||
|
|
status_label.text = "Map editor coming soon"
|
||
|
|
|
||
|
|
|
||
|
|
func _on_quit_pressed() -> void:
|
||
|
|
get_tree().quit()
|