Skip to content

Commit

Permalink
add next & previous rebinding
Browse files Browse the repository at this point in the history
  • Loading branch information
nezvers committed Nov 20, 2024
1 parent 273933d commit b5c23a4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 4 additions & 3 deletions addons/top_down/scenes/ui/screens/control_rebinding.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[ext_resource type="PackedScene" uid="uid://cvx2xmr86fa7b" path="res://addons/top_down/scenes/ui/binding_button.tscn" id="2_lok53"]
[ext_resource type="Script" path="res://addons/top_down/scripts/input/control_reset_button.gd" id="2_u8xua"]
[ext_resource type="Resource" uid="uid://dsk5usbvnbqi3" path="res://addons/top_down/resources/global_resources/action_resource.tres" id="3_km2jh"]
[ext_resource type="Texture2D" uid="uid://c0cwfllupe0ka" path="res://addons/top_down/assets/images/kenney_input_prompt/Keyboard & Mouse/Double/mouse_move.png" id="3_mhje8"]
[ext_resource type="Texture2D" uid="uid://dw8xitws1dy4n" path="res://addons/top_down/assets/images/kenney_input_prompt/Keyboard & Mouse/Double/mouse_move.png" id="3_mhje8"]
[ext_resource type="Script" path="res://addons/top_down/scripts/input/BindingMenu.gd" id="5_87j6r"]
[ext_resource type="Script" path="res://addons/top_down/scripts/input/save_controls_event.gd" id="6_sswam"]

Expand Down Expand Up @@ -400,19 +400,20 @@ text = "Back"
[node name="ButtonAnimation" parent="MarginContainer/VBoxContainer/MenuButton" index="2"]
pressed_sound = null

[node name="BindingChoices" type="ColorRect" parent="." node_paths=PackedStringArray("button_list", "choice_button_group", "info_label", "focus_button", "new_button", "delete_button", "cancel_button", "back_button")]
[node name="BindingChoices" type="ColorRect" parent="." node_paths=PackedStringArray("button_list", "choice_button_group", "info_label", "focus_button", "new_button", "delete_button", "cancel_button", "back_button", "reset_button")]
visible = false
layout_mode = 2
color = Color(0, 0, 0, 0.662745)
script = ExtResource("5_87j6r")
button_list = [NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer2/ButtonRightKb"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer2/ButtonLeftKb"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer2/ButtonUpKb"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer2/ButtonDownKb"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer2/ButtonAimRightKb"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer2/ButtonAimLeftKb"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer2/ButtonAimUpKb"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer2/ButtonAimDownKb"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer2/ButtonAction1Kb"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer2/ButtonAction2Kb"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer2/ButtonPauseKb"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer3/ButtonRightGp"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer3/ButtonLeftGp"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer3/ButtonUpGp"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer3/ButtonDownGp"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer3/ButtonAimRightGp"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer3/ButtonAimLeftGp"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer3/ButtonAimUpGp"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer3/ButtonAimDownGp"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer3/ButtonAction1Gp"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer3/ButtonAction2Gp"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer3/ButtonPauseGp")]
button_list = [NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer2/ButtonRightKb"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer2/ButtonLeftKb"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer2/ButtonUpKb"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer2/ButtonDownKb"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer2/ButtonAimRightKb"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer2/ButtonAimLeftKb"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer2/ButtonAimUpKb"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer2/ButtonAimDownKb"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer2/ButtonAction1Kb"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer2/ButtonAction2Kb"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer2/ButtonPauseKb"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer3/ButtonRightGp"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer3/ButtonLeftGp"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer3/ButtonUpGp"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer3/ButtonDownGp"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer3/ButtonAimRightGp"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer3/ButtonAimLeftGp"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer3/ButtonAimUpGp"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer3/ButtonAimDownGp"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer3/ButtonAction1Gp"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer3/ButtonAction2Gp"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer3/ButtonPauseGp"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer2/ButtonNextKb"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer2/ButtonPreviousKb"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer3/ButtonNextGp"), NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer3/ButtonPreviousGp")]
choice_button_group = NodePath("CenterContainer/PanelContainer/MarginContainer/HBoxContainer")
info_label = NodePath("CenterContainer/PanelContainer/MarginContainer/LabelInfo")
focus_button = NodePath("CenterContainer/PanelContainer/MarginContainer/HBoxContainer/ButtonNew")
new_button = NodePath("CenterContainer/PanelContainer/MarginContainer/HBoxContainer/ButtonNew")
delete_button = NodePath("CenterContainer/PanelContainer/MarginContainer/HBoxContainer/ButtonDelete")
cancel_button = NodePath("CenterContainer/PanelContainer/MarginContainer/HBoxContainer/ButtonCancel")
back_button = NodePath("../MarginContainer/VBoxContainer/MenuButton/Button")
reset_button = NodePath("../MarginContainer/VBoxContainer/ScrollContainer/HBoxContainer/Player1/VBoxContainer/ButtonReset")

[node name="CenterContainer" type="CenterContainer" parent="BindingChoices"]
layout_mode = 1
Expand Down
3 changes: 3 additions & 0 deletions addons/top_down/scripts/input/BindingMenu.gd
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ extends ColorRect
@export var delete_button:Button
@export var cancel_button:Button
@export var back_button:Button
@export var reset_button:Button

var current_button:BindingButton
enum ChoiceType{NEW, DELETE, CANCEL}
Expand Down Expand Up @@ -51,6 +52,7 @@ func _open()->void:
choice_button_group.visible = true
info_label.visible = false
back_button.focus_mode = Control.FOCUS_NONE
reset_button.focus_mode = Control.FOCUS_NONE
for _button:BindingButton in button_list:
_button.focus_mode = Control.FOCUS_NONE

Expand All @@ -61,6 +63,7 @@ func _close()->void:
choice_button_group.visible = true
info_label.visible = false
back_button.focus_mode = Control.FOCUS_ALL
reset_button.focus_mode = Control.FOCUS_ALL
for _button:BindingButton in button_list:
_button.focus_mode = Control.FOCUS_ALL

Expand Down

0 comments on commit b5c23a4

Please sign in to comment.