update control input

This commit is contained in:
AleaJactaEst 2022-04-15 14:33:00 +02:00
parent 0811638fd1
commit eab25005a1
15 changed files with 374 additions and 249 deletions

View file

@ -239,9 +239,18 @@ msgstr "Rotate camera and player follow"
msgid "INPUT_VIEW_CAMERA_MOVE_ONLY"
msgstr "Rotate camera only"
msgid "INPUT_VIEW_CAMERA_PLAYER_WALK"
msgid "INPUT_ACTION_CAMERA_MOVE_PLAYER"
msgstr "Rotate camera and player move"
msgid "INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW_MOUSE"
msgstr "Rotate camera and player follow (Mouse)"
msgid "INPUT_VIEW_CAMERA_MOVE_ONLY_MOUSE"
msgstr "Rotate camera only (Mouse)"
msgid "INPUT_ACTION_CAMERA_MOVE_PLAYER_MOUSE"
msgstr "Rotate camera and player move (Mouse)"
msgid "INPUT_ACTION_JUMP"
msgstr "Jump"
@ -289,4 +298,3 @@ msgstr "Reverse vertical"
msgid "NO_MOUSE_BUTTON"
msgstr "Nothing"

View file

@ -239,9 +239,18 @@ msgstr "Rotation de la caméra et le joueur suit"
msgid "INPUT_VIEW_CAMERA_MOVE_ONLY"
msgstr "Rotation de la caméra seulement"
msgid "INPUT_VIEW_CAMERA_PLAYER_WALK"
msgid "INPUT_ACTION_CAMERA_MOVE_PLAYER"
msgstr "Rotation de la caméra et déplacer le joueur dans la direction"
msgid "INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW_MOUSE"
msgstr "Rotation de la caméra et le joueur suit (Souris)"
msgid "INPUT_VIEW_CAMERA_MOVE_ONLY_MOUSE"
msgstr "Rotation de la caméra seulement (Souris)"
msgid "INPUT_ACTION_CAMERA_MOVE_PLAYER_MOUSE"
msgstr "Rotation de la caméra et déplacer le joueur dans la direction (Souris)"
msgid "INPUT_ACTION_JUMP"
msgstr "Sauter"
@ -289,4 +298,3 @@ msgstr "Inversé verticale"
msgid "NO_MOUSE_BUTTON"
msgstr "Rien n'est sélectionné"

Binary file not shown.

View file

@ -230,7 +230,16 @@ msgstr ""
msgid "INPUT_VIEW_CAMERA_MOVE_ONLY"
msgstr ""
msgid "INPUT_VIEW_CAMERA_PLAYER_WALK"
msgid "INPUT_ACTION_CAMERA_MOVE_PLAYER"
msgstr ""
msgid "INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW_MOUSE"
msgstr ""
msgid "INPUT_VIEW_CAMERA_MOVE_ONLY_MOUSE"
msgstr ""
msgid "INPUT_ACTION_CAMERA_MOVE_PLAYER_MOUSE"
msgstr ""
msgid "INPUT_ACTION_JUMP"

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -237,8 +237,7 @@ INPUT_VIEW_ZOOM_OUT={
}
INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW={
"deadzone": 0.5,
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"button_mask":2,"position":Vector2(217, 135),"global_position":Vector2(217, 135),"factor":1.0,"button_index":2,"pressed":true,"double_click":false,"script":null)
]
"events": []
}
INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW_PLUS={
"deadzone": 0.5,
@ -246,19 +245,44 @@ INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW_PLUS={
}
INPUT_VIEW_CAMERA_MOVE_ONLY={
"deadzone": 0.5,
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"pressed":false,"double_click":false,"script":null)
]
"events": []
}
INPUT_VIEW_CAMERA_MOVE_ONLY_PLUS={
"deadzone": 0.5,
"events": []
}
INPUT_VIEW_CAMERA_PLAYER_WALK={
INPUT_ACTION_CAMERA_MOVE_PLAYER={
"deadzone": 0.5,
"events": []
}
INPUT_ACTION_CAMERA_MOVE_PLAYER_PLUS={
"deadzone": 0.5,
"events": []
}
INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW_MOUSE={
"deadzone": 0.5,
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"button_mask":2,"position":Vector2(217, 135),"global_position":Vector2(217, 135),"factor":1.0,"button_index":2,"pressed":true,"double_click":false,"script":null)
]
}
INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW_MOUSE_PLUS={
"deadzone": 0.5,
"events": []
}
INPUT_VIEW_CAMERA_MOVE_ONLY_MOUSE={
"deadzone": 0.5,
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"pressed":false,"double_click":false,"script":null)
]
}
INPUT_VIEW_CAMERA_PLAYER_WALK_PLUS={
INPUT_VIEW_CAMERA_MOVE_ONLY_MOUSE_PLUS={
"deadzone": 0.5,
"events": []
}
INPUT_ACTION_CAMERA_MOVE_PLAYER_MOUSE={
"deadzone": 0.5,
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"pressed":false,"double_click":false,"script":null)
]
}
INPUT_ACTION_CAMERA_MOVE_PLAYER_MOUSE_PLUS={
"deadzone": 0.5,
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"button_mask":2,"position":Vector2(217, 135),"global_position":Vector2(217, 135),"factor":1.0,"button_index":2,"pressed":true,"double_click":false,"script":null)
]

View file

