Lots of little tweaks and fixes
This commit is contained in:
@@ -2,12 +2,14 @@ class_name MainMenu extends Control
|
||||
|
||||
@export var btnNewGame:Button
|
||||
@export var btnSettings:Button
|
||||
@export var btnQuit:Button
|
||||
@export var settingsMenu:ClosableMenu
|
||||
@export_file("*.tscn") var newGameScene:String
|
||||
|
||||
func _ready() -> void:
|
||||
btnNewGame.pressed.connect(onNewGamePressed)
|
||||
btnSettings.pressed.connect(onSettingsPressed)
|
||||
btnQuit.pressed.connect(_onQuitPressed)
|
||||
settingsMenu.opened.connect(_onSettingsOpened)
|
||||
settingsMenu.closed.connect(_onSettingsClosed)
|
||||
btnNewGame.grab_focus()
|
||||
@@ -26,6 +28,13 @@ func _unhandled_input(event:InputEvent) -> void:
|
||||
settingsMenu.close()
|
||||
get_viewport().set_input_as_handled()
|
||||
|
||||
func _onQuitPressed() -> void:
|
||||
UI.QUIT_DIALOG.closed.connect(_onQuitDialogClosed, CONNECT_ONE_SHOT)
|
||||
UI.QUIT_DIALOG.open()
|
||||
|
||||
func _onQuitDialogClosed() -> void:
|
||||
btnQuit.grab_focus()
|
||||
|
||||
func onNewGamePressed() -> void:
|
||||
SCENE.setScene(SceneSingleton.SceneType.OVERWORLD)
|
||||
OVERWORLD.mapChange(newGameScene, "PlayerSpawnPoint")
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
[ext_resource type="Script" uid="uid://bcjfv6dw0ugvo" path="res://ui/component/ClosableMenu.gd" id="2_f3vro"]
|
||||
[ext_resource type="PackedScene" uid="uid://d3f31lli1ahts" path="res://ui/settings/SettingsMenu.tscn" id="3_44i87"]
|
||||
|
||||
[node name="Main Menu" type="Control" node_paths=PackedStringArray("btnNewGame", "btnSettings", "settingsMenu")]
|
||||
[node name="Main Menu" type="Control" node_paths=PackedStringArray("btnNewGame", "btnSettings", "btnQuit", "settingsMenu")]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
@@ -14,6 +14,7 @@ grow_vertical = 2
|
||||
script = ExtResource("1_vp3lc")
|
||||
btnNewGame = NodePath("VBoxContainer/NewGame")
|
||||
btnSettings = NodePath("VBoxContainer/Settings")
|
||||
btnQuit = NodePath("VBoxContainer/Quit")
|
||||
settingsMenu = NodePath("MainMenuSettings")
|
||||
newGameScene = "uid://d0ywgijpuqy0r"
|
||||
metadata/_custom_type_script = "uid://btfeuku41py2b"
|
||||
@@ -35,6 +36,10 @@ text = "New Game"
|
||||
layout_mode = 2
|
||||
text = "Settings"
|
||||
|
||||
[node name="Quit" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Quit Game"
|
||||
|
||||
[node name="MainMenuSettings" type="Control" parent="."]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
|
||||
Reference in New Issue
Block a user