|
|
|
|
@ -24,7 +24,8 @@ impl Plugin for IntroPlugin {
|
|
|
|
|
// Updated for as long as there is scrolling text
|
|
|
|
|
manage_scroll_text_animation.run_if(
|
|
|
|
|
any_component_added::<ui::TextScrollAnimation>()
|
|
|
|
|
.or_else(just_pressed(KeyCode::Return)),
|
|
|
|
|
.or_else(just_pressed(KeyCode::Return))
|
|
|
|
|
.or_else(just_pressed(MouseButton::Left)),
|
|
|
|
|
),
|
|
|
|
|
// Play intro manages playing the intro of each individual paragraph
|
|
|
|
|
// Runs every time the TextScroll component (managed by manage_scroll_text_animation) is updated
|
|
|
|
|
@ -239,6 +240,7 @@ fn scroll_text(
|
|
|
|
|
tweaks: Res<Assets<tweak::Tweaks>>,
|
|
|
|
|
time: Res<Time>,
|
|
|
|
|
keys: Res<Input<KeyCode>>,
|
|
|
|
|
mouse: Res<Input<MouseButton>>,
|
|
|
|
|
parents: Query<&Parent>,
|
|
|
|
|
mut commands: Commands,
|
|
|
|
|
) {
|
|
|
|
|
@ -258,17 +260,18 @@ fn scroll_text(
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If user pressed enter, skip to end of paragraph
|
|
|
|
|
text_scroll.progress = if keys.just_pressed(KeyCode::Return) {
|
|
|
|
|
usize::MAX
|
|
|
|
|
}
|
|
|
|
|
// Otherwise, progress by some fixed increment
|
|
|
|
|
else {
|
|
|
|
|
// Update animation progress for this paragrpah
|
|
|
|
|
let delay = tweak.get::<f32>("intro_delay").unwrap();
|
|
|
|
|
text_scroll.progress =
|
|
|
|
|
if keys.just_pressed(KeyCode::Return) || mouse.just_pressed(MouseButton::Left) {
|
|
|
|
|
usize::MAX
|
|
|
|
|
}
|
|
|
|
|
// Otherwise, progress by some fixed increment
|
|
|
|
|
else {
|
|
|
|
|
// Update animation progress for this paragrpah
|
|
|
|
|
let delay = tweak.get::<f32>("intro_delay").unwrap();
|
|
|
|
|
|
|
|
|
|
// Update text_scroll.progress based on frame count
|
|
|
|
|
((time.elapsed_seconds() - text_scroll.start) / delay) as usize
|
|
|
|
|
};
|
|
|
|
|
// Update text_scroll.progress based on frame count
|
|
|
|
|
((time.elapsed_seconds() - text_scroll.start) / delay) as usize
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Fetch desired color from tweakfile
|
|
|
|
|
let text_visible_hex = tweak.get::<String>("intro_rgba_visible").unwrap();
|
|
|
|
|
|