@ -11,21 +11,21 @@ size_flags_vertical = 3
script = ExtResource( "1_dp231" )
[node name="Empty" type="Label" parent="."]
offset_right = 329.0
minimum_size = Vector2(50, 0)
offset_right = 50.0
offset_bottom = 600.0
size_flags_horizontal = 3
size_flags_vertical = 5
size_flags_vertical = 1
[node name="Comment" type="Label" parent="."]
offset_left = 333.0
offset_right = 662.0
offset_left = 54.0
offset_right = 523.0
offset_bottom = 600.0
size_flags_horizontal = 3
size_flags_vertical = 5
[node name="Del" type="TextureButton" parent="."]
offset_left = 666.0
offset_right = 690.0
offset_left = 527.0
offset_right = 551.0
offset_bottom = 600.0
size_flags_horizontal = 5
size_flags_vertical = 5
@ -34,7 +34,7 @@ texture_normal = ExtResource( "2_r7srr" )
stretch_mode = 0
[node name="Label" type="Label" parent="."]
offset_left = 694.0
offset_left = 555.0
offset_right = 1024.0
offset_bottom = 600.0
size_flags_horizontal = 3

View file

@ -17,6 +17,7 @@ func _ready():
func refresh():
configure_control()
show_windows()
func reload_control_system():
@ -134,70 +135,43 @@ func load_current_control():
func update_mouse_button_move_camera():
# Update SelectButton - INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW
var MouseCameraMove:String = ""
var comment:String = "None"
#var text1:String = ""
$Window/Tab/MOUSE/CameraPlayer/SelectButton.set_text(Common.get_input_plus("INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW"))
$Window/Tab/MOUSE/CameraOnly/SelectButton.set_text(Common.get_input_plus("INPUT_VIEW_CAMERA_MOVE_ONLY"))
$Window/Tab/MOUSE/CameraPlayerWalk/SelectButton.set_text(Common.get_input_plus("INPUT_VIEW_CAMERA_PLAYER_WALK"))
# if InputMap.has_action("INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW"):
# for z in InputMap.action_get_events("INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW"):
# if z is InputEventMouseButton:
# comment = tr(Common.get_string_input(z))
# Common.msg_debug(comment)
# #$Window/Tab/MOUSE/HBox/SelectButton.set_text(text1)
# break
# if InputMap.has_action("INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW_PLUS"):
# for z in InputMap.action_get_events("INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW_PLUS"):
# if z is InputEventMouseButton:
# comment = comment + " & " + tr(Common.get_string_input(z))
# Common.msg_debug(comment)
# break
# $Window/Tab/MOUSE/HBox/SelectButton.set_text(comment)
# for action in InputMap.get_actions():
# var text:String = action
# if text.find("INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW") == 0:
# for z in InputMap.action_get_events(action):
# if z is InputEventMouseButton:
# var text2:String = Common.get_string_input(z)
# Common.msg_debug(text2)
# $Window/Tab/MOUSE/HBox/SelectButton.set_text(text2)
# return
$Window/v/Tab/MOUSE/v/CameraPlayer/h1/SelectButton.set_text(Common.get_input_plus("INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW_MOUSE"))
$Window/v/Tab/MOUSE/v/CameraOnly/h1/SelectButton.set_text(Common.get_input_plus("INPUT_VIEW_CAMERA_MOVE_ONLY_MOUSE"))
$Window/v/Tab/MOUSE/v/CameraPlayerWalk/h1/SelectButton.set_text(Common.get_input_plus("INPUT_ACTION_CAMERA_MOVE_PLAYER_MOUSE"))
func configure_control():
if $Window/Tab/CONTROL/Menu/ShowMethod.get_selected() == 0:
$Window/Tab/CONTROL/Input.visible = false
$Window/Tab/CONTROL/Tree.visible = true
if $Window/v/Tab/CONTROL/Menu/ShowMethod.get_selected() == 0:
$Window/v/Tab/CONTROL/Input.visible = false
$Window/v/Tab/CONTROL/Tree.visible = true
configure_control_by_group()
elif $Window/Tab/CONTROL/Menu/ShowMethod.get_selected() == 1:
$Window/Tab/CONTROL/Tree.visible = false
$Window/Tab/CONTROL/Input.visible = true
elif $Window/v/Tab/CONTROL/Menu/ShowMethod.get_selected() == 1:
$Window/v/Tab/CONTROL/Tree.visible = false
$Window/v/Tab/CONTROL/Input.visible = true
configure_control_sort_by_categories()
else:
$Window/Tab/CONTROL/Tree.visible = false
$Window/Tab/CONTROL/Input.visible = true
$Window/v/Tab/CONTROL/Tree.visible = false
$Window/v/Tab/CONTROL/Input.visible = true
configure_control_sort_by_input()
update_mouse_button_move_camera()
func configure_control_by_group():
$Window/Tab/CONTROL/Tree.clear()
var root = $Window/Tab/CONTROL/Tree.create_item()
$Window/Tab/CONTROL/Tree.hide_root = true
var child_action = $Window/Tab/CONTROL/Tree.create_item(root)
$Window/v/Tab/CONTROL/Tree.clear()
var root = $Window/v/Tab/CONTROL/Tree.create_item()
$Window/v/Tab/CONTROL/Tree.hide_root = true
var child_action = $Window/v/Tab/CONTROL/Tree.create_item(root)
child_action.set_text(0, tr("CONTROL_INPUT_ACTION"))
var child_view = $Window/Tab/CONTROL/Tree.create_item(root)
var child_view = $Window/v/Tab/CONTROL/Tree.create_item(root)
child_view.set_text(0, tr("CONTROL_INPUT_VIEW"))
var child_other = $Window/Tab/CONTROL/Tree.create_item(root)
var child_other = $Window/v/Tab/CONTROL/Tree.create_item(root)
child_other.set_text(0, tr("CONTROL_INPUT_OTHER"))
for action in InputMap.get_actions():
var text:String = action
if text.ends_with("_PLUS"):
pass
elif text.find("INPUT_ACTION") == 0:
var subchild:TreeItem = $Window/Tab/CONTROL/Tree.create_item(child_action)
var subchild:TreeItem = $Window/v/Tab/CONTROL/Tree.create_item(child_action)
subchild.set_text(0, tr(text))
var buttontxt : Texture2D = preload("res://scenes/controls/add.png")
subchild.add_button(0, buttontxt, 0, false, "CONTROL_ADD_INPUT")
@ -206,7 +180,7 @@ func configure_control_by_group():
var a = InputMap.action_get_events(action)
for z in a:
var text2:String = tr(Common.get_string_input(z)) + Common.get_input_plus_event(action ,z)
var subchild2:TreeItem = $Window/Tab/CONTROL/Tree.create_item(subchild)
var subchild2:TreeItem = $Window/v/Tab/CONTROL/Tree.create_item(subchild)
subchild2.set_text(0, tr(text2))
var button2txt : Texture2D = preload("res://scenes/controls/trash.png")
subchild2.add_button(0, button2txt, 0, false, "CONTROL_DEL_INPUT")
@ -214,7 +188,7 @@ func configure_control_by_group():
subchild2.set_meta("group", action)
subchild2.set_meta("control", z)
elif text.find("INPUT_VIEW") == 0:
var subchild:TreeItem = $Window/Tab/CONTROL/Tree.create_item(child_view)
var subchild:TreeItem = $Window/v/Tab/CONTROL/Tree.create_item(child_view)
subchild.set_text(0, tr(text))
var buttontxt : Texture2D = preload("res://scenes/controls/add.png")
subchild.add_button(0, buttontxt, 0, false, "CONTROL_ADD_INPUT")
@ -223,7 +197,7 @@ func configure_control_by_group():
var a = InputMap.action_get_events(action)
for z in a:
var text2:String = tr(Common.get_string_input(z)) + Common.get_input_plus_event(action ,z)
var subchild2:TreeItem = $Window/Tab/CONTROL/Tree.create_item(subchild)
var subchild2:TreeItem = $Window/v/Tab/CONTROL/Tree.create_item(subchild)
subchild2.set_text(0, tr(text2))
var button2txt : Texture2D = preload("res://scenes/controls/trash.png")
subchild2.add_button(0, button2txt, 0, false, "CONTROL_DEL_INPUT")
@ -231,7 +205,7 @@ func configure_control_by_group():
subchild2.set_meta("group", action)
subchild2.set_meta("control", z)
else:
var subchild:TreeItem = $Window/Tab/CONTROL/Tree.create_item(child_other)
var subchild:TreeItem = $Window/v/Tab/CONTROL/Tree.create_item(child_other)
subchild.set_text(0, tr(text))
var buttontxt : Texture2D = preload("res://scenes/controls/add.png")
subchild.add_button(0, buttontxt, 0, false, "CONTROL_ADD_INPUT")
@ -240,7 +214,7 @@ func configure_control_by_group():
var a = InputMap.action_get_events(action)
for z in a:
var text2:String = tr(Common.get_string_input(z)) + Common.get_input_plus_event(action ,z)
var subchild2:TreeItem = $Window/Tab/CONTROL/Tree.create_item(subchild)
var subchild2:TreeItem = $Window/v/Tab/CONTROL/Tree.create_item(subchild)
subchild2.set_text(0, tr(text2))
var button2txt : Texture2D = preload("res://scenes/controls/trash.png")
subchild2.add_button(0, button2txt, 0, false, "CONTROL_DEL_INPUT")
@ -254,75 +228,106 @@ func __button_pressed():
func configure_control_sort_by_input():
for child in $Window/Tab/CONTROL/Input/Control.get_children():
for child in $Window/v/Tab/CONTROL/Input/Control.get_children():
child.queue_free()
var def = {}
for action in InputMap.get_actions():
for z in InputMap.action_get_events(action):
var id = str(get_hash_inputevent(z)) + "_" + str(action)
def[id] = { 'event': z, 'action': action }
var id:String
var extra = ""
var eventplus = null
if String(action).ends_with("_MOUSE"):
eventplus = Common.get_event_plus_ref(action, z)
if eventplus != null:
id = str(get_hash_inputevent(z) + "_" + get_hash_inputevent(eventplus)) + "__" + str(action) + "_" + str(eventplus)
else:
id = str(get_hash_inputevent(z)) + "__" + str(action)
else:
id = str(get_hash_inputevent(z)) + "__" + str(action)
def[id] = { 'event': z, 'action': action, 'plus': eventplus }
var defsorted = def.keys()
defsorted.sort()
var lastevent = null
for id in defsorted:
var z = def[id]['event']
var eventplus = def[id]['plus']
var action = def[id]['action']
var zhash = get_dict_inputevent(z).hash()
var text:String = action
if text.ends_with("_PLUS"):
continue
var zhash # = get_dict_inputevent(z).hash()
if String(action).ends_with("_MOUSE"):
#thash = get_dict_inputevent(z).hash() + "_" + get_hash_inputevent(eventplus))
if eventplus != null:
zhash = get_dict_inputevent(z).hash() + get_dict_inputevent(eventplus).hash()
else:
zhash = get_dict_inputevent(z).hash()
else:
zhash = get_dict_inputevent(z).hash()
#var zhash = thash.hash()
if zhash != lastevent:
var separator = HSeparator.new()
$Window/Tab/CONTROL/Input/Control.add_child( separator )
$Window/v/Tab/CONTROL/Input/Control.add_child( separator )
lastevent = zhash
if z is InputEventKey:
var item = preload( "res://scenes/controls/control_input.tscn" ).instantiate() #.instance()
item.set_param(action, "Key: " + Common.get_string_input_keyboard(z), action, z)
item.connect( "del_pressed", _on_input_box_del_pressed.bind() )
$Window/Tab/CONTROL/Input/Control.add_child( item )
$Window/v/Tab/CONTROL/Input/Control.add_child( item )
elif z is InputEventMouseButton:
var item = preload( "res://scenes/controls/control_input.tscn" ).instantiate()
item.set_param(action, "Mouse Button: " + Common.get_string_input_mousse_button(z), action, z)
var res:String
if eventplus == null:
res = tr(Common.get_string_input_mousse_button(z))
else:
res = tr(Common.get_string_input_mousse_button(z)) + " & " + tr(Common.get_string_input_mousse_button(eventplus))
item.set_param(action, "Mouse Button: " + res, action, z)
item.connect( "del_pressed", _on_input_box_del_pressed.bind() )
$Window/Tab/CONTROL/Input/Control.add_child( item )
$Window/v/Tab/CONTROL/Input/Control.add_child( item )
elif z is InputEventJoypadButton:
var item = preload( "res://scenes/controls/control_input.tscn" ).instantiate()
item.set_param(action, "Joypad Button: " + Common.get_string_input_joypad_button(z), action, z)
item.connect( "del_pressed", _on_input_box_del_pressed.bind() )
$Window/Tab/CONTROL/Input/Control.add_child( item )
$Window/v/Tab/CONTROL/Input/Control.add_child( item )
for action in InputMap.get_actions():
var separator = HSeparator.new()
$Window/Tab/CONTROL/Input/Control.add_child( separator )
$Window/v/Tab/CONTROL/Input/Control.add_child( separator )
var control_box = preload( "res://scenes/controls/control_function.tscn" ).instantiate()
control_box.set_param(action, action, true)
control_box.connect( "add_pressed", _on_control_box_add_pressed.bind() )
$Window/Tab/CONTROL/Input/Control.add_child( control_box )
$Window/v/Tab/CONTROL/Input/Control.add_child( control_box )
func configure_control_sort_by_categories():
for child in $Window/Tab/CONTROL/Input/Control.get_children():
for child in $Window/v/Tab/CONTROL/Input/Control.get_children():
child.queue_free()
for action in InputMap.get_actions():
var text:String = action
if text.ends_with("_PLUS"):
continue
var control_box = preload( "res://scenes/controls/control_function.tscn" ).instantiate()
control_box.set_param(action, action, false)
control_box.connect( "add_pressed", _on_control_box_add_pressed.bind() )
$Window/Tab/CONTROL/Input/Control.add_child( control_box )
$Window/v/Tab/CONTROL/Input/Control.add_child( control_box )
var a = InputMap.action_get_events(action)
for z in a:
if z is InputEventKey:
var item = preload( "res://scenes/controls/control_input.tscn" ).instantiate()
item.set_param(action, "Key: " + Common.get_string_input_keyboard(z), "", z)
item.connect( "del_pressed", _on_input_box_del_pressed.bind() )
$Window/Tab/CONTROL/Input/Control.add_child( item )
$Window/v/Tab/CONTROL/Input/Control.add_child( item )
elif z is InputEventMouseButton:
var item = preload( "res://scenes/controls/control_input.tscn" ).instantiate()
item.set_param(action, "Mouse Button: " + Common.get_string_input_mousse_button(z), "", z)
item.set_param(action, "Mouse Button: " + tr(Common.get_string_input_mousse_button(z)) + Common.get_input_plus_event(action ,z) , "", z)
item.connect( "del_pressed", _on_input_box_del_pressed.bind() )
$Window/Tab/CONTROL/Input/Control.add_child( item )
$Window/v/Tab/CONTROL/Input/Control.add_child( item )
elif z is InputEventJoypadButton:
var item = preload( "res://scenes/controls/control_input.tscn" ).instantiate()
item.set_param(action, "Joypad Button: " + Common.get_string_input_joypad_button(z), "", z)
item.connect( "del_pressed", _on_input_box_del_pressed.bind() )
$Window/Tab/CONTROL/Input/Control.add_child( item )
$Window/v/Tab/CONTROL/Input/Control.add_child( item )
var separator = HSeparator.new()
$Window/Tab/CONTROL/Input/Control.add_child( separator )
$Window/v/Tab/CONTROL/Input/Control.add_child( separator )
func load_control_system():
@ -368,6 +373,7 @@ func _on_tree_button_pressed(item:TreeItem, column, id):
func show_windows():
Common.msg_debug("show_windows")
$Window.visible = true
@ -378,20 +384,20 @@ func define_mouse_camera_move():
func _on_select_button_pressed():
$Window.visible = false
$DefineInput.set_param(2, "INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW")
$DefineInput.set_param(2, "INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW_MOUSE")
$DefineInput/Window.popup_centered()
$DefineInput/Window.visible = true
func _on_camear_only_button_pressed():
$Window.visible = false
$DefineInput.set_param(2, "INPUT_VIEW_CAMERA_MOVE_ONLY")
$DefineInput.set_param(2, "INPUT_VIEW_CAMERA_MOVE_ONLY_MOUSE")
$DefineInput/Window.popup_centered()
$DefineInput/Window.visible = true
func _on_camera_player_walk_button_pressed():
$Window.visible = false
$DefineInput.set_param(2, "INPUT_VIEW_CAMERA_PLAYER_WALK")
$DefineInput.set_param(2, "INPUT_VIEW_CAMERA_PLAYER_WALK_MOUSE")
$DefineInput/Window.popup_centered()
$DefineInput/Window.visible = true

