diff options
author | metamuffin <metamuffin@disroot.org> | 2025-09-15 23:46:37 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-09-15 23:46:37 +0200 |
commit | ebb5c295c03cb1689c081006ad2ee167bd355d0a (patch) | |
tree | 1d62a388a97bfb09e5a01b565b2bae53acd966ce /client/gui | |
parent | 0b780e2271e63f10a2580afe9507d18d735527f8 (diff) | |
download | hurrycurry-ebb5c295c03cb1689c081006ad2ee167bd355d0a.tar hurrycurry-ebb5c295c03cb1689c081006ad2ee167bd355d0a.tar.bz2 hurrycurry-ebb5c295c03cb1689c081006ad2ee167bd355d0a.tar.zst |
move profile related functions to static Profile members
Diffstat (limited to 'client/gui')
-rw-r--r-- | client/gui/components/message/item/item_message.gd | 2 | ||||
-rw-r--r-- | client/gui/menus/character.gd | 14 | ||||
-rw-r--r-- | client/gui/menus/main/play.gd | 12 | ||||
-rw-r--r-- | client/gui/menus/setup/setup.gd | 8 | ||||
-rw-r--r-- | client/gui/overlays/popup_message/popup_message.gd | 34 |
5 files changed, 35 insertions, 35 deletions
diff --git a/client/gui/components/message/item/item_message.gd b/client/gui/components/message/item/item_message.gd index 4079e363..f5a97723 100644 --- a/client/gui/components/message/item/item_message.gd +++ b/client/gui/components/message/item/item_message.gd @@ -31,7 +31,7 @@ var timeout_initial := 0. @onready var v_box_container: VBoxContainer = $VBoxContainer func _ready() -> void: - Global.configure_viewport_aa(sub_viewport, Settings.read("graphics.aa")) + Global.configure_viewport_aa(sub_viewport) if enable_grayscale: sub_viewport_container.material = PRINTED_MAT diff --git a/client/gui/menus/character.gd b/client/gui/menus/character.gd index 3c1230ae..715a7b1f 100644 --- a/client/gui/menus/character.gd +++ b/client/gui/menus/character.gd @@ -22,8 +22,8 @@ extends Menu func _ready(): super() - $VBoxContainer/top_panel/a/username.text = Global.get_profile("username") - character.set_style(Global.get_profile("character_style"), "chef") + $VBoxContainer/top_panel/a/username.text = Profile.read("username") + character.set_style(Profile.read("character_style"), "chef") init_map() func init_map(): @@ -61,8 +61,8 @@ func exit(): popup_data.buttons = [accept_button] await submenu("res://gui/menus/popup.tscn", popup_data) return - Global.set_profile("username", username_edit.text) - Global.save_profile() + Profile.write("username", username_edit.text) + Profile.save() super() func _on_character_back_pressed(): @@ -90,7 +90,7 @@ func _on_hairstyle_forward_pressed() -> void: current_style.hairstyle = G.rem_euclid(current_style.hairstyle + 1, character.hairstyles.size())) func modify_style(modifier: Callable): - var current_style: Dictionary = Global.get_profile("character_style") + var current_style: Dictionary = Profile.read("character_style") modifier.call(current_style) - Global.set_profile("character_style", current_style) - character.set_style(Global.get_profile("character_style"), "chef") + Profile.write("character_style", current_style) + character.set_style(Profile.read("character_style"), "chef") diff --git a/client/gui/menus/main/play.gd b/client/gui/menus/main/play.gd index 87b0b5bf..1e64a02f 100644 --- a/client/gui/menus/main/play.gd +++ b/client/gui/menus/main/play.gd @@ -34,7 +34,7 @@ func _ready(): url_regex.compile("^(?:(ws|wss)://)?([^:]+)(?::([0-9]+))?$") if OS.has_feature("web"): server.hide() - connect_uri.text = Global.get_profile("last_server_url") + connect_uri.text = Profile.read("last_server_url") Sound.play_music("MainMenu") ServerList.update_server_list.connect(update_server_list) @@ -43,7 +43,7 @@ func _ready(): update_server_list_loading(ServerList.loading) super() - if not Global.get_profile("registry_asked"): + if not Profile.read("registry_asked"): var popup_data := MenuPopup.Data.new() popup_data.text = tr("c.menu.play.allow_query_registry").format([Settings.read("online.registry_url")]) var allow_button := Button.new() @@ -54,8 +54,8 @@ func _ready(): deny_button.pressed.connect(func(): Settings.write("online.use_registry", false)) popup_data.buttons = [allow_button, deny_button] await submenu("res://gui/menus/popup.tscn", popup_data) - Global.set_profile("registry_asked", true) - Global.save_profile() + Profile.write("registry_asked", true) + Profile.save() Settings.save() ServerList.start() @@ -110,8 +110,8 @@ func _on_connect_pressed(): if result.get_string(3) == "" and result.get_string(1) != "wss": url = url + ":27032" connect_uri.text = url - Global.set_profile("last_server_url", url) - Global.save_profile() + Profile.write("last_server_url", url) + Profile.save() connect_to(url) func _on_quick_connect_pressed(): diff --git a/client/gui/menus/setup/setup.gd b/client/gui/menus/setup/setup.gd index e4103603..878331ff 100644 --- a/client/gui/menus/setup/setup.gd +++ b/client/gui/menus/setup/setup.gd @@ -92,12 +92,12 @@ func _on_sign_pressed(): anim.play_backwards("paper_slide") await anim.animation_finished - Global.set_profile("username", username.text) - Global.set_profile("character_style", character_style) + Profile.write("username", username.text) + Profile.write("character_style", character_style) if skip_tutorial.button_pressed: for k in Global.profile["hints"].keys(): - Global.set_hint(k, true) - Global.save_profile() + Profile.set_hint(k, true) + Profile.save() Settings.write("gameplay.hints_started", skip_tutorial.button_pressed) Settings.write("gameplay.tutorial_disabled", skip_tutorial.button_pressed) diff --git a/client/gui/overlays/popup_message/popup_message.gd b/client/gui/overlays/popup_message/popup_message.gd index d577465b..6a3d8273 100644 --- a/client/gui/overlays/popup_message/popup_message.gd +++ b/client/gui/overlays/popup_message/popup_message.gd @@ -131,26 +131,26 @@ func stop_game_hints(): func _input(_event): if Input.is_action_just_pressed("boost"): - Global.set_hint("has_boosted", true) + Profile.set_hint("has_boosted", true) if any_action_just_pressed(["forwards", "backwards", "left", "right"]): - Global.set_hint("has_moved", true) + Profile.set_hint("has_moved", true) if any_action_just_pressed(["rotate_left", "rotate_right", "rotate_up", "rotate_down"]): - if not Global.get_hint("has_reset"): + if not Profile.get_hint("has_reset"): reset_timer.start() - Global.set_hint("has_rotated", true) + Profile.set_hint("has_rotated", true) if any_action_just_pressed(["zoom_in", "zoom_out"]): - Global.set_hint("has_zoomed", true) + Profile.set_hint("has_zoomed", true) if Input.is_action_just_pressed("interact_left") or Input.is_action_just_pressed("interact_right"): - Global.set_hint("has_interacted", true) + Profile.set_hint("has_interacted", true) if Input.is_action_just_pressed("reset"): - Global.set_hint("has_reset", true) + Profile.set_hint("has_reset", true) func _on_boost_timeout(): - if not Global.get_hint("has_boosted") and not Global.using_touch: + if not Profile.get_hint("has_boosted") and not Global.using_touch: display_hint_msg(tr("c.hint.boost").format([display_keybind("boost")])) func _on_move_timeout(): - if not Global.get_hint("has_moved") and not Global.using_touch: + if not Profile.get_hint("has_moved") and not Global.using_touch: display_hint_msg(tr("c.hint.movement").format([", ".join( [ display_keybind("forwards"), @@ -161,15 +161,15 @@ func _on_move_timeout(): )])) func _on_interact_timeout(): - if not Global.get_hint("has_interacted") and not Global.using_touch: + if not Profile.get_hint("has_interacted") and not Global.using_touch: display_hint_msg(tr("c.hint.interact").format([display_keybind("interact")])) func _on_reset_timeout(): - if not Global.get_hint("has_reset") and not Global.using_touch: + if not Profile.get_hint("has_reset") and not Global.using_touch: display_hint_msg(tr("c.hint.reset_camera").format([display_keybind("reset")])) func _on_zoom_timeout(): - if not Global.get_hint("has_zoomed") and not Global.using_touch: + if not Profile.get_hint("has_zoomed") and not Global.using_touch: display_hint_msg(tr("c.hint.zoom_camera").format([", ".join( [ display_keybind("zoom_in"), @@ -203,7 +203,7 @@ func any_action_just_pressed(actions: Array) -> bool: return false func _on_rotate_camera_timeout(): - if not Global.get_hint("has_rotated") and not Global.using_touch: + if not Profile.get_hint("has_rotated") and not Global.using_touch: display_hint_msg(tr("c.hint.rotate").format([", ".join( [ display_keybind("rotate_up"), @@ -214,13 +214,13 @@ func _on_rotate_camera_timeout(): )])) func _on_join_while_running_timeout(): - if not game.join_state == Game.JoinState.JOINED and not Global.get_hint("has_seen_join_while_running"): - Global.set_hint("has_seen_join_while_running", true) + if not game.join_state == Game.JoinState.JOINED and not Profile.get_hint("has_seen_join_while_running"): + Profile.set_hint("has_seen_join_while_running", true) display_hint_msg(tr("c.hint.join_while_running").format([display_keybind("menu")])) func _on_performance_timeout() -> void: - if not Global.get_hint("has_seen_performance") and Engine.get_frames_per_second() < DisplayServer.screen_get_refresh_rate() * 0.75: - Global.set_hint("has_seen_performance", true) + if not Profile.get_hint("has_seen_performance") and Engine.get_frames_per_second() < DisplayServer.screen_get_refresh_rate() * 0.75: + Profile.set_hint("has_seen_performance", true) display_hint_msg(tr("c.hint.framerate_low")) class PositionalMessage: |