fix: adding ui_pause input action, and logging unhandled input (very spammy)
This commit is contained in:
parent
059b4b96cc
commit
982c426439
|
|
@ -5,7 +5,7 @@ extends Area3D
|
||||||
@onready var viewport: SubViewport = $UiSprite/SubViewport
|
@onready var viewport: SubViewport = $UiSprite/SubViewport
|
||||||
|
|
||||||
|
|
||||||
func _process(_delta):
|
func _process(_delta : float) -> void:
|
||||||
if billboard:
|
if billboard:
|
||||||
var camera := get_viewport().get_camera_3d()
|
var camera := get_viewport().get_camera_3d()
|
||||||
|
|
||||||
|
|
@ -14,14 +14,13 @@ func _process(_delta):
|
||||||
|
|
||||||
look_at(global_position - (camera.global_position - global_position), up)
|
look_at(global_position - (camera.global_position - global_position), up)
|
||||||
|
|
||||||
|
|
||||||
func _input(event: InputEvent) -> void:
|
func _input(event: InputEvent) -> void:
|
||||||
if event is InputEventAction:
|
if event is InputEventAction:
|
||||||
print(event.action)
|
print(event.action)
|
||||||
|
|
||||||
#func _unhandled_input(event):
|
|
||||||
# viewport.push_input(event)
|
|
||||||
|
|
||||||
func _on_input_event(_camera: Camera3D, event: InputEvent, pos: Vector3, _normal: Vector3, _shape_idx: int):
|
func _on_input_event(_camera: Camera3D, event: InputEvent, pos: Vector3, _normal: Vector3, _shape_idx: int) -> void:
|
||||||
if not Scenes.is_playing:
|
if not Scenes.is_playing:
|
||||||
# Position of the event in Sprite3D local coordinates.
|
# Position of the event in Sprite3D local coordinates.
|
||||||
var texture_3d_position := sprite.get_global_transform().affine_inverse() * pos
|
var texture_3d_position := sprite.get_global_transform().affine_inverse() * pos
|
||||||
|
|
@ -37,8 +36,8 @@ func _on_input_event(_camera: Camera3D, event: InputEvent, pos: Vector3, _normal
|
||||||
e.set_global_position(texture_position)
|
e.set_global_position(texture_position)
|
||||||
viewport.push_input(e)
|
viewport.push_input(e)
|
||||||
|
|
||||||
func _on_button_pressed():
|
func _on_button_pressed() -> void:
|
||||||
print("Button pressed")
|
print("Button pressed")
|
||||||
|
|
||||||
func _on_line_edit_text_submitted(new_text):
|
func _on_line_edit_text_submitted(new_text) -> void:
|
||||||
print("Text submitted: ", new_text)
|
print("Text submitted: ", new_text)
|
||||||
|
|
|
||||||
|
|
@ -17,4 +17,4 @@ func vanish():
|
||||||
get_parent_control().visible = false
|
get_parent_control().visible = false
|
||||||
|
|
||||||
#func _input(event: InputEvent) -> void:
|
#func _input(event: InputEvent) -> void:
|
||||||
# print(event)
|
# print(event : InputEvent)
|
||||||
|
|
@ -390,7 +390,7 @@ func handle_drop(draggable: Draggable) -> int:
|
||||||
|
|
||||||
|
|
||||||
# Takes the inputs for control inputs
|
# Takes the inputs for control inputs
|
||||||
func _input(event) -> void:
|
func _input(event : InputEvent) -> void:
|
||||||
if event.is_action_pressed("ui_cancel"):
|
if event.is_action_pressed("ui_cancel"):
|
||||||
closed.emit()
|
closed.emit()
|
||||||
get_viewport().set_input_as_handled()
|
get_viewport().set_input_as_handled()
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ var random_player: AnimationPlayer
|
||||||
|
|
||||||
var card_anim_skipped:bool = false
|
var card_anim_skipped:bool = false
|
||||||
|
|
||||||
func _input(event):
|
func _input(event : InputEvent):
|
||||||
if _input_locked: return
|
if _input_locked: return
|
||||||
|
|
||||||
# Navigation
|
# Navigation
|
||||||
|
|
|
||||||
|
|
@ -173,6 +173,7 @@ func play():
|
||||||
|
|
||||||
|
|
||||||
func _unhandled_input(event: InputEvent) -> void:
|
func _unhandled_input(event: InputEvent) -> void:
|
||||||
|
if event.is_action_type(): print_debug("Unhandled Input", event)
|
||||||
var just_revealed_text := false
|
var just_revealed_text := false
|
||||||
if event is InputEventMouseButton:
|
if event is InputEventMouseButton:
|
||||||
if event.button_index == MOUSE_BUTTON_WHEEL_DOWN:
|
if event.button_index == MOUSE_BUTTON_WHEEL_DOWN:
|
||||||
|
|
|
||||||
|
|
@ -2,28 +2,26 @@ extends TabContainer
|
||||||
|
|
||||||
var focus_list: Array
|
var focus_list: Array
|
||||||
|
|
||||||
func _ready():
|
func _ready() -> void:
|
||||||
for child in get_children():
|
for child in get_children():
|
||||||
focus_list.append(_find_selectable_in(child))
|
focus_list.append(_find_selectable_in(child))
|
||||||
|
|
||||||
func _find_selectable_in(parent:Control):
|
func _find_selectable_in(parent:Control) -> Control:
|
||||||
if parent.focus_mode != FOCUS_NONE:
|
if parent.focus_mode != FOCUS_NONE:
|
||||||
return parent
|
return parent
|
||||||
if parent.get_child_count() == 0:
|
for child in parent.get_children():
|
||||||
return self
|
var ret := _find_selectable_in(child)
|
||||||
else:
|
if not ret == self:
|
||||||
for child in parent.get_children():
|
return ret
|
||||||
var ret = _find_selectable_in(child)
|
return self
|
||||||
if not ret == self:
|
|
||||||
return ret
|
|
||||||
|
|
||||||
func _unhandled_input(event):
|
|
||||||
|
|
||||||
|
func _unhandled_input(event : InputEvent) -> void:
|
||||||
|
if event.is_action_type(): print_debug("Unhandled Input", event)
|
||||||
if event.is_action_type():
|
if event.is_action_type():
|
||||||
if event.is_action_pressed("ui_left"): previous()
|
if event.is_action_pressed("ui_left"): previous()
|
||||||
elif event.is_action_pressed("ui_right"): next()
|
elif event.is_action_pressed("ui_right"): next()
|
||||||
|
|
||||||
func next():
|
func next() -> void:
|
||||||
if current_tab < get_tab_count()-1:
|
if current_tab < get_tab_count()-1:
|
||||||
if !Input.is_action_just_released("mouse_left"):
|
if !Input.is_action_just_released("mouse_left"):
|
||||||
if not get_viewport().gui_get_focus_owner() == null:
|
if not get_viewport().gui_get_focus_owner() == null:
|
||||||
|
|
@ -33,7 +31,7 @@ func next():
|
||||||
else:
|
else:
|
||||||
current_tab += 1
|
current_tab += 1
|
||||||
|
|
||||||
func previous():
|
func previous() -> void:
|
||||||
if current_tab > 0:
|
if current_tab > 0:
|
||||||
if !Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT):
|
if !Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT):
|
||||||
if not get_viewport().gui_get_focus_owner() == null:
|
if not get_viewport().gui_get_focus_owner() == null:
|
||||||
|
|
|
||||||
|
|
@ -204,6 +204,15 @@ crouch={
|
||||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":7,"pressure":0.0,"pressed":false,"script":null)
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":7,"pressure":0.0,"pressed":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
ui_pause={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194305,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194313,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":6,"pressure":0.0,"pressed":true,"script":null)
|
||||||
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":4,"pressure":0.0,"pressed":true,"script":null)
|
||||||
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":5,"pressure":0.0,"pressed":true,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
[internationalization]
|
[internationalization]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -242,7 +242,6 @@ func _unhandled_input(event: InputEvent) -> void:
|
||||||
else:
|
else:
|
||||||
last_mode = DisplayServer.window_get_mode()
|
last_mode = DisplayServer.window_get_mode()
|
||||||
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
|
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
|
|
|
||||||
|
|
@ -107,5 +107,6 @@ func _load_room(scene_path: String) -> void:
|
||||||
|
|
||||||
|
|
||||||
func _unhandled_input(event: InputEvent) -> void:
|
func _unhandled_input(event: InputEvent) -> void:
|
||||||
if event.is_action_pressed("ui_cancel"):
|
if event.is_action_type(): print_debug("Unhandled Input", event)
|
||||||
|
if event.is_action_pressed("ui_pause"):
|
||||||
state = AppState.PAUSE
|
state = AppState.PAUSE
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue