Polish dialog and intro transitions
This commit is contained in:
parent
3975959017
commit
d413d1da9f
7 changed files with 228 additions and 4 deletions
|
|
@ -240,12 +240,26 @@ func _advance() -> void:
|
|||
label.visible_characters = 0
|
||||
speaker_label.text = speaker
|
||||
visible = true
|
||||
_release_touch_joysticks()
|
||||
Sfx.play(get_tree(), Sfx.DIALOG)
|
||||
_layout()
|
||||
queue_redraw()
|
||||
_sync_pause()
|
||||
|
||||
|
||||
# A touch release delivered while the tree is paused never reaches an
|
||||
# ordinary joystick. Neutralise every spring-loaded stick immediately before
|
||||
# applying the pause, so neither movement nor firing resumes from stale input
|
||||
# when the dialog closes (#182).
|
||||
func _release_touch_joysticks() -> void:
|
||||
var tree: SceneTree = get_tree()
|
||||
if tree == null:
|
||||
return
|
||||
for joystick in tree.get_nodes_in_group("touch_joysticks"):
|
||||
if is_instance_valid(joystick) and joystick.has_method("release_input"):
|
||||
joystick.release_input()
|
||||
|
||||
|
||||
func is_typing() -> bool:
|
||||
return current != "" and revealed < float(current.length())
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,9 @@ var knob_pos: Vector2 = Vector2.ZERO
|
|||
|
||||
|
||||
func _ready() -> void:
|
||||
# Dialogs release every spring-loaded stick through one compositional
|
||||
# contract, without NarrationBanner knowing scene paths or joystick roles.
|
||||
add_to_group("touch_joysticks")
|
||||
resized.connect(_relayout)
|
||||
_relayout()
|
||||
|
||||
|
|
@ -79,6 +82,15 @@ func handle_touch(event: InputEventScreenTouch) -> bool:
|
|||
|
||||
if event.index != active_touch_index:
|
||||
return false
|
||||
release_input()
|
||||
return true
|
||||
|
||||
|
||||
# Returns this spring-loaded control to its neutral state. Public and
|
||||
# idempotent so a dialog can safely release movement and fire sticks before
|
||||
# pausing their controllers (#182), even when only one is currently held.
|
||||
func release_input() -> void:
|
||||
var was_active: bool = is_active() or direction != Vector2.ZERO
|
||||
active_touch_index = -1
|
||||
# Back to the middle of the rect, BASE included. This used to reset the
|
||||
# knob onto base_pos and leave the base wherever the finger had landed, so
|
||||
|
|
@ -88,9 +100,9 @@ func handle_touch(event: InputEventScreenTouch) -> bool:
|
|||
knob_pos = base_pos
|
||||
direction = Vector2.ZERO
|
||||
queue_redraw()
|
||||
direction_changed.emit(direction)
|
||||
released.emit()
|
||||
return true
|
||||
if was_active:
|
||||
direction_changed.emit(direction)
|
||||
released.emit()
|
||||
|
||||
|
||||
func handle_drag(event: InputEventScreenDrag) -> bool:
|
||||
|
|
|
|||
Loading…
Reference in a new issue