Fix CCS scene-wide dialogue clicks
This commit is contained in:
@@ -155,9 +155,9 @@ anchor_top = 1.0
|
|||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
offset_left = -330.0
|
offset_left = -330.0
|
||||||
offset_top = -42.0
|
offset_top = -50.0
|
||||||
offset_right = -72.0
|
offset_right = -72.0
|
||||||
offset_bottom = -16.0
|
offset_bottom = -24.0
|
||||||
grow_horizontal = 0
|
grow_horizontal = 0
|
||||||
grow_vertical = 0
|
grow_vertical = 0
|
||||||
mouse_filter = 2
|
mouse_filter = 2
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ var dialogue_layout_generation := 0
|
|||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
dialogue_bubble.gui_input.connect(_on_dialogue_bubble_input)
|
|
||||||
previous_page_button.pressed.connect(_change_choice_page.bind(-1))
|
previous_page_button.pressed.connect(_change_choice_page.bind(-1))
|
||||||
next_page_button.pressed.connect(_change_choice_page.bind(1))
|
next_page_button.pressed.connect(_change_choice_page.bind(1))
|
||||||
_update_clock()
|
_update_clock()
|
||||||
@@ -219,17 +218,7 @@ func complete_response_transition() -> void:
|
|||||||
show_dialogue_choices(choices)
|
show_dialogue_choices(choices)
|
||||||
|
|
||||||
|
|
||||||
func _on_dialogue_bubble_input(event: InputEvent) -> void:
|
func _input(event: InputEvent) -> void:
|
||||||
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
|
|
||||||
advance_dialogue()
|
|
||||||
accept_event()
|
|
||||||
elif event is InputEventKey and event.pressed and not event.echo \
|
|
||||||
and event.keycode in [KEY_ENTER, KEY_KP_ENTER, KEY_SPACE]:
|
|
||||||
advance_dialogue()
|
|
||||||
accept_event()
|
|
||||||
|
|
||||||
|
|
||||||
func _unhandled_input(event: InputEvent) -> void:
|
|
||||||
if not dialogue_bubble.visible:
|
if not dialogue_bubble.visible:
|
||||||
return
|
return
|
||||||
var should_advance := false
|
var should_advance := false
|
||||||
|
|||||||
@@ -95,25 +95,25 @@ func _run() -> void:
|
|||||||
_assert(screen.active_scene.dialogue_continue_hint.visible, "the continuation prompt should remain visible while text is typing")
|
_assert(screen.active_scene.dialogue_continue_hint.visible, "the continuation prompt should remain visible while text is typing")
|
||||||
_assert(screen.active_scene.dialogue_continue_hint.text == "Click to continue ▼", "every dialogue page should use consistent continuation wording")
|
_assert(screen.active_scene.dialogue_continue_hint.text == "Click to continue ▼", "every dialogue page should use consistent continuation wording")
|
||||||
var outside_click := _left_click(screen.active_scene.get_global_rect().end + Vector2(50.0, 50.0))
|
var outside_click := _left_click(screen.active_scene.get_global_rect().end + Vector2(50.0, 50.0))
|
||||||
screen.active_scene._unhandled_input(outside_click)
|
screen.active_scene._input(outside_click)
|
||||||
_assert(not screen.active_scene.dialogue_reveal_complete, "clicks outside the doctor scene should not affect dialogue")
|
_assert(not screen.active_scene.dialogue_reveal_complete, "clicks outside the doctor scene should not affect dialogue")
|
||||||
var scene_click := _left_click(screen.active_scene.get_global_rect().get_center())
|
var scene_click := _left_click(screen.active_scene.get_global_rect().get_center())
|
||||||
screen.active_scene._unhandled_input(scene_click)
|
screen.active_scene._input(scene_click)
|
||||||
_assert(screen.active_scene.dialogue_page_index == 0, "clicking during typing should complete rather than skip the current page")
|
_assert(screen.active_scene.dialogue_page_index == 0, "clicking during typing should complete rather than skip the current page")
|
||||||
_assert(screen.active_scene.dialogue_continue_hint.visible, "completed dialogue pages should invite the learner to continue")
|
_assert(screen.active_scene.dialogue_continue_hint.visible, "completed dialogue pages should invite the learner to continue")
|
||||||
await create_timer(1.35).timeout
|
await create_timer(1.35).timeout
|
||||||
_assert(screen.active_scene.is_patient_dialogue_visible(), "patient dialogue should remain until the learner advances it")
|
_assert(screen.active_scene.is_patient_dialogue_visible(), "patient dialogue should remain until the learner advances it")
|
||||||
_assert(not screen.active_scene.choice_container.visible, "questions must not appear on a timer")
|
_assert(not screen.active_scene.choice_container.visible, "questions must not appear on a timer")
|
||||||
while screen.active_scene.dialogue_page_index < screen.active_scene.dialogue_pages.size() - 1:
|
while screen.active_scene.dialogue_page_index < screen.active_scene.dialogue_pages.size() - 1:
|
||||||
screen.active_scene._unhandled_input(scene_click)
|
screen.active_scene._input(scene_click)
|
||||||
await process_frame
|
await process_frame
|
||||||
_assert(_label_content_fits(screen.active_scene.dialogue_text), "every patient response page should fit inside its speech bubble")
|
_assert(_label_content_fits(screen.active_scene.dialogue_text), "every patient response page should fit inside its speech bubble")
|
||||||
screen.active_scene.complete_dialogue_reveal()
|
screen.active_scene.complete_dialogue_reveal()
|
||||||
screen.active_scene._unhandled_input(scene_click)
|
screen.active_scene._input(scene_click)
|
||||||
await process_frame
|
await process_frame
|
||||||
_assert(not screen.active_scene.is_patient_dialogue_visible(), "questions should replace patient dialogue after the final learner click")
|
_assert(not screen.active_scene.is_patient_dialogue_visible(), "questions should replace patient dialogue after the final learner click")
|
||||||
_assert(screen.active_scene.choice_container.get_child_count() == 4, "the first question page should contain four choices")
|
_assert(screen.active_scene.choice_container.get_child_count() == 4, "the first question page should contain four choices")
|
||||||
screen.active_scene._unhandled_input(scene_click)
|
screen.active_scene._input(scene_click)
|
||||||
_assert(screen.active_scene.choice_container.get_child_count() == 4, "scene clicks should not affect explicit question controls")
|
_assert(screen.active_scene.choice_container.get_child_count() == 4, "scene clicks should not affect explicit question controls")
|
||||||
_assert(screen.active_scene.choice_pager.visible, "eight choices should display paging controls")
|
_assert(screen.active_scene.choice_pager.visible, "eight choices should display paging controls")
|
||||||
_assert(screen.active_scene.choice_page == 0, "new question sets should begin on the first page")
|
_assert(screen.active_scene.choice_page == 0, "new question sets should begin on the first page")
|
||||||
|
|||||||
Reference in New Issue
Block a user