|
|
|
|
@ -47,12 +47,18 @@ fn main() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Reports if the game is loading assets
|
|
|
|
|
#[derive(States, Default, Clone, Eq, Debug, PartialEq, Hash, Component)]
|
|
|
|
|
#[derive(States, Clone, Eq, Debug, PartialEq, Hash, Component)]
|
|
|
|
|
struct Loading(bool);
|
|
|
|
|
|
|
|
|
|
impl Default for Loading {
|
|
|
|
|
fn default() -> Self {
|
|
|
|
|
Loading(true)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl fmt::Display for Loading {
|
|
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
|
|
|
rite!(f, "Loading {}", self.0)
|
|
|
|
|
write!(f, "Loading {}", self.0)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -97,7 +103,7 @@ impl SetupChecklist {
|
|
|
|
|
fn loading_check(mut next: ResMut<NextState<Loading>>, all_assets: Res<AllAssets>) {
|
|
|
|
|
debug_assert!(all_assets.is_changed());
|
|
|
|
|
|
|
|
|
|
next.set(Loading::Active);
|
|
|
|
|
next.set(Loading(true));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Waits in Loading::Active until all assets are loaded then move to Loading(false)
|
|
|
|
|
|