use crate::prelude::*; pub(crate) struct UiPlugin; impl Plugin for UiPlugin { fn build(&self, app: &mut App) { app.add_systems(Startup, load_assets).add_systems( Update, ( manage_cursor.run_if( any_component_changed::().or_else(state_changed::), ), interactive_button.run_if(any_component_changed::()), scale_ui.run_if( on_event::>() .or_else(any_component_changed::()) .and_then(resource_exists::), ), ), ); } } #[derive(Debug, Resource)] pub(crate) struct UiFont { pub handle: Handle, } #[derive(Debug, Component)] pub(crate) struct TextScroll { pub progress: usize, pub start: f32, } #[derive(Debug, Component)] pub(crate) struct TextScrollAnimation; fn load_assets(server: ResMut, mut commands: Commands) { commands.insert_resource(UiFont { handle: server.load("fonts/Silkscreen/Silkscreen-Regular.ttf"), }); } fn manage_cursor( mut window: Query<&mut Window, With>, state: Res>, buttons: Query<&Interaction, With