Improve CCS dialogue advancement
This commit is contained in:
@@ -12,7 +12,7 @@ const CHOICE_CROP := Rect2(80.0, 200.0, 1610.0, 485.0)
|
||||
const CHOICES_PER_PAGE := 4
|
||||
const DIALOGUE_PAGE_MIN_CHARS := 32
|
||||
const DIALOGUE_PAGE_MAX_CHARS := 82
|
||||
const DIALOGUE_BUBBLE_MIN_HEIGHT := 150.0
|
||||
const DIALOGUE_BUBBLE_MIN_HEIGHT := 110.0
|
||||
const DIALOGUE_BUBBLE_MAX_HEIGHT := 240.0
|
||||
const DIALOGUE_BUBBLE_VERTICAL_CHROME := 83.0
|
||||
|
||||
@@ -120,7 +120,8 @@ func _show_dialogue_page() -> void:
|
||||
dialogue_text.text = dialogue_pages[dialogue_page_index]
|
||||
dialogue_text.visible_ratio = 0.0
|
||||
dialogue_reveal_complete = false
|
||||
dialogue_continue_hint.visible = false
|
||||
dialogue_continue_hint.text = "Click to continue ▼"
|
||||
dialogue_continue_hint.visible = true
|
||||
dialogue_bubble.visible = true
|
||||
dialogue_bubble.grab_focus()
|
||||
dialogue_layout_generation += 1
|
||||
@@ -190,11 +191,7 @@ func complete_dialogue_reveal() -> void:
|
||||
func _on_dialogue_reveal_finished() -> void:
|
||||
dialogue_tween = null
|
||||
dialogue_reveal_complete = true
|
||||
dialogue_continue_hint.text = (
|
||||
"Click to see questions ▼"
|
||||
if dialogue_page_index >= dialogue_pages.size() - 1
|
||||
else "Click to continue ▼"
|
||||
)
|
||||
dialogue_continue_hint.text = "Click to continue ▼"
|
||||
dialogue_continue_hint.visible = true
|
||||
|
||||
|
||||
@@ -232,6 +229,24 @@ func _on_dialogue_bubble_input(event: InputEvent) -> void:
|
||||
accept_event()
|
||||
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if not dialogue_bubble.visible:
|
||||
return
|
||||
var should_advance := false
|
||||
if event is InputEventMouseButton:
|
||||
should_advance = event.button_index == MOUSE_BUTTON_LEFT and event.pressed \
|
||||
and get_global_rect().has_point(event.position)
|
||||
elif event is InputEventScreenTouch:
|
||||
should_advance = event.pressed and get_global_rect().has_point(event.position)
|
||||
elif event is InputEventKey:
|
||||
should_advance = event.pressed and not event.echo \
|
||||
and event.keycode in [KEY_ENTER, KEY_KP_ENTER, KEY_SPACE]
|
||||
if not should_advance:
|
||||
return
|
||||
advance_dialogue()
|
||||
get_viewport().set_input_as_handled()
|
||||
|
||||
|
||||
func _split_dialogue_pages(text: String) -> Array[String]:
|
||||
var normalized := text.strip_edges()
|
||||
if normalized.is_empty():
|
||||
|
||||
Reference in New Issue
Block a user