diff --git a/src/dev-util/click-trough-area.gd b/src/dev-util/click-trough-area.gd index 9a0eb40..ae6e2f4 100644 --- a/src/dev-util/click-trough-area.gd +++ b/src/dev-util/click-trough-area.gd @@ -5,7 +5,7 @@ extends Area3D @onready var viewport: SubViewport = $UiSprite/SubViewport -func _process(_delta): +func _process(_delta : float) -> void: if billboard: var camera := get_viewport().get_camera_3d() @@ -14,14 +14,13 @@ func _process(_delta): look_at(global_position - (camera.global_position - global_position), up) + func _input(event: InputEvent) -> void: if event is InputEventAction: 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: # Position of the event in Sprite3D local coordinates. 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) viewport.push_input(e) -func _on_button_pressed(): +func _on_button_pressed() -> void: 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) diff --git a/src/dev-util/settings_popup.gd b/src/dev-util/settings_popup.gd index 6bb4d2f..57fbb87 100644 --- a/src/dev-util/settings_popup.gd +++ b/src/dev-util/settings_popup.gd @@ -17,4 +17,4 @@ func vanish(): get_parent_control().visible = false #func _input(event: InputEvent) -> void: -# print(event) \ No newline at end of file +# print(event : InputEvent) \ No newline at end of file diff --git a/src/logic-scenes/board/card-board.gd b/src/logic-scenes/board/card-board.gd index 378f6d3..77b41a4 100644 --- a/src/logic-scenes/board/card-board.gd +++ b/src/logic-scenes/board/card-board.gd @@ -390,7 +390,7 @@ func handle_drop(draggable: Draggable) -> int: # Takes the inputs for control inputs -func _input(event) -> void: +func _input(event : InputEvent) -> void: if event.is_action_pressed("ui_cancel"): closed.emit() get_viewport().set_input_as_handled() diff --git a/src/logic-scenes/card_picker/card_picker.gd b/src/logic-scenes/card_picker/card_picker.gd index 27842fc..7677418 100644 --- a/src/logic-scenes/card_picker/card_picker.gd +++ b/src/logic-scenes/card_picker/card_picker.gd @@ -100,7 +100,7 @@ var random_player: AnimationPlayer var card_anim_skipped:bool = false -func _input(event): +func _input(event : InputEvent): if _input_locked: return # Navigation diff --git a/src/logic-scenes/luna/playables/story_playable.gd b/src/logic-scenes/luna/playables/story_playable.gd index 11062e7..6bf94b0 100644 --- a/src/logic-scenes/luna/playables/story_playable.gd +++ b/src/logic-scenes/luna/playables/story_playable.gd @@ -173,6 +173,7 @@ func play(): func _unhandled_input(event: InputEvent) -> void: + if event.is_action_type(): print_debug("Unhandled Input", event) var just_revealed_text := false if event is InputEventMouseButton: if event.button_index == MOUSE_BUTTON_WHEEL_DOWN: diff --git a/src/logic-scenes/startup/accessibility_container.gd b/src/logic-scenes/startup/accessibility_container.gd index 82cbe1d..12c7e85 100644 --- a/src/logic-scenes/startup/accessibility_container.gd +++ b/src/logic-scenes/startup/accessibility_container.gd @@ -2,28 +2,26 @@ extends TabContainer var focus_list: Array -func _ready(): +func _ready() -> void: for child in get_children(): 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: return parent - if parent.get_child_count() == 0: - return self - else: - for child in parent.get_children(): - var ret = _find_selectable_in(child) - if not ret == self: - return ret - -func _unhandled_input(event): + for child in parent.get_children(): + var ret := _find_selectable_in(child) + if not ret == self: + return ret + return self +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_pressed("ui_left"): previous() elif event.is_action_pressed("ui_right"): next() -func next(): +func next() -> void: if current_tab < get_tab_count()-1: if !Input.is_action_just_released("mouse_left"): if not get_viewport().gui_get_focus_owner() == null: @@ -33,7 +31,7 @@ func next(): else: current_tab += 1 -func previous(): +func previous() -> void: if current_tab > 0: if !Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT): if not get_viewport().gui_get_focus_owner() == null: diff --git a/src/project.godot b/src/project.godot index c01c1ca..1c0756c 100644 --- a/src/project.godot +++ b/src/project.godot @@ -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) ] } +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] diff --git a/src/singletons/global_state.gd b/src/singletons/global_state.gd index 72bcd5e..8c15e5a 100644 --- a/src/singletons/global_state.gd +++ b/src/singletons/global_state.gd @@ -242,7 +242,6 @@ func _unhandled_input(event: InputEvent) -> void: else: last_mode = DisplayServer.window_get_mode() DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN) - #endregion func _ready(): diff --git a/src/singletons/main/main.gd b/src/singletons/main/main.gd index a8504be..cde375b 100644 --- a/src/singletons/main/main.gd +++ b/src/singletons/main/main.gd @@ -107,5 +107,6 @@ func _load_room(scene_path: String) -> 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