Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions scenes/menus/storybook/components/storybook.gd
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ signal selected(quest: Quest, restart: bool)
set(value):
quests_per_page = value
quests_per_spread = value * 2
@export var fade_duration: float = 0.15

var quests_per_spread: int = 16

Expand All @@ -35,6 +36,19 @@ var _current_list_page: int = 0
@onready var ui_container: Control = %StoryBookContent


func _fade_out_ui() -> void:
var tween := create_tween()
tween.tween_property(ui_container, "modulate:a", 0.0, fade_duration)
await tween.finished
ui_container.visible = false


func _fade_in_ui() -> void:
ui_container.visible = true
var tween := create_tween()
tween.tween_property(ui_container, "modulate:a", 1.0, fade_duration)


func _ready() -> void:
animated_book.animation_finished.connect(_on_animation_finished)
_populate_quest_lists()
Expand Down Expand Up @@ -166,6 +180,8 @@ func _switch_to_page(spread_index: int) -> void:
_current_spread_index = spread_index

if old_index != -1:
await _fade_out_ui()

if spread_index > old_index or (spread_index == 0 and old_index == total_spreads - 1):
animated_book.play("book_right")
else:
Expand All @@ -177,9 +193,9 @@ func _switch_to_page(spread_index: int) -> void:


func _on_animation_finished() -> void:
_navigation_locked = false
ui_container.visible = true
_fade_in_ui()
_update_page_visibility()
_navigation_locked = false


func _on_left_button_pressed() -> void:
Expand Down