finally cleaned up input method detection
All checks were successful
Create tag and build when new code gets to main / BumpTag (push) Successful in 21s
Create tag and build when new code gets to main / Test (push) Successful in 6m46s
Create tag and build when new code gets to main / Export (push) Successful in 8m3s

This commit is contained in:
2026-02-16 23:15:25 +01:00
parent 759d972b6d
commit b9ae83cd92
10 changed files with 808 additions and 61 deletions

View File

@@ -1,6 +1,7 @@
[gd_scene format=3 uid="uid://b8aet6m4m2i83"]
[ext_resource type="Script" uid="uid://bnqhh6b5iusam" path="res://scenes/tuto_trigger/tuto_trigger.gd" id="1_w8mpv"]
[ext_resource type="Texture2D" uid="uid://dl73t0kxkaxp0" path="res://assets/ui/input-prompts/Xbox Series/Vector/xbox_button_a_outline.svg" id="2_w8mpv"]
[sub_resource type="LabelSettings" id="LabelSettings_4vbx1"]
font_size = 30
@@ -11,9 +12,9 @@ font_size = 30
[node name="TutoTrigger" type="Area3D" unique_id=840713937]
collision_layer = 0
script = ExtResource("1_w8mpv")
tuto_text = null
[node name="Control" type="Control" parent="." unique_id=1871566632]
visible = false
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
@@ -44,16 +45,19 @@ theme_override_constants/separation = 20
[node name="MultipleInputsContainer" type="HBoxContainer" parent="Control/PanelContainer/MarginContainer/HBoxContainer" unique_id=487996484]
unique_name_in_owner = true
visible = false
layout_mode = 2
theme_override_constants/separation = 0
[node name="FirstInput" type="TextureRect" parent="Control/PanelContainer/MarginContainer/HBoxContainer/MultipleInputsContainer" unique_id=490808492]
unique_name_in_owner = true
layout_mode = 2
texture = ExtResource("2_w8mpv")
[node name="ComplexInputLabel" type="Label" parent="Control/PanelContainer/MarginContainer/HBoxContainer/MultipleInputsContainer" unique_id=103193503]
unique_name_in_owner = true
layout_mode = 2
text = "while airborne"
label_settings = SubResource("LabelSettings_4vbx1")
[node name="SecondInput" type="TextureRect" parent="Control/PanelContainer/MarginContainer/HBoxContainer/MultipleInputsContainer" unique_id=523697392]
@@ -65,5 +69,14 @@ unique_name_in_owner = true
layout_mode = 2
label_settings = SubResource("LabelSettings_g04tr")
[node name="InputPrompt" type="RichTextLabel" parent="Control/PanelContainer/MarginContainer/HBoxContainer" unique_id=683811955]
unique_name_in_owner = true
custom_minimum_size = Vector2(256, 0)
layout_mode = 2
text = "hello there"
fit_content = true
horizontal_alignment = 1
vertical_alignment = 1
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
[connection signal="body_exited" from="." to="." method="_on_body_exited"]

View File

@@ -1,38 +1,35 @@
extends Area3D
class_name TutoTrigger
@onready var control: Control = $Control
@onready var multiple_inputs_container: HBoxContainer = %MultipleInputsContainer
@onready var first_input: TextureRect = %FirstInput
@onready var complex_input_label: Label = %ComplexInputLabel
@onready var second_input: TextureRect = %SecondInput
@onready var tuto_label: Label = %TutoText
@export var first_input_texture: CompressedTexture2D
@export var second_input_texture: CompressedTexture2D
@export var complex_input_text: String
@export var input: GUIDEAction
@export var second_input: GUIDEAction = null
@export var tuto_text: String
@onready var input_prompt: RichTextLabel = %InputPrompt
@onready var control: Control = $Control
var current_input_method = GlobalHelpers.GamepadDetectionEvent.GAMEPAD
func _ready() -> void:
tuto_label.text = tuto_text
first_input.texture = first_input_texture
second_input.texture = second_input_texture
complex_input_label.text = complex_input_text
control.visible = false
_on_input_mappings_changed()
if second_input_texture != null:
complex_input_label.text = "+"
if second_input_texture == null and complex_input_text.is_empty():
complex_input_label.visible = false
second_input.visible = false
func _input(event: InputEvent) -> void:
var event_gamepad = GlobalHelpers.is_event_gamepad(event)
if event_gamepad == GlobalHelpers.GamepadDetectionEvent.IRRELEVANT:
return
if current_input_method == event_gamepad:
return
current_input_method = event_gamepad
_on_input_mappings_changed()
func _on_input_mappings_changed():
pass
func _on_body_entered(body: Node3D) -> void:
control.visible = true
func _on_body_exited(body: Node3D) -> void:
control.visible = false