View file

@ -18,7 +18,14 @@ visible = false
content_scale_mode = 1
content_scale_aspect = 4
[node name="Tab" type="TabContainer" parent="Window"]
[node name="v" type="VBoxContainer" parent="Window"]
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
metadata/_edit_use_custom_anchors = false
[node name="Tab" type="TabContainer" parent="Window/v"]
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
@ -27,7 +34,7 @@ size_flags_horizontal = 3
size_flags_vertical = 3
metadata/_edit_use_custom_anchors = false
[node name="CONTROL" type="VBoxContainer" parent="Window/Tab"]
[node name="CONTROL" type="VBoxContainer" parent="Window/v/Tab"]
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = 31.0
@ -36,12 +43,12 @@ grow_vertical = 2
size_flags_horizontal = 6
size_flags_vertical = 6
[node name="Menu" type="HBoxContainer" parent="Window/Tab/CONTROL"]
[node name="Menu" type="HBoxContainer" parent="Window/v/Tab/CONTROL"]
offset_right = 1024.0
offset_bottom = 31.0
size_flags_horizontal = 3
[node name="ShowMethod" type="OptionButton" parent="Window/Tab/CONTROL/Menu"]
[node name="ShowMethod" type="OptionButton" parent="Window/v/Tab/CONTROL/Menu"]
offset_right = 43.0
offset_bottom = 31.0
item_count = 3
@ -53,47 +60,193 @@ popup/item_1/id = 1
popup/item_2/text = "CONTROL_VIEW_BY_INPUT_SORTED"
popup/item_2/id = 2
[node name="SortByInput" type="CheckBox" parent="Window/Tab/CONTROL/Menu"]
[node name="SortByInput" type="CheckBox" parent="Window/v/Tab/CONTROL/Menu"]
visible = false
offset_right = 510.0
offset_bottom = 31.0
size_flags_horizontal = 7
text = "EDIT_CONTROL/SORT_BY_INPUT"
[node name="Reload" type="Button" parent="Window/Tab/CONTROL/Menu"]
[node name="Reload" type="Button" parent="Window/v/Tab/CONTROL/Menu"]
offset_left = 514.0
offset_right = 1024.0
offset_bottom = 31.0
size_flags_horizontal = 7
text = "EDIT_CONTROL/RELOAD_SYSTEM_CONFIG"
[node name="Input" type="ScrollContainer" parent="Window/Tab/CONTROL"]
[node name="Input" type="ScrollContainer" parent="Window/v/Tab/CONTROL"]
offset_top = 35.0
offset_right = 1024.0
offset_bottom = 565.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="Control" type="VBoxContainer" parent="Window/Tab/CONTROL/Input"]
[node name="Control" type="VBoxContainer" parent="Window/v/Tab/CONTROL/Input"]
offset_right = 1024.0
offset_bottom = 530.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="Tree" type="Tree" parent="Window/Tab/CONTROL"]
[node name="Tree" type="Tree" parent="Window/v/Tab/CONTROL"]
visible = false
offset_right = 40.0
offset_bottom = 40.0
size_flags_vertical = 3
[node name="Quit" type="Button" parent="Window/Tab/CONTROL"]
[node name="MOUSE" type="ScrollContainer" parent="Window/v/Tab"]
visible = false
offset_right = 40.0
offset_bottom = 40.0
[node name="v" type="VBoxContainer" parent="Window/v/Tab/MOUSE"]
offset_right = 934.0
offset_bottom = 312.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="CameraPlayer" type="VBoxContainer" parent="Window/v/Tab/MOUSE/v"]
offset_right = 40.0
offset_bottom = 40.0
[node name="Label" type="Label" parent="Window/v/Tab/MOUSE/v/CameraPlayer"]
offset_right = 40.0
offset_bottom = 23.0
text = "INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW"
[node name="h1" type="HBoxContainer" parent="Window/v/Tab/MOUSE/v/CameraPlayer"]
offset_right = 40.0
offset_bottom = 40.0
[node name="space" type="Label" parent="Window/v/Tab/MOUSE/v/CameraPlayer/h1"]
minimum_size = Vector2(50, 0)
offset_right = 40.0
offset_bottom = 23.0
[node name="SelectButton" type="Button" parent="Window/v/Tab/MOUSE/v/CameraPlayer/h1"]
offset_right = 8.0
offset_bottom = 31.0
text = "SELECT"
[node name="h2" type="HBoxContainer" parent="Window/v/Tab/MOUSE/v/CameraPlayer"]
offset_right = 40.0
offset_bottom = 40.0
[node name="space" type="Label" parent="Window/v/Tab/MOUSE/v/CameraPlayer/h2"]
minimum_size = Vector2(50, 0)
offset_right = 40.0
offset_bottom = 23.0
[node name="ReverseHorizontal" type="CheckBox" parent="Window/v/Tab/MOUSE/v/CameraPlayer/h2"]
offset_right = 24.0
offset_bottom = 31.0
text = "EDIT_CONTROL/MOVE_CAMERA_REVERSE_HORIZONTAL"
[node name="ReverseVertical" type="CheckBox" parent="Window/v/Tab/MOUSE/v/CameraPlayer/h2"]
offset_right = 24.0
offset_bottom = 31.0
text = "EDIT_CONTROL/MOVE_CAMERA_REVERSE_VERTICAL"
[node name="HSeparator1" type="HSeparator" parent="Window/v/Tab/MOUSE/v"]
offset_right = 40.0
offset_bottom = 4.0
[node name="CameraOnly" type="VBoxContainer" parent="Window/v/Tab/MOUSE/v"]
offset_right = 40.0
offset_bottom = 40.0
[node name="Label" type="Label" parent="Window/v/Tab/MOUSE/v/CameraOnly"]
offset_right = 40.0
offset_bottom = 23.0
text = "INPUT_VIEW_CAMERA_MOVE_ONLY"
[node name="h1" type="HBoxContainer" parent="Window/v/Tab/MOUSE/v/CameraOnly"]
offset_right = 40.0
offset_bottom = 40.0
[node name="space" type="Label" parent="Window/v/Tab/MOUSE/v/CameraOnly/h1"]
minimum_size = Vector2(50, 0)
offset_right = 40.0
offset_bottom = 23.0
[node name="SelectButton" type="Button" parent="Window/v/Tab/MOUSE/v/CameraOnly/h1"]
offset_right = 8.0
offset_bottom = 31.0
text = "SELECT"
[node name="h2" type="HBoxContainer" parent="Window/v/Tab/MOUSE/v/CameraOnly"]
offset_right = 40.0
offset_bottom = 40.0
[node name="space" type="Label" parent="Window/v/Tab/MOUSE/v/CameraOnly/h2"]
minimum_size = Vector2(50, 0)
offset_right = 40.0
offset_bottom = 23.0
[node name="ReverseHorizontal" type="CheckBox" parent="Window/v/Tab/MOUSE/v/CameraOnly/h2"]
offset_right = 24.0
offset_bottom = 31.0
text = "EDIT_CONTROL/MOVE_CAMERA_REVERSE_HORIZONTAL"
[node name="ReverseVertical" type="CheckBox" parent="Window/v/Tab/MOUSE/v/CameraOnly/h2"]
offset_right = 24.0
offset_bottom = 31.0
text = "EDIT_CONTROL/MOVE_CAMERA_REVERSE_VERTICAL"
[node name="HSeparator2" type="HSeparator" parent="Window/v/Tab/MOUSE/v"]
offset_right = 40.0
offset_bottom = 4.0
[node name="CameraPlayerWalk" type="VBoxContainer" parent="Window/v/Tab/MOUSE/v"]
offset_right = 40.0
offset_bottom = 40.0
[node name="Label" type="Label" parent="Window/v/Tab/MOUSE/v/CameraPlayerWalk"]
offset_right = 40.0
offset_bottom = 23.0
text = "INPUT_ACTION_CAMERA_MOVE_PLAYER"
[node name="h1" type="HBoxContainer" parent="Window/v/Tab/MOUSE/v/CameraPlayerWalk"]
offset_right = 40.0
offset_bottom = 40.0
[node name="space" type="Label" parent="Window/v/Tab/MOUSE/v/CameraPlayerWalk/h1"]
minimum_size = Vector2(50, 0)
offset_right = 40.0
offset_bottom = 23.0
[node name="SelectButton" type="Button" parent="Window/v/Tab/MOUSE/v/CameraPlayerWalk/h1"]
offset_right = 8.0
offset_bottom = 31.0
text = "SELECT"
[node name="h2" type="HBoxContainer" parent="Window/v/Tab/MOUSE/v/CameraPlayerWalk"]
offset_right = 40.0
offset_bottom = 40.0
[node name="space" type="Label" parent="Window/v/Tab/MOUSE/v/CameraPlayerWalk/h2"]
minimum_size = Vector2(50, 0)
offset_right = 40.0
offset_bottom = 23.0
[node name="ReverseHorizontal" type="CheckBox" parent="Window/v/Tab/MOUSE/v/CameraPlayerWalk/h2"]
offset_right = 24.0
offset_bottom = 31.0
text = "EDIT_CONTROL/MOVE_CAMERA_REVERSE_HORIZONTAL"
[node name="ReverseVertical" type="CheckBox" parent="Window/v/Tab/MOUSE/v/CameraPlayerWalk/h2"]
offset_right = 24.0
offset_bottom = 31.0
text = "EDIT_CONTROL/MOVE_CAMERA_REVERSE_VERTICAL"
[node name="Quit" type="Button" parent="Window/v"]
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -85.5
offset_top = -31.0
offset_right = 85.5
offset_left = 406.5
offset_top = 529.0
offset_right = 577.5
offset_bottom = 560.0
grow_horizontal = 2
grow_vertical = 0
size_flags_horizontal = 4
@ -101,114 +254,16 @@ size_flags_vertical = 8
text = "EDIT_CONTROL/QUIT"
metadata/_edit_use_custom_anchors = false
[node name="JOYPAD" type="VBoxContainer" parent="Window/Tab"]
visible = false
offset_right = 40.0
offset_bottom = 40.0
[node name="MOUSE" type="VBoxContainer" parent="Window/Tab"]
visible = false
offset_right = 40.0
offset_bottom = 40.0
[node name="CameraPlayer" type="HBoxContainer" parent="Window/Tab/MOUSE"]
offset_right = 1344.0
offset_bottom = 31.0
[node name="Label" type="Label" parent="Window/Tab/MOUSE/CameraPlayer"]
offset_right = 40.0
offset_bottom = 23.0
text = "INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW"
[node name="SelectButton" type="Button" parent="Window/Tab/MOUSE/CameraPlayer"]
offset_right = 8.0
offset_bottom = 31.0
text = "NOBUTTON"
[node name="ReverseHorizontal" type="CheckBox" parent="Window/Tab/MOUSE/CameraPlayer"]
offset_right = 24.0
offset_bottom = 31.0
text = "EDIT_CONTROL/MOVE_CAMERA_REVERSE_HORIZONTAL"
[node name="ReverseVertical" type="CheckBox" parent="Window/Tab/MOUSE/CameraPlayer"]
offset_right = 24.0
offset_bottom = 31.0
text = "EDIT_CONTROL/MOVE_CAMERA_REVERSE_VERTICAL"
[node name="CameraOnly" type="HBoxContainer" parent="Window/Tab/MOUSE"]
offset_right = 1257.0
offset_bottom = 31.0
[node name="Label" type="Label" parent="Window/Tab/MOUSE/CameraOnly"]
offset_right = 40.0
offset_bottom = 23.0
text = "INPUT_VIEW_CAMERA_MOVE_ONLY"
[node name="SelectButton" type="Button" parent="Window/Tab/MOUSE/CameraOnly"]
offset_right = 8.0
offset_bottom = 31.0
text = "NOBUTTON"
[node name="ReverseHorizontal" type="CheckBox" parent="Window/Tab/MOUSE/CameraOnly"]
offset_right = 24.0
offset_bottom = 31.0
text = "EDIT_CONTROL/MOVE_CAMERA_REVERSE_HORIZONTAL"
[node name="ReverseVertical" type="CheckBox" parent="Window/Tab/MOUSE/CameraOnly"]
offset_right = 24.0
offset_bottom = 31.0
text = "EDIT_CONTROL/MOVE_CAMERA_REVERSE_VERTICAL"
[node name="CameraPlayerWalk" type="HBoxContainer" parent="Window/Tab/MOUSE"]
offset_right = 1270.0
offset_bottom = 31.0
[node name="Label" type="Label" parent="Window/Tab/MOUSE/CameraPlayerWalk"]
offset_right = 40.0
offset_bottom = 23.0
text = "INPUT_VIEW_CAMERA_PLAYER_WALK"
[node name="SelectButton" type="Button" parent="Window/Tab/MOUSE/CameraPlayerWalk"]
offset_right = 8.0
offset_bottom = 31.0
text = "NOBUTTON"
[node name="ReverseHorizontal" type="CheckBox" parent="Window/Tab/MOUSE/CameraPlayerWalk"]
offset_right = 24.0
offset_bottom = 31.0
text = "EDIT_CONTROL/MOVE_CAMERA_REVERSE_HORIZONTAL"
[node name="ReverseVertical" type="CheckBox" parent="Window/Tab/MOUSE/CameraPlayerWalk"]
offset_right = 24.0
offset_bottom = 31.0
text = "EDIT_CONTROL/MOVE_CAMERA_REVERSE_VERTICAL"
[node name="Tree" type="Tree" parent="Window/Tab/MOUSE"]
offset_bottom = 40.0
size_flags_vertical = 3
column_titles_visible = true
select_mode = 2
[node name="Label" type="Label" parent="Window/Tab/MOUSE/Tree"]
offset_right = 40.0
offset_bottom = 23.0
text = "INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW"
[node name="Button" type="Button" parent="Window/Tab/MOUSE/Tree/Label"]
offset_right = 8.0
offset_bottom = 31.0
text = "Example"
[node name="SelectType" parent="." instance=ExtResource( "2_ps0mu" )]
[node name="DefineInput" parent="." instance=ExtResource( "3_dxrwd" )]
[connection signal="close_requested" from="Window" to="." method="_on_quit_pressed"]
[connection signal="item_selected" from="Window/Tab/CONTROL/Menu/ShowMethod" to="." method="_on_option_button_item_selected"]
[connection signal="pressed" from="Window/Tab/CONTROL/Menu/SortByInput" to="." method="_on_sort_by_input_pressed"]
[connection signal="pressed" from="Window/Tab/CONTROL/Menu/Reload" to="." method="reload_control_system"]
[connection signal="button_pressed" from="Window/Tab/CONTROL/Tree" to="." method="_on_tree_button_pressed"]
[connection signal="pressed" from="Window/Tab/CONTROL/Quit" to="." method="_on_quit_pressed"]
[connection signal="pressed" from="Window/Tab/MOUSE/CameraPlayer/SelectButton" to="." method="_on_select_button_pressed"]
[connection signal="pressed" from="Window/Tab/MOUSE/CameraOnly/SelectButton" to="." method="_on_camear_only_button_pressed"]
[connection signal="pressed" from="Window/Tab/MOUSE/CameraPlayerWalk/SelectButton" to="." method="_on_camera_player_walk_button_pressed"]
[connection signal="item_selected" from="Window/v/Tab/CONTROL/Menu/ShowMethod" to="." method="_on_option_button_item_selected"]
[connection signal="pressed" from="Window/v/Tab/CONTROL/Menu/SortByInput" to="." method="_on_sort_by_input_pressed"]
[connection signal="pressed" from="Window/v/Tab/CONTROL/Menu/Reload" to="." method="reload_control_system"]
[connection signal="button_pressed" from="Window/v/Tab/CONTROL/Tree" to="." method="_on_tree_button_pressed"]
[connection signal="pressed" from="Window/v/Tab/MOUSE/v/CameraPlayer/h1/SelectButton" to="." method="_on_select_button_pressed"]
[connection signal="pressed" from="Window/v/Tab/MOUSE/v/CameraOnly/h1/SelectButton" to="." method="_on_select_button_pressed"]
[connection signal="pressed" from="Window/v/Tab/MOUSE/v/CameraPlayerWalk/h1/SelectButton" to="." method="_on_select_button_pressed"]
[connection signal="pressed" from="Window/v/Quit" to="." method="_on_quit_pressed"]

