Improve CCS dialogue advancement
This commit is contained in:
@@ -92,21 +92,29 @@ func _run() -> void:
|
||||
_assert(_label_content_fits(screen.active_scene.dialogue_text), "the first patient response page should fit inside its speech bubble")
|
||||
_assert(is_equal_approx(screen.active_scene.dialogue_text.offset_left, 96.0), "patient dialogue should retain the increased left inset")
|
||||
_assert(_bubble_matches_content(screen.active_scene), "the speech bubble should size itself to the wrapped response page")
|
||||
screen.active_scene.advance_dialogue()
|
||||
_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")
|
||||
var outside_click := _left_click(screen.active_scene.get_global_rect().end + Vector2(50.0, 50.0))
|
||||
screen.active_scene._unhandled_input(outside_click)
|
||||
_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())
|
||||
screen.active_scene._unhandled_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_continue_hint.visible, "completed dialogue pages should invite the learner to continue")
|
||||
await create_timer(1.35).timeout
|
||||
_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")
|
||||
while screen.active_scene.dialogue_page_index < screen.active_scene.dialogue_pages.size() - 1:
|
||||
screen.active_scene.advance_dialogue()
|
||||
screen.active_scene._unhandled_input(scene_click)
|
||||
await process_frame
|
||||
_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.advance_dialogue()
|
||||
screen.active_scene._unhandled_input(scene_click)
|
||||
await process_frame
|
||||
_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")
|
||||
screen.active_scene._unhandled_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_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(_visible_choice_ids(screen.active_scene) == ["topic_0", "topic_1", "topic_2", "topic_3"], "the first page should preserve choice order and IDs")
|
||||
@@ -152,6 +160,7 @@ func _run() -> void:
|
||||
await process_frame
|
||||
var short_height: float = sizing_scene.dialogue_bubble.size.y
|
||||
_assert(is_equal_approx(short_height, sizing_scene.DIALOGUE_BUBBLE_MIN_HEIGHT), "short dialogue should use the minimum bubble height")
|
||||
_assert(sizing_scene.dialogue_bubble.get_global_rect().encloses(sizing_scene.dialogue_continue_hint.get_global_rect()), "the continuation hint should fit inside a minimum-height bubble")
|
||||
sizing_scene.show_patient_dialogue("Line one explains the symptom.\nLine two adds timing.\nLine three adds context.\nLine four concludes.")
|
||||
await process_frame
|
||||
_assert(sizing_scene.dialogue_bubble.size.y > short_height, "multi-line dialogue should increase the bubble height")
|
||||
@@ -271,6 +280,14 @@ func _bubble_matches_content(scene: Control) -> bool:
|
||||
and _label_content_fits(scene.dialogue_text)
|
||||
|
||||
|
||||
func _left_click(position: Vector2) -> InputEventMouseButton:
|
||||
var event := InputEventMouseButton.new()
|
||||
event.button_index = MOUSE_BUTTON_LEFT
|
||||
event.pressed = true
|
||||
event.position = position
|
||||
return event
|
||||
|
||||
|
||||
func _assert(condition: bool, message: String) -> void:
|
||||
if condition:
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user