diff options
author | tpart <tpart120@proton.me> | 2025-09-30 14:34:30 +0200 |
---|---|---|
committer | tpart <tpart120@proton.me> | 2025-09-30 14:34:34 +0200 |
commit | b4a046026e687a3b44ce2be0cbab1150bd3545ca (patch) | |
tree | b32446ec30a9ded0e70c3489c4fadd288fd69412 /client | |
parent | 7fc0484a680ab777174aec1c1ffcbb61cd19c479 (diff) | |
download | hurrycurry-b4a046026e687a3b44ce2be0cbab1150bd3545ca.tar hurrycurry-b4a046026e687a3b44ce2be0cbab1150bd3545ca.tar.bz2 hurrycurry-b4a046026e687a3b44ce2be0cbab1150bd3545ca.tar.zst |
Store if correct explanation for input device was shown in profile
Diffstat (limited to 'client')
-rw-r--r-- | client/game.gd | 9 | ||||
-rw-r--r-- | client/gui/overlays/controls_visualization/explanation.gd | 11 | ||||
-rw-r--r-- | client/system/profile.gd | 6 | ||||
-rw-r--r-- | client/system/settings.gd | 3 |
4 files changed, 18 insertions, 11 deletions
diff --git a/client/game.gd b/client/game.gd index 9d2f7177..465c1aec 100644 --- a/client/game.gd +++ b/client/game.gd @@ -312,10 +312,11 @@ func handle_packet(p): elif not is_replay: menu.submenu("res://gui/menus/ingame.tscn") elif not in_lobby and not is_replay and not Global.using_touch and p.state: - if Global.hand_count == 1 and not Profile.read("controls_one_handed_explained"): - menu.submenu("res://gui/overlays/controls_visualization/explanation.tscn", false) - elif Global.hand_count == 2 and not Profile.read("controls_two_handed_explained"): - menu.submenu("res://gui/overlays/controls_visualization/explanation.tscn", true) + var using_joypad: bool = Global.using_joypad + var two_handed: bool = Global.hand_count >= 2 + var profile_name: String = "controls_%s_%s_handed_explained" % [("joypad" if using_joypad else "keyboard"), ("two" if two_handed else "one")] + if not Profile.read(profile_name): + menu.submenu("res://gui/overlays/controls_visualization/explanation.tscn", [profile_name, using_joypad, two_handed]) else: mp.send_ready() "score": diff --git a/client/gui/overlays/controls_visualization/explanation.gd b/client/gui/overlays/controls_visualization/explanation.gd index 47716a42..77147f1d 100644 --- a/client/gui/overlays/controls_visualization/explanation.gd +++ b/client/gui/overlays/controls_visualization/explanation.gd @@ -16,6 +16,8 @@ extends Menu class_name ControlsExplanation +var profile_name: String +var using_joypad: bool var two_handed: bool @onready var game: Game = $"../Game" @@ -25,15 +27,18 @@ var two_handed: bool @onready var controller_explanation: ControllerExplanation = $MarginContainer/PanelContainer/SmartMarginContainer/VBoxContainer/ControllerExplanation func _ready(): - two_handed = data + profile_name = data[0] + using_joypad = data[1] + two_handed = data[2] + @warning_ignore("incompatible_ternary") - var explanation: DeviceExplanation = controller_explanation if Global.using_joypad else keyboard_explanation + var explanation: DeviceExplanation = controller_explanation if using_joypad else keyboard_explanation explanation.visible = true explanation.toggle_double_handed(two_handed) title.text = tr("c.controls_explanation.two_handed") if two_handed else tr("c.settings.input") super() func _on_accept_pressed() -> void: - Profile.write("controls_" + ("two" if two_handed else "one") + "_handed_explained", true) + Profile.write(profile_name, true) game.mp.send_ready() exit() diff --git a/client/system/profile.gd b/client/system/profile.gd index 89496af5..dd4da430 100644 --- a/client/system/profile.gd +++ b/client/system/profile.gd @@ -26,8 +26,10 @@ static var default_profile := { "last_server_url": "", "tutorial_ingredients_played": [], "registry_asked": false, - "controls_one_handed_explained": false, - "controls_two_handed_explained": false + "controls_keyboard_one_handed_explained": false, + "controls_keyboard_two_handed_explained": false, + "controls_joypad_one_handed_explained": false, + "controls_joypad_two_handed_explained": false } # profile is stored in a Dictionary[String, Any] diff --git a/client/system/settings.gd b/client/system/settings.gd index 734492ae..e7f3e2f7 100644 --- a/client/system/settings.gd +++ b/client/system/settings.gd @@ -26,7 +26,6 @@ static func get_root(): ToggleSetting.new("interpolate_camera_rotation", false), ButtonSetting.new("setup_completed", false, launch_setup), ToggleSetting.new("tutorial_disabled", false), - ToggleSetting.new("hints_started", false), ToggleSetting.new("accessible_movement", false), ToggleSetting.new("first_person", false), DropdownSetting.new("interact_target", "dirsnap", ["dir", "dirsnap"]), @@ -195,4 +194,4 @@ static func h_fullscreen(mode: String): "keep": pass "always": DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN) "never": if DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_FULLSCREEN: - DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
\ No newline at end of file + DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED) |