View file

@ -52,18 +52,7 @@ func _on_cancel_pressed():
func _on_ok_pressed():
$Window.hide()
if last_last_event != null:
Common.set_input_plus(action, last_event, last_last_event, self.type_event == 2)
else:
Common.set_input(action, last_event, self.type_event == 2)
# if self.type_event == 2:
# for curaction in InputMap.get_actions():
# var text:String = curaction
# if text == action:
# for z in InputMap.action_get_events(curaction):
# if z is InputEventMouseButton:
# InputMap.action_erase_event(text, z)
# InputMap.action_add_event(action, last_event)
Common.set_input_plus(action, last_event, last_last_event, self.type_event == 2)
emit_signal("refresh_control_define_input")

View file

@ -13,15 +13,23 @@ func _ready():
func refresh():
Common.msg_debug("refresh")
emit_signal("refresh_select_type_control")
func set_param(_action, _signalrefresh):
self.action = _action
self.signalrefresh = _signalrefresh
if String(_action).ends_with("_MOUSE"):
$Window/VBoxContainer/Key.set_disabled(true)
$Window/VBoxContainer/Joypad.set_disabled(true)
else:
$Window/VBoxContainer/Key.set_disabled(false)
$Window/VBoxContainer/Joypad.set_disabled(false)
func _on_quit_pressed():
Common.msg_debug("cancel_define_input")
$Window.visible = false
emit_signal("cancel_define_input")

