diff --git a/game/InputMapEditor.tscn b/game/InputMapEditor.tscn new file mode 100644 index 00000000..dd2d4dfc --- /dev/null +++ b/game/InputMapEditor.tscn @@ -0,0 +1,8 @@ +[gd_scene format=2] + +[node name="InputMapEditor" type="InputMapEditor"] +anchor_right = 1.0 +anchor_bottom = 1.0 +__meta__ = { +"_edit_use_anchors_": false +} diff --git a/game/project.godot b/game/project.godot index dd0293b0..2214aecd 100644 --- a/game/project.godot +++ b/game/project.godot @@ -345,6 +345,266 @@ move_right={ "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":68,"unicode":0,"echo":false,"script":null) ] } +actionbar_2_0={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_2_1={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_2_2={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_2_3={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_2_4={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_2_5={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_2_6={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_2_7={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_2_8={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_2_9={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_2_10={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_2_11={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_2_12={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_3_0={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_3_1={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_3_2={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_3_3={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_3_4={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_3_5={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_3_6={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_3_7={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_3_8={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_3_9={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_3_10={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_3_11={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_3_12={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_4_0={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_4_1={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_4_2={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_4_3={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_4_4={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_4_5={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_4_6={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_4_7={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_4_8={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_4_9={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_4_10={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_4_11={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_4_12={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_5_0={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_5_1={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_5_2={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_5_3={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_5_4={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_5_5={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_5_6={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_5_7={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_5_8={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_5_9={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_5_10={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_5_11={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_5_12={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_6_0={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_6_1={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_6_2={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_6_3={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_6_4={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_6_5={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_6_6={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_6_7={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_6_8={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_6_9={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_6_10={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_6_11={ +"deadzone": 0.5, +"events": [ ] +} +actionbar_6_12={ +"deadzone": 0.5, +"events": [ ] +} [layer_names] diff --git a/game/ui/actionbars/ActionBarEntry.gd b/game/ui/actionbars/ActionBarEntry.gd index e2068a71..88ffb2df 100644 --- a/game/ui/actionbars/ActionBarEntry.gd +++ b/game/ui/actionbars/ActionBarEntry.gd @@ -53,6 +53,8 @@ func _ready() -> void: keybind_text = get_node(keybind_text_path) as Label button.connect("pressed", self, "_on_button_pressed") + + ProfileManager.connect("keybinds_changed", self, "on_keybinds_changed") func _exit_tree(): if icon_rect.texture != null: @@ -116,8 +118,28 @@ func set_button_entry(action_bar_button_entry: ActionBarButtonEntry, p_player: E if not InputMap.has_action(action_name): InputMap.add_action(action_name) + on_keybinds_changed() + + iea.action = action_name + iea.pressed = true + var sc : ShortCut = ShortCut.new() + sc.shortcut = iea + shortcut = sc + + setup_icon() + +func on_keybinds_changed(): + var action_name : String = "actionbar_" + str(button_entry.action_bar_id) + "_" + str(button_entry.slot_id) + + keybind_text.text = "" + + if not InputMap.has_action(action_name): + return + var action_list : Array = InputMap.get_action_list(action_name) + keybind_text.text = "" + for action in action_list: if action is InputEventKey: var s : String = "" @@ -141,14 +163,6 @@ func set_button_entry(action_bar_button_entry: ActionBarButtonEntry, p_player: E keybind_text.text = s - iea.action = action_name - iea.pressed = true - var sc : ShortCut = ShortCut.new() - sc.shortcut = iea - shortcut = sc - - setup_icon() - func setup_icon() -> void: if (button_entry.type == ActionBarButtonEntry.ACTION_BAR_BUTTON_ENTRY_TYPE_NONE): if icon_rect.texture != null: diff --git a/game/ui/icons/icon_add.svg b/game/ui/icons/icon_add.svg new file mode 100644 index 00000000..afad08a2 --- /dev/null +++ b/game/ui/icons/icon_add.svg @@ -0,0 +1 @@ + diff --git a/game/ui/icons/icon_add.svg.import b/game/ui/icons/icon_add.svg.import new file mode 100644 index 00000000..0b9fed67 --- /dev/null +++ b/game/ui/icons/icon_add.svg.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/icon_add.svg-8d234c23ab44bacb67bdfe3f0ee81a47.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://ui/icons/icon_add.svg" +dest_files=[ "res://.import/icon_add.svg-8d234c23ab44bacb67bdfe3f0ee81a47.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=1 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=false +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/game/ui/icons/icon_edit.svg b/game/ui/icons/icon_edit.svg new file mode 100644 index 00000000..6fc7ae01 --- /dev/null +++ b/game/ui/icons/icon_edit.svg @@ -0,0 +1 @@ + diff --git a/game/ui/icons/icon_edit.svg.import b/game/ui/icons/icon_edit.svg.import new file mode 100644 index 00000000..c40a25df --- /dev/null +++ b/game/ui/icons/icon_edit.svg.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/icon_edit.svg-1aba0748a13b323d6887f1edfd72e194.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://ui/icons/icon_edit.svg" +dest_files=[ "res://.import/icon_edit.svg-1aba0748a13b323d6887f1edfd72e194.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=1 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=false +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/game/ui/icons/icon_joy_axis.svg b/game/ui/icons/icon_joy_axis.svg new file mode 100644 index 00000000..1ab65f0a --- /dev/null +++ b/game/ui/icons/icon_joy_axis.svg @@ -0,0 +1 @@ + diff --git a/game/ui/icons/icon_joy_axis.svg.import b/game/ui/icons/icon_joy_axis.svg.import new file mode 100644 index 00000000..d43316af --- /dev/null +++ b/game/ui/icons/icon_joy_axis.svg.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/icon_joy_axis.svg-df8e548a1140e7ce99b04939b395b138.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://ui/icons/icon_joy_axis.svg" +dest_files=[ "res://.import/icon_joy_axis.svg-df8e548a1140e7ce99b04939b395b138.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=1 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=false +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/game/ui/icons/icon_joy_button.svg b/game/ui/icons/icon_joy_button.svg new file mode 100644 index 00000000..080d91ad --- /dev/null +++ b/game/ui/icons/icon_joy_button.svg @@ -0,0 +1 @@ + diff --git a/game/ui/icons/icon_joy_button.svg.import b/game/ui/icons/icon_joy_button.svg.import new file mode 100644 index 00000000..e054f36a --- /dev/null +++ b/game/ui/icons/icon_joy_button.svg.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/icon_joy_button.svg-90efe2841da127b700c9fe4f1211a539.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://ui/icons/icon_joy_button.svg" +dest_files=[ "res://.import/icon_joy_button.svg-90efe2841da127b700c9fe4f1211a539.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=1 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=false +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/game/ui/icons/icon_keyboard.svg b/game/ui/icons/icon_keyboard.svg new file mode 100644 index 00000000..75b62fc0 --- /dev/null +++ b/game/ui/icons/icon_keyboard.svg @@ -0,0 +1 @@ + diff --git a/game/ui/icons/icon_keyboard.svg.import b/game/ui/icons/icon_keyboard.svg.import new file mode 100644 index 00000000..de95ebee --- /dev/null +++ b/game/ui/icons/icon_keyboard.svg.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/icon_keyboard.svg-48afc1010696d26403af4139c2b28ebf.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://ui/icons/icon_keyboard.svg" +dest_files=[ "res://.import/icon_keyboard.svg-48afc1010696d26403af4139c2b28ebf.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=1 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=false +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/game/ui/icons/icon_mouse.svg b/game/ui/icons/icon_mouse.svg new file mode 100644 index 00000000..21751208 --- /dev/null +++ b/game/ui/icons/icon_mouse.svg @@ -0,0 +1 @@ + diff --git a/game/ui/icons/icon_mouse.svg.import b/game/ui/icons/icon_mouse.svg.import new file mode 100644 index 00000000..d8fd806d --- /dev/null +++ b/game/ui/icons/icon_mouse.svg.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/icon_mouse.svg-92245f2e2690694f01e281113add7d2d.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://ui/icons/icon_mouse.svg" +dest_files=[ "res://.import/icon_mouse.svg-92245f2e2690694f01e281113add7d2d.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=1 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=false +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/game/ui/icons/icon_remove.svg b/game/ui/icons/icon_remove.svg new file mode 100644 index 00000000..5bcdf8e5 --- /dev/null +++ b/game/ui/icons/icon_remove.svg @@ -0,0 +1 @@ + diff --git a/game/ui/icons/icon_remove.svg.import b/game/ui/icons/icon_remove.svg.import new file mode 100644 index 00000000..96744964 --- /dev/null +++ b/game/ui/icons/icon_remove.svg.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/icon_remove.svg-997114201fcc93bffd099fce5ecc1ae7.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://ui/icons/icon_remove.svg" +dest_files=[ "res://.import/icon_remove.svg-997114201fcc93bffd099fce5ecc1ae7.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=1 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=false +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/game/ui/keybinds/Keybinds.gd b/game/ui/keybinds/Keybinds.gd index 9d63e789..bcc3db4d 100644 --- a/game/ui/keybinds/Keybinds.gd +++ b/game/ui/keybinds/Keybinds.gd @@ -24,6 +24,24 @@ export(PackedScene) var keybind_category_scene : PackedScene export(NodePath) var content_container_path : NodePath +var _player : Entity + +func set_player(player : Entity): + if _player: + _player.disconnect("centity_data_changed", self, "on_data_changed") + + _player = player + + on_data_changed(_player.getc_entity_data()) + + _player.connect("centity_data_changed", self, "on_data_changed") + + +func on_data_changed(data): + if data: + ProfileManager.on_keybinds_changed(data.get_path()) + InputMap.load_from_globals() + # Note for the reader: # @@ -127,3 +145,12 @@ func a_ready(): # Do not start processing input until a button is pressed set_process_input(false) + +func close(): + InputMap.load_from_globals() + + if _player: + ProfileManager.on_keybinds_changed(_player.getc_entity_data().get_path()) + + hide() + diff --git a/game/ui/keybinds/Keybinds.tscn b/game/ui/keybinds/Keybinds.tscn index e6ba8334..5cf9150c 100644 --- a/game/ui/keybinds/Keybinds.tscn +++ b/game/ui/keybinds/Keybinds.tscn @@ -1,8 +1,15 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=11 format=2] [ext_resource path="res://ui/keybinds/Keybinds.gd" type="Script" id=1] [ext_resource path="res://ui/theme/ui_theme.tres" type="Theme" id=2] [ext_resource path="res://ui/keybinds/KeybindCategory.tscn" type="PackedScene" id=3] +[ext_resource path="res://ui/icons/icon_mouse.svg" type="Texture" id=4] +[ext_resource path="res://ui/icons/icon_joy_axis.svg" type="Texture" id=5] +[ext_resource path="res://ui/icons/icon_keyboard.svg" type="Texture" id=6] +[ext_resource path="res://ui/icons/icon_edit.svg" type="Texture" id=7] +[ext_resource path="res://ui/icons/icon_add.svg" type="Texture" id=8] +[ext_resource path="res://ui/icons/icon_remove.svg" type="Texture" id=9] +[ext_resource path="res://ui/icons/icon_joy_button.svg" type="Texture" id=10] [node name="KeybindWindow" type="PanelContainer"] anchor_right = 1.0 @@ -13,7 +20,6 @@ __meta__ = { "_edit_use_anchors_": false } keybind_category_scene = ExtResource( 3 ) -content_container_path = NodePath("VBoxContainer/ScrollContainer/Content") [node name="VBoxContainer" type="VBoxContainer" parent="."] margin_left = 4.0 @@ -27,7 +33,7 @@ margin_bottom = 30.0 [node name="Label" type="Label" parent="VBoxContainer/HBoxContainer"] margin_top = 7.0 -margin_right = 968.0 +margin_right = 972.0 margin_bottom = 22.0 size_flags_horizontal = 3 text = "Keybinds" @@ -39,17 +45,19 @@ margin_bottom = 30.0 rect_min_size = Vector2( 40, 30 ) text = "X" -[node name="ScrollContainer" type="ScrollContainer" parent="VBoxContainer"] +[node name="InputMapEditor" type="InputMapEditor" parent="VBoxContainer"] margin_top = 38.0 margin_right = 1016.0 margin_bottom = 554.0 size_flags_horizontal = 3 size_flags_vertical = 3 -scroll_horizontal_enabled = false - -[node name="Content" type="VBoxContainer" parent="VBoxContainer/ScrollContainer"] -margin_right = 1016.0 -size_flags_horizontal = 3 +add_texture = ExtResource( 8 ) +remove_texture = ExtResource( 9 ) +edit_texture = ExtResource( 7 ) +keyboard_texture = ExtResource( 6 ) +joybutton_texture = ExtResource( 10 ) +joyaxis_texture = ExtResource( 5 ) +mouse_texture = ExtResource( 4 ) [node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer"] margin_top = 562.0 @@ -58,8 +66,8 @@ margin_bottom = 592.0 alignment = 2 [node name="Button" type="Button" parent="VBoxContainer/HBoxContainer2"] -margin_left = 848.0 -margin_right = 928.0 +margin_left = 852.0 +margin_right = 932.0 margin_bottom = 30.0 rect_min_size = Vector2( 80, 30 ) text = "Cancel" @@ -71,3 +79,6 @@ margin_bottom = 30.0 rect_min_size = Vector2( 80, 30 ) text = "OK" [connection signal="pressed" from="VBoxContainer/HBoxContainer/Button" to="." method="hide"] +[connection signal="pressed" from="VBoxContainer/HBoxContainer2/Button" to="." method="hide"] +[connection signal="pressed" from="VBoxContainer/HBoxContainer2/Button2" to="." method="close"] +[connection signal="pressed" from="VBoxContainer/HBoxContainer2/Button2" to="VBoxContainer/InputMapEditor" method="queue_save"] diff --git a/game/ui/player_ui/player_ui.tscn b/game/ui/player_ui/player_ui.tscn index c3ddfce7..a748f6dc 100644 --- a/game/ui/player_ui/player_ui.tscn +++ b/game/ui/player_ui/player_ui.tscn @@ -44,7 +44,7 @@ script = ExtResource( 1 ) __meta__ = { "_edit_lock_": true } -child_controls = [ NodePath("Unitframes"), NodePath("Actionbars"), NodePath("Windows/SpellBookWindow"), NodePath("Buttons"), NodePath("Castbar"), NodePath("AuraFrame"), NodePath("Windows/Inventory"), NodePath("Windows/LootWindow"), NodePath("Windows/TalentWindow"), NodePath("Windows/CraftingWindow") ] +child_controls = [ NodePath("Unitframes"), NodePath("Actionbars"), NodePath("Windows/SpellBookWindow"), NodePath("Buttons"), NodePath("Castbar"), NodePath("AuraFrame"), NodePath("Windows/Inventory"), NodePath("Windows/LootWindow"), NodePath("Windows/TalentWindow"), NodePath("Windows/CraftingWindow"), NodePath("IngameMenu/KeybindWindow") ] [node name="TouchTargetControls" type="MarginContainer" parent="GUI"] visible = false @@ -460,3 +460,5 @@ visible = false [connection signal="toggled" from="GUI/Buttons/TalentButton" to="GUI/Windows/TalentWindow" method="_on_TalentButton_toggled"] [connection signal="toggled" from="GUI/Buttons/CraftingButton" to="GUI/Windows/CraftingWindow" method="_on_CraftingButton_toggled"] [connection signal="pressed" from="GUI/Buttons/Menu" to="GUI/IngameMenu" method="show"] + +[editable path="GUI/IngameMenu"]