diff --git a/game/src/Game/GameSession/GameSession.gd b/game/src/Game/GameSession/GameSession.gd index 1fac9d5c..9d07fd6a 100644 --- a/game/src/Game/GameSession/GameSession.gd +++ b/game/src/Game/GameSession/GameSession.gd @@ -13,8 +13,6 @@ func _ready() -> void: MusicConductor.generate_playlist() MusicConductor.select_next_song() - Keychain.initialize_profiles() - func _process(_delta : float) -> void: GameSingleton.update_clock() diff --git a/game/src/Game/Menu/OptionMenu/KeychainShortcutEdit.gd b/game/src/Game/Menu/OptionMenu/KeychainShortcutEdit.gd new file mode 100644 index 00000000..29bf7f25 --- /dev/null +++ b/game/src/Game/Menu/OptionMenu/KeychainShortcutEdit.gd @@ -0,0 +1,27 @@ +extends "res://addons/keychain/ShortcutEdit.gd" + +func _ready() -> void: + # Setup Keychain for Hotkeys + for action : StringName in InputMap.get_actions(): + if not Keychain.keep_binding_check.call(action): + continue + Keychain.actions[action] = Keychain.InputAction.new( + action.erase(0, "button_".length()).left(-"_hotkey".length()).capitalize(), + "Hotkeys") + var display_name : String = Keychain.actions[action].display_name + if display_name.begins_with("Mapmode"): + var mapmode_index := display_name.replace("Mapmode", "").to_int() + display_name = tr(GameSingleton.get_mapmode_localisation_key(mapmode_index)) + if mapmode_index <= 10: + display_name = display_name\ + .replace(" Mapmode", "")\ + .replace("Mode de carte ", "")\ + .replace("-Kartenmodus", "")\ + .replace("Modo de mapa de ", "")\ + .replace("Modo mapa de ", "")\ + .replace("Modo mapa ", "") + display_name = tr("Mapmode %s") % display_name.capitalize() + Keychain.actions[action].display_name = display_name + Keychain.profiles[0].bindings[action] = InputMap.action_get_events(action) + + super._ready() diff --git a/game/src/Game/Menu/OptionMenu/KeychainShortcutEdit.tscn b/game/src/Game/Menu/OptionMenu/KeychainShortcutEdit.tscn new file mode 100644 index 00000000..8b5a782a --- /dev/null +++ b/game/src/Game/Menu/OptionMenu/KeychainShortcutEdit.tscn @@ -0,0 +1,7 @@ +[gd_scene load_steps=3 format=3 uid="uid://cka0tjqrek13"] + +[ext_resource type="PackedScene" uid="uid://bq7ibhm0txl5p" path="res://addons/keychain/ShortcutEdit.tscn" id="1_47eix"] +[ext_resource type="Script" path="res://src/Game/Menu/OptionMenu/KeychainShortcutEdit.gd" id="2_gr2m0"] + +[node name="ShortcutEdit" instance=ExtResource("1_47eix")] +script = ExtResource("2_gr2m0") diff --git a/game/src/Game/Menu/OptionMenu/OptionsMenu.gd b/game/src/Game/Menu/OptionMenu/OptionsMenu.gd index c487fb46..2b70d1ca 100644 --- a/game/src/Game/Menu/OptionMenu/OptionsMenu.gd +++ b/game/src/Game/Menu/OptionMenu/OptionsMenu.gd @@ -14,29 +14,6 @@ func _ready() -> void: _tab_container.set_tab_title(3, "OPTIONS_CONTROLS") _tab_container.set_tab_title(4, "OPTIONS_OTHER") - # Setup Keychain for Hotkeys - for action : StringName in InputMap.get_actions(): - if not Keychain.keep_binding_check.call(action): - continue - Keychain.actions[action] = Keychain.InputAction.new( - action.erase(0, "button_".length()).left(-"_hotkey".length()).capitalize(), - "Hotkeys") - var display_name : String = Keychain.actions[action].display_name - if display_name.begins_with("Mapmode"): - var mapmode_index := display_name.replace("Mapmode", "").to_int() - display_name = tr(GameSingleton.get_mapmode_localisation_key(mapmode_index)) - if mapmode_index <= 10: - display_name = display_name\ - .replace(" Mapmode", "")\ - .replace("Mode de carte ", "")\ - .replace("-Kartenmodus", "")\ - .replace("Modo de mapa de ", "")\ - .replace("Modo mapa de ", "")\ - .replace("Modo mapa ", "") - display_name = tr("Mapmode %s") % display_name.capitalize() - Keychain.actions[action].display_name = display_name - Keychain.profiles[0].bindings[action] = InputMap.action_get_events(action) - # Prepare options menu before loading user settings var tab_bar : TabBar = _tab_container.get_child(0, true) diff --git a/game/src/Game/Menu/OptionMenu/OptionsMenu.tscn b/game/src/Game/Menu/OptionMenu/OptionsMenu.tscn index a3637926..bb41fe15 100644 --- a/game/src/Game/Menu/OptionMenu/OptionsMenu.tscn +++ b/game/src/Game/Menu/OptionMenu/OptionsMenu.tscn @@ -5,8 +5,8 @@ [ext_resource type="PackedScene" uid="uid://bq3awxxjn1tuw" path="res://src/Game/Menu/OptionMenu/VideoTab.tscn" id="2_ji8xr"] [ext_resource type="PackedScene" uid="uid://cbtgwpx2wxi33" path="res://src/Game/Menu/OptionMenu/SoundTab.tscn" id="3_4w35t"] [ext_resource type="PackedScene" uid="uid://duwjal7sd7p6w" path="res://src/Game/Menu/OptionMenu/GeneralTab.tscn" id="3_6gvf6"] -[ext_resource type="PackedScene" uid="uid://bq7ibhm0txl5p" path="res://addons/keychain/ShortcutEdit.tscn" id="4_vdhjp"] [ext_resource type="PackedScene" uid="uid://dp2grvybtecqu" path="res://src/Game/Menu/OptionMenu/OtherTab.tscn" id="5_ahefp"] +[ext_resource type="PackedScene" uid="uid://cka0tjqrek13" path="res://src/Game/Menu/OptionMenu/KeychainShortcutEdit.tscn" id="6_f7qfn"] [node name="OptionsMenu" type="PanelContainer" node_paths=PackedStringArray("_tab_container")] editor_description = "UI-25" @@ -28,26 +28,31 @@ theme_type_variation = &"TabMargin" editor_description = "UI-45" layout_mode = 2 tab_alignment = 1 +current_tab = 0 use_hidden_tabs_for_min_size = true [node name="General" parent="Margin/Tab" instance=ExtResource("3_6gvf6")] layout_mode = 2 +metadata/_tab_index = 0 [node name="Video" parent="Margin/Tab" instance=ExtResource("2_ji8xr")] editor_description = "UI-46, UIFUN-43" visible = false layout_mode = 2 +metadata/_tab_index = 1 [node name="Sound" parent="Margin/Tab" instance=ExtResource("3_4w35t")] editor_description = "UI-47, UIFUN-44" visible = false layout_mode = 2 +metadata/_tab_index = 2 -[node name="Controls" parent="Margin/Tab" instance=ExtResource("4_vdhjp")] +[node name="Controls" parent="Margin/Tab" instance=ExtResource("6_f7qfn")] editor_description = "SS-27, UI-49, UIFUN-46" visible = false layout_mode = 2 -alignment = 1 +metadata/_tab_index = 3 [node name="Other" parent="Margin/Tab" instance=ExtResource("5_ahefp")] layout_mode = 2 +metadata/_tab_index = 4