View file

@ -129,7 +129,7 @@ offset_right = 40.0
offset_bottom = 40.0
size_flags_vertical = 8
[node name="Label" type="Label" parent="Window/VBox/HBoxContainer"]
[node name="space" type="Label" parent="Window/VBox/HBoxContainer"]
offset_right = 40.0
offset_bottom = 23.0
size_flags_horizontal = 3

View file

@ -130,10 +130,28 @@ func get_string_input(event) -> String:
else:
return str(event)
func get_input_plus_event(action:String, event_ref):
if InputMap.has_action(action + "_PLUS"):
#func compare_type_event(event1, event2):
# if event1 is InputEventKey and event2 is InputEventKey:
# return true
# elif event1 is InputEventMouseButton and event2 is InputEventMouseButton:
# return true
# elif event1 is InputEventJoypadButton and event2 is InputEventJoypadButton:
# return true
# return false
func get_event_plus_ref(action:String, event_ref):
if event_ref is InputEventMouseButton and InputMap.has_action(action + "_PLUS"):
for z in InputMap.action_get_events(action + "_PLUS"):
if typeof(event_ref) == typeof(z):
if z is InputEventMouseButton:
return z
return null
func get_input_plus_event(action:String, event_ref):
if event_ref is InputEventMouseButton and InputMap.has_action(action + "_PLUS"):
for z in InputMap.action_get_events(action + "_PLUS"):
if z is InputEventMouseButton:
return " & " + tr(Common.get_string_input(z))
return ""
@ -154,18 +172,18 @@ func get_input_plus(action:String):
# break
return comment
func set_input(action:String, event, eraselast:bool):
func set_input(action:String, event, origin, eraselast:bool):
if eraselast:
for curaction in InputMap.get_actions():
var text:String = curaction
if text == action:
for z in InputMap.action_get_events(curaction):
if typeof(event) == typeof(z):
if origin is InputEventMouseButton and z is InputEventMouseButton:
InputMap.action_erase_event(text, z)
InputMap.action_add_event(action, event)
if event != null:
InputMap.action_add_event(action, event)
func set_input_plus(action:String, event, eventplus, eraselast:bool):
set_input(action, event, eraselast)
set_input(action + "_PLUS", eventplus, eraselast)
set_input(action, event, event, eraselast)
set_input(action + "_PLUS", eventplus, event, eraselast)