finally cleaned up input method detection
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user