diff options
-rw-r--r-- | client/global.gd | 3 | ||||
-rw-r--r-- | client/menu/menu.gd | 1 | ||||
-rw-r--r-- | client/menu/settings/button_setting.gd | 30 | ||||
-rw-r--r-- | client/menu/settings/button_setting.gd.uid | 1 | ||||
-rw-r--r-- | client/menu/setup.gd | 2 | ||||
-rw-r--r-- | client/settings.gd | 5 | ||||
-rw-r--r-- | locale/en.ini | 3 |
7 files changed, 42 insertions, 3 deletions
diff --git a/client/global.gd b/client/global.gd index 4c147198..f9682cbf 100644 --- a/client/global.gd +++ b/client/global.gd @@ -25,7 +25,7 @@ signal using_touch_change(using: bool) const VERSION := "2.3.1" var default_profile := { - "username": "Giovanni", + "username": "", "character_style": { "color": 0, "headwear": 0, @@ -64,6 +64,7 @@ var current_map_name := "" var last_map_name := "" # last map name for displaying in rating menu var focused_node: Control +var focused_menu: Menu # only use this as a last resort, currently exists to open setup menu from settings func _ready(): profile = load_dict("user://profile", default_profile) diff --git a/client/menu/menu.gd b/client/menu/menu.gd index 2e63a1fe..774c6c58 100644 --- a/client/menu/menu.gd +++ b/client/menu/menu.gd @@ -34,6 +34,7 @@ var open_since = 0 func _ready(): open_since = Time.get_ticks_msec() + Global.focused_menu = self focus_first(self) connect_button_sounds(self) update_parent_menu(self.get_parent()) diff --git a/client/menu/settings/button_setting.gd b/client/menu/settings/button_setting.gd new file mode 100644 index 00000000..2f6cf7c1 --- /dev/null +++ b/client/menu/settings/button_setting.gd @@ -0,0 +1,30 @@ +# Hurry Curry! - a game about cooking +# Copyright 2025 metamuffin +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, version 3 of the License only. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. +# +class_name ButtonSetting +extends GameSetting + +var callback + +func _init(new_id: String, new_default, callback_): + callback = callback_ + super (new_id, new_default) + +func create_row(): + var row = super () + row.value_node = Button.new() + row.value_node.text = tr(nskey + ".button_label") + row.value_node.pressed.connect(callback) + return row diff --git a/client/menu/settings/button_setting.gd.uid b/client/menu/settings/button_setting.gd.uid new file mode 100644 index 00000000..cf0a8d95 --- /dev/null +++ b/client/menu/settings/button_setting.gd.uid @@ -0,0 +1 @@ +uid://dku75bw31ux1k diff --git a/client/menu/setup.gd b/client/menu/setup.gd index f38f0bf7..b42000a0 100644 --- a/client/menu/setup.gd +++ b/client/menu/setup.gd @@ -46,6 +46,8 @@ func _ready(): # Enable msaa 2D for this scene Global.get_viewport().msaa_2d = Viewport.MSAA_4X + if Global.profile.username != "": username.text = Global.profile.username + super() func _character_selected(style: Dictionary): diff --git a/client/settings.gd b/client/settings.gd index 409e4b6b..57568670 100644 --- a/client/settings.gd +++ b/client/settings.gd @@ -26,7 +26,7 @@ static func get_root(): ToggleSetting.new("vibration", true), ToggleSetting.new("invert_camera", false), ToggleSetting.new("interpolate_camera_rotation", false), - ToggleSetting.new("setup_completed", false), + ButtonSetting.new("setup_completed", false , launch_setup), ToggleSetting.new("tutorial_disabled", false), ToggleSetting.new("hints_started", false), ToggleSetting.new("accessible_movement", false), @@ -102,6 +102,9 @@ static func get_category_dict(prefix: String): map[kn] = Global.get_setting(k) return map +static func launch_setup(): + Global.focused_menu.submenu("res://menu/setup.tscn") + static var change_hooks_display = {} static var change_hooks_apply = { "input": h_input, diff --git a/locale/en.ini b/locale/en.ini index 5666a55b..cbc00f4c 100644 --- a/locale/en.ini +++ b/locale/en.ini @@ -103,7 +103,8 @@ c.settings.gameplay.hints_started=Hints started c.settings.gameplay.interpolate_camera_rotation=Smooth camera rotation c.settings.gameplay.invert_camera=Invert camera movement c.settings.gameplay.latch_boost=Always extend boost to maximum duration -c.settings.gameplay.setup_completed=Initial setup complete. (Uncheck and restart to reenter) +c.settings.gameplay.setup_completed=Initial setup completed +c.settings.gameplay.setup_completed.button_label=Open setup form c.settings.gameplay.tutorial_disabled=Disable tutorial c.settings.gameplay.usernames=Show username tags c.settings.gameplay.vibration=Enable vibrations |