소스 검색

:wrench: Automatically discard triggered prompts

DricomDragon 2 주 전
부모
커밋
d994865ffc
2개의 변경된 파일14개의 추가작업 그리고 18개의 파일을 삭제
  1. 12 17
      godot/component/ui/input_prompts/move/move_container.tscn
  2. 2 1
      godot/component/ui/input_prompts/prompt_container.gd

+ 12 - 17
godot/component/ui/input_prompts/move/move_container.tscn

@@ -7,40 +7,40 @@
 [ext_resource type="Texture2D" uid="uid://bntsrcd3hjcex" path="res://addons/input_prompts/icons/generic/left_stick_up.png" id="4_e345q"]
 [ext_resource type="Texture2D" uid="uid://dreirjfpqj40a" path="res://addons/input_prompts/icons/generic/left_stick_down.png" id="5_vrthb"]
 
-[sub_resource type="InputEventKey" id="InputEventKey_5ba2r"]
+[sub_resource type="InputEventKey" id="InputEventKey_7yjnx"]
 device = -1
 physical_keycode = 65
 unicode = 97
 
-[sub_resource type="InputEventJoypadMotion" id="InputEventJoypadMotion_2p15s"]
+[sub_resource type="InputEventJoypadMotion" id="InputEventJoypadMotion_jx22h"]
 device = -1
 axis_value = -1.0
 
-[sub_resource type="InputEventKey" id="InputEventKey_vmcvq"]
+[sub_resource type="InputEventKey" id="InputEventKey_4j1an"]
 device = -1
 physical_keycode = 68
 unicode = 101
 
-[sub_resource type="InputEventJoypadMotion" id="InputEventJoypadMotion_auo40"]
+[sub_resource type="InputEventJoypadMotion" id="InputEventJoypadMotion_3k62j"]
 device = -1
 axis_value = 1.0
 
-[sub_resource type="InputEventKey" id="InputEventKey_urkwk"]
+[sub_resource type="InputEventKey" id="InputEventKey_kss0e"]
 device = -1
 physical_keycode = 87
 unicode = 44
 
-[sub_resource type="InputEventJoypadMotion" id="InputEventJoypadMotion_sgel0"]
+[sub_resource type="InputEventJoypadMotion" id="InputEventJoypadMotion_t2hi6"]
 device = -1
 axis = 1
 axis_value = -1.0
 
-[sub_resource type="InputEventKey" id="InputEventKey_3sn2y"]
+[sub_resource type="InputEventKey" id="InputEventKey_aos7d"]
 device = -1
 physical_keycode = 83
 unicode = 111
 
-[sub_resource type="InputEventJoypadMotion" id="InputEventJoypadMotion_kmldo"]
+[sub_resource type="InputEventJoypadMotion" id="InputEventJoypadMotion_u784o"]
 device = -1
 axis = 1
 axis_value = 1.0
@@ -61,7 +61,7 @@ stretch_mode = 5
 script = ExtResource("2_hmylp")
 action = "move_left"
 icon = 0
-events = Array[InputEvent]([SubResource("InputEventKey_5ba2r"), SubResource("InputEventJoypadMotion_2p15s")])
+events = Array[InputEvent]([SubResource("InputEventKey_7yjnx"), SubResource("InputEventJoypadMotion_jx22h")])
 
 [node name="MoveRightActionPrompt" type="TextureRect" parent="."]
 custom_minimum_size = Vector2(100, 100)
@@ -71,7 +71,7 @@ stretch_mode = 5
 script = ExtResource("2_hmylp")
 action = "move_right"
 icon = 0
-events = Array[InputEvent]([SubResource("InputEventKey_vmcvq"), SubResource("InputEventJoypadMotion_auo40")])
+events = Array[InputEvent]([SubResource("InputEventKey_4j1an"), SubResource("InputEventJoypadMotion_3k62j")])
 
 [node name="MoveForwardActionPrompt" type="TextureRect" parent="."]
 custom_minimum_size = Vector2(100, 100)
@@ -81,7 +81,7 @@ stretch_mode = 5
 script = ExtResource("2_hmylp")
 action = "move_forward"
 icon = 0
-events = Array[InputEvent]([SubResource("InputEventKey_urkwk"), SubResource("InputEventJoypadMotion_sgel0")])
+events = Array[InputEvent]([SubResource("InputEventKey_kss0e"), SubResource("InputEventJoypadMotion_t2hi6")])
 
 [node name="MoveBackActionPrompt" type="TextureRect" parent="."]
 custom_minimum_size = Vector2(100, 100)
@@ -91,9 +91,4 @@ stretch_mode = 5
 script = ExtResource("2_hmylp")
 action = "move_back"
 icon = 0
-events = Array[InputEvent]([SubResource("InputEventKey_3sn2y"), SubResource("InputEventJoypadMotion_kmldo")])
-
-[connection signal="pressed" from="MoveLeftActionPrompt" to="MoveLeftActionPrompt" method="queue_free"]
-[connection signal="pressed" from="MoveRightActionPrompt" to="MoveRightActionPrompt" method="queue_free"]
-[connection signal="pressed" from="MoveForwardActionPrompt" to="MoveForwardActionPrompt" method="queue_free"]
-[connection signal="pressed" from="MoveBackActionPrompt" to="MoveBackActionPrompt" method="queue_free"]
+events = Array[InputEvent]([SubResource("InputEventKey_aos7d"), SubResource("InputEventJoypadMotion_u784o")])

+ 2 - 1
godot/component/ui/input_prompts/prompt_container.gd

@@ -1,6 +1,6 @@
 class_name PromptContainer
 extends Control
-## Free itself when no prompt remaining
+## Free itself when every prompt has been used
 
 
 var _nb_prompts: int
@@ -10,6 +10,7 @@ func _ready() -> void:
 	_nb_prompts = 0
 	for child in get_children():
 		if child is InputPrompt:
+			child.pressed.connect(child.queue_free)
 			child.tree_exited.connect(_on_child_exited_tree)
 			_nb_prompts += 1