chore(deps): migrate to Bevy 0.18
- BorderRadius is no longer a Component; moved into Node.border_radius field at all 15 spawn sites across 6 plugin files - Events<T> renamed to Messages<T> in test code (12 files) - KeyboardEvents SystemParam renamed to KeyboardMessages to match the MessageWriter rename done in the 0.17 hop - WindowResolution::from((f32,f32)) removed; use (u32,u32) tuple in main.rs Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -248,10 +248,10 @@ fn spawn_achievements_screen(commands: &mut Commands, records: &[AchievementReco
|
||||
min_width: Val::Px(380.0),
|
||||
max_height: Val::Percent(80.0),
|
||||
overflow: Overflow::clip_y(),
|
||||
border_radius: BorderRadius::all(Val::Px(8.0)),
|
||||
..default()
|
||||
},
|
||||
BackgroundColor(Color::srgb(0.09, 0.09, 0.12)),
|
||||
BorderRadius::all(Val::Px(8.0)),
|
||||
))
|
||||
.with_children(|card| {
|
||||
// Header
|
||||
@@ -415,7 +415,7 @@ mod tests {
|
||||
assert!(unlocked_first_win);
|
||||
|
||||
// Verify the event was emitted.
|
||||
let events = app.world().resource::<Events<AchievementUnlockedEvent>>();
|
||||
let events = app.world().resource::<Messages<AchievementUnlockedEvent>>();
|
||||
let mut cursor = events.get_cursor();
|
||||
let fired: Vec<String> = cursor.read(events).map(|e| e.0.id.clone()).collect();
|
||||
assert!(fired.contains(&"first_win".to_string()));
|
||||
@@ -433,7 +433,7 @@ mod tests {
|
||||
|
||||
// Clear events from first win.
|
||||
app.world_mut()
|
||||
.resource_mut::<Events<AchievementUnlockedEvent>>()
|
||||
.resource_mut::<Messages<AchievementUnlockedEvent>>()
|
||||
.clear();
|
||||
|
||||
app.world_mut().write_message(GameWonEvent {
|
||||
@@ -442,7 +442,7 @@ mod tests {
|
||||
});
|
||||
app.update();
|
||||
|
||||
let events = app.world().resource::<Events<AchievementUnlockedEvent>>();
|
||||
let events = app.world().resource::<Messages<AchievementUnlockedEvent>>();
|
||||
let mut cursor = events.get_cursor();
|
||||
let fired: Vec<String> = cursor.read(events).map(|e| e.0.id.clone()).collect();
|
||||
assert!(
|
||||
@@ -468,7 +468,7 @@ mod tests {
|
||||
});
|
||||
app.update();
|
||||
|
||||
let events = app.world().resource::<Events<XpAwardedEvent>>();
|
||||
let events = app.world().resource::<Messages<XpAwardedEvent>>();
|
||||
let mut cursor = events.get_cursor();
|
||||
let xp_events: Vec<u64> = cursor.read(events).map(|e| e.amount).collect();
|
||||
// The no_undo achievement (BonusXp 25) must have fired an XpAwardedEvent.
|
||||
@@ -494,7 +494,7 @@ mod tests {
|
||||
app.update();
|
||||
|
||||
// "no_undo" awards BonusXp(25). If undo was used it must NOT fire.
|
||||
let events = app.world().resource::<Events<XpAwardedEvent>>();
|
||||
let events = app.world().resource::<Messages<XpAwardedEvent>>();
|
||||
let mut cursor = events.get_cursor();
|
||||
let xp_events: Vec<u64> = cursor.read(events).map(|e| e.amount).collect();
|
||||
assert!(
|
||||
|
||||
@@ -190,7 +190,7 @@ mod tests {
|
||||
app.update(); // detect runs, sets active
|
||||
app.update(); // drive fires the move
|
||||
|
||||
let events = app.world().resource::<Events<MoveRequestEvent>>();
|
||||
let events = app.world().resource::<Messages<MoveRequestEvent>>();
|
||||
let mut cursor = events.get_cursor();
|
||||
let fired: Vec<_> = cursor.read(events).collect();
|
||||
// At least one MoveRequestEvent should have been fired.
|
||||
|
||||
@@ -133,7 +133,7 @@ mod tests {
|
||||
let p = &app.world().resource::<ProgressResource>().0;
|
||||
assert_eq!(p.challenge_index, 1);
|
||||
|
||||
let events = app.world().resource::<Events<ChallengeAdvancedEvent>>();
|
||||
let events = app.world().resource::<Messages<ChallengeAdvancedEvent>>();
|
||||
let mut cursor = events.get_cursor();
|
||||
let fired: Vec<_> = cursor.read(events).copied().collect();
|
||||
assert_eq!(fired.len(), 1);
|
||||
@@ -154,7 +154,7 @@ mod tests {
|
||||
let p = &app.world().resource::<ProgressResource>().0;
|
||||
assert_eq!(p.challenge_index, 0);
|
||||
|
||||
let events = app.world().resource::<Events<ChallengeAdvancedEvent>>();
|
||||
let events = app.world().resource::<Messages<ChallengeAdvancedEvent>>();
|
||||
let mut cursor = events.get_cursor();
|
||||
assert!(cursor.read(events).next().is_none());
|
||||
}
|
||||
@@ -168,7 +168,7 @@ mod tests {
|
||||
.press(KeyCode::KeyX);
|
||||
app.update();
|
||||
|
||||
let events = app.world().resource::<Events<NewGameRequestEvent>>();
|
||||
let events = app.world().resource::<Messages<NewGameRequestEvent>>();
|
||||
let mut cursor = events.get_cursor();
|
||||
assert!(cursor.read(events).next().is_none());
|
||||
}
|
||||
@@ -188,7 +188,7 @@ mod tests {
|
||||
.press(KeyCode::KeyX);
|
||||
app.update();
|
||||
|
||||
let events = app.world().resource::<Events<NewGameRequestEvent>>();
|
||||
let events = app.world().resource::<Messages<NewGameRequestEvent>>();
|
||||
let mut cursor = events.get_cursor();
|
||||
let fired: Vec<_> = cursor.read(events).copied().collect();
|
||||
assert_eq!(fired.len(), 1);
|
||||
@@ -217,7 +217,7 @@ mod tests {
|
||||
});
|
||||
app.update();
|
||||
|
||||
let events = app.world().resource::<Events<InfoToastEvent>>();
|
||||
let events = app.world().resource::<Messages<InfoToastEvent>>();
|
||||
let mut cursor = events.get_cursor();
|
||||
let fired: Vec<_> = cursor.read(events).collect();
|
||||
assert_eq!(fired.len(), 1, "exactly one toast must fire on challenge win");
|
||||
@@ -237,7 +237,7 @@ mod tests {
|
||||
});
|
||||
app.update();
|
||||
|
||||
let events = app.world().resource::<Events<InfoToastEvent>>();
|
||||
let events = app.world().resource::<Messages<InfoToastEvent>>();
|
||||
let mut cursor = events.get_cursor();
|
||||
assert!(
|
||||
cursor.read(events).next().is_none(),
|
||||
@@ -254,7 +254,7 @@ mod tests {
|
||||
.press(KeyCode::KeyX);
|
||||
app.update();
|
||||
|
||||
let events = app.world().resource::<Events<InfoToastEvent>>();
|
||||
let events = app.world().resource::<Messages<InfoToastEvent>>();
|
||||
let mut cursor = events.get_cursor();
|
||||
let fired: Vec<_> = cursor.read(events).collect();
|
||||
assert_eq!(fired.len(), 1, "must show a toast explaining the lock");
|
||||
|
||||
@@ -255,7 +255,7 @@ mod tests {
|
||||
// +100 from the daily bonus
|
||||
assert!(progress.total_xp >= DAILY_BONUS_XP);
|
||||
|
||||
let events = app.world().resource::<Events<DailyChallengeCompletedEvent>>();
|
||||
let events = app.world().resource::<Messages<DailyChallengeCompletedEvent>>();
|
||||
let mut cursor = events.get_cursor();
|
||||
let fired: Vec<_> = cursor.read(events).copied().collect();
|
||||
assert_eq!(fired.len(), 1);
|
||||
@@ -279,7 +279,7 @@ mod tests {
|
||||
let progress = &app.world().resource::<ProgressResource>().0;
|
||||
assert_eq!(progress.daily_challenge_streak, 0);
|
||||
|
||||
let events = app.world().resource::<Events<DailyChallengeCompletedEvent>>();
|
||||
let events = app.world().resource::<Messages<DailyChallengeCompletedEvent>>();
|
||||
let mut cursor = events.get_cursor();
|
||||
assert!(cursor.read(events).next().is_none());
|
||||
}
|
||||
@@ -317,7 +317,7 @@ mod tests {
|
||||
.press(KeyCode::KeyC);
|
||||
app.update();
|
||||
|
||||
let events = app.world().resource::<Events<NewGameRequestEvent>>();
|
||||
let events = app.world().resource::<Messages<NewGameRequestEvent>>();
|
||||
let mut cursor = events.get_cursor();
|
||||
let fired: Vec<_> = cursor.read(events).copied().collect();
|
||||
assert_eq!(fired.len(), 1);
|
||||
@@ -337,7 +337,7 @@ mod tests {
|
||||
.press(KeyCode::KeyC);
|
||||
app.update();
|
||||
|
||||
let events = app.world().resource::<Events<DailyGoalAnnouncementEvent>>();
|
||||
let events = app.world().resource::<Messages<DailyGoalAnnouncementEvent>>();
|
||||
let mut cursor = events.get_cursor();
|
||||
let fired: Vec<_> = cursor.read(events).cloned().collect();
|
||||
assert_eq!(fired.len(), 1);
|
||||
@@ -355,7 +355,7 @@ mod tests {
|
||||
.press(KeyCode::KeyC);
|
||||
app.update();
|
||||
|
||||
let events = app.world().resource::<Events<DailyGoalAnnouncementEvent>>();
|
||||
let events = app.world().resource::<Messages<DailyGoalAnnouncementEvent>>();
|
||||
let mut cursor = events.get_cursor();
|
||||
let fired: Vec<_> = cursor.read(events).cloned().collect();
|
||||
assert_eq!(fired.len(), 1);
|
||||
|
||||
@@ -238,10 +238,10 @@ fn spawn_confirm_dialog(commands: &mut Commands, original_request: NewGameReques
|
||||
row_gap: Val::Px(20.0),
|
||||
min_width: Val::Px(360.0),
|
||||
align_items: AlignItems::Center,
|
||||
border_radius: BorderRadius::all(Val::Px(12.0)),
|
||||
..default()
|
||||
},
|
||||
BackgroundColor(Color::srgb(0.10, 0.12, 0.15)),
|
||||
BorderRadius::all(Val::Px(12.0)),
|
||||
))
|
||||
.with_children(|card| {
|
||||
// Heading
|
||||
@@ -574,10 +574,10 @@ fn spawn_game_over_screen(commands: &mut Commands, score: i32) {
|
||||
row_gap: Val::Px(16.0),
|
||||
min_width: Val::Px(340.0),
|
||||
align_items: AlignItems::Center,
|
||||
border_radius: BorderRadius::all(Val::Px(12.0)),
|
||||
..default()
|
||||
},
|
||||
BackgroundColor(Color::srgb(0.10, 0.08, 0.08)),
|
||||
BorderRadius::all(Val::Px(12.0)),
|
||||
))
|
||||
.with_children(|card| {
|
||||
// Header — explains why the overlay appeared.
|
||||
@@ -765,7 +765,7 @@ mod tests {
|
||||
let mut app = test_app(42);
|
||||
app.world_mut().write_message(DrawRequestEvent);
|
||||
app.update();
|
||||
let events = app.world().resource::<Events<StateChangedEvent>>();
|
||||
let events = app.world().resource::<Messages<StateChangedEvent>>();
|
||||
let mut reader = events.get_cursor();
|
||||
assert!(reader.read(events).next().is_some());
|
||||
}
|
||||
@@ -864,7 +864,7 @@ mod tests {
|
||||
count: 1,
|
||||
});
|
||||
app.update();
|
||||
let events = app.world().resource::<Events<StateChangedEvent>>();
|
||||
let events = app.world().resource::<Messages<StateChangedEvent>>();
|
||||
let mut reader = events.get_cursor();
|
||||
assert!(reader.read(events).next().is_none());
|
||||
}
|
||||
@@ -956,7 +956,7 @@ mod tests {
|
||||
});
|
||||
app.update();
|
||||
|
||||
let events = app.world().resource::<Events<crate::events::CardFlippedEvent>>();
|
||||
let events = app.world().resource::<Messages<crate::events::CardFlippedEvent>>();
|
||||
let mut cursor = events.get_cursor();
|
||||
let fired: Vec<_> = cursor.read(events).collect();
|
||||
assert_eq!(fired.len(), 1, "CardFlippedEvent must fire when a face-down card is exposed");
|
||||
@@ -1042,7 +1042,7 @@ mod tests {
|
||||
});
|
||||
app.update();
|
||||
|
||||
let events = app.world().resource::<Events<crate::events::CardFlippedEvent>>();
|
||||
let events = app.world().resource::<Messages<crate::events::CardFlippedEvent>>();
|
||||
let mut cursor = events.get_cursor();
|
||||
let fired: Vec<_> = cursor.read(events).collect();
|
||||
assert!(fired.is_empty(), "no flip event when exposed card was already face-up");
|
||||
@@ -1309,7 +1309,7 @@ mod tests {
|
||||
);
|
||||
|
||||
// Clear the NewGameRequestEvent queue so we start with a clean slate.
|
||||
app.world_mut().resource_mut::<Events<NewGameRequestEvent>>().clear();
|
||||
app.world_mut().resource_mut::<Messages<NewGameRequestEvent>>().clear();
|
||||
|
||||
// Simulate Escape press.
|
||||
{
|
||||
@@ -1320,7 +1320,7 @@ mod tests {
|
||||
app.update();
|
||||
|
||||
// NewGameRequestEvent must have been fired.
|
||||
let events = app.world().resource::<Events<NewGameRequestEvent>>();
|
||||
let events = app.world().resource::<Messages<NewGameRequestEvent>>();
|
||||
let mut reader = events.get_cursor();
|
||||
assert!(
|
||||
reader.read(events).next().is_some(),
|
||||
@@ -1341,7 +1341,7 @@ mod tests {
|
||||
app.world_mut().write_message(UndoRequestEvent);
|
||||
app.update();
|
||||
|
||||
let events = app.world().resource::<Events<InfoToastEvent>>();
|
||||
let events = app.world().resource::<Messages<InfoToastEvent>>();
|
||||
let mut reader = events.get_cursor();
|
||||
let fired: Vec<_> = reader.read(events).collect();
|
||||
assert_eq!(fired.len(), 1, "exactly one InfoToastEvent must fire on empty-stack undo");
|
||||
@@ -1360,12 +1360,12 @@ mod tests {
|
||||
app.world_mut().write_message(DrawRequestEvent);
|
||||
app.update();
|
||||
// Clear events from the draw so we start with a clean slate.
|
||||
app.world_mut().resource_mut::<Events<InfoToastEvent>>().clear();
|
||||
app.world_mut().resource_mut::<Messages<InfoToastEvent>>().clear();
|
||||
|
||||
app.world_mut().write_message(UndoRequestEvent);
|
||||
app.update();
|
||||
|
||||
let events = app.world().resource::<Events<InfoToastEvent>>();
|
||||
let events = app.world().resource::<Messages<InfoToastEvent>>();
|
||||
let mut reader = events.get_cursor();
|
||||
let fired: Vec<_> = reader.read(events).collect();
|
||||
assert!(
|
||||
|
||||
@@ -88,7 +88,7 @@ const FORFEIT_CONFIRM_WINDOW: f32 = 3.0;
|
||||
/// Bundles all event writers used by `handle_keyboard` so the system stays
|
||||
/// within Bevy's 16-parameter limit.
|
||||
#[derive(SystemParam)]
|
||||
struct KeyboardEvents<'w> {
|
||||
struct KeyboardMessages<'w> {
|
||||
undo: MessageWriter<'w, UndoRequestEvent>,
|
||||
new_game: MessageWriter<'w, NewGameRequestEvent>,
|
||||
confirm_event: MessageWriter<'w, NewGameConfirmEvent>,
|
||||
@@ -108,7 +108,7 @@ fn handle_keyboard(
|
||||
mut confirm_countdown: Local<f32>,
|
||||
mut confirm_pending: Local<bool>,
|
||||
mut forfeit_countdown: Local<f32>,
|
||||
mut ev: KeyboardEvents,
|
||||
mut ev: KeyboardMessages<'_>,
|
||||
mut commands: Commands,
|
||||
card_entities: Query<(Entity, &CardEntity, &Sprite)>,
|
||||
layout: Option<Res<LayoutResource>>,
|
||||
|
||||
@@ -305,10 +305,10 @@ fn spawn_leaderboard_screen(commands: &mut Commands, entries: Option<&[Leaderboa
|
||||
min_width: Val::Px(420.0),
|
||||
max_height: Val::Percent(80.0),
|
||||
overflow: Overflow::clip_y(),
|
||||
border_radius: BorderRadius::all(Val::Px(8.0)),
|
||||
..default()
|
||||
},
|
||||
BackgroundColor(Color::srgb(0.09, 0.09, 0.12)),
|
||||
BorderRadius::all(Val::Px(8.0)),
|
||||
))
|
||||
.with_children(|card| {
|
||||
// Header
|
||||
@@ -347,10 +347,10 @@ fn spawn_leaderboard_screen(commands: &mut Commands, entries: Option<&[Leaderboa
|
||||
Node {
|
||||
padding: UiRect::axes(Val::Px(14.0), Val::Px(6.0)),
|
||||
justify_content: JustifyContent::Center,
|
||||
border_radius: BorderRadius::all(Val::Px(4.0)),
|
||||
..default()
|
||||
},
|
||||
BackgroundColor(Color::srgb(0.18, 0.35, 0.50)),
|
||||
BorderRadius::all(Val::Px(4.0)),
|
||||
))
|
||||
.with_children(|b| {
|
||||
b.spawn((
|
||||
@@ -366,10 +366,10 @@ fn spawn_leaderboard_screen(commands: &mut Commands, entries: Option<&[Leaderboa
|
||||
Node {
|
||||
padding: UiRect::axes(Val::Px(14.0), Val::Px(6.0)),
|
||||
justify_content: JustifyContent::Center,
|
||||
border_radius: BorderRadius::all(Val::Px(4.0)),
|
||||
..default()
|
||||
},
|
||||
BackgroundColor(Color::srgb(0.42, 0.15, 0.15)),
|
||||
BorderRadius::all(Val::Px(4.0)),
|
||||
))
|
||||
.with_children(|b| {
|
||||
b.spawn((
|
||||
|
||||
@@ -224,10 +224,10 @@ fn spawn_pause_screen(
|
||||
padding: UiRect::axes(Val::Px(14.0), Val::Px(6.0)),
|
||||
justify_content: JustifyContent::Center,
|
||||
align_items: AlignItems::Center,
|
||||
border_radius: BorderRadius::all(Val::Px(4.0)),
|
||||
..default()
|
||||
},
|
||||
BackgroundColor(Color::srgb(0.20, 0.30, 0.45)),
|
||||
BorderRadius::all(Val::Px(4.0)),
|
||||
))
|
||||
.with_children(|btn| {
|
||||
btn.spawn((
|
||||
@@ -496,7 +496,7 @@ mod tests {
|
||||
);
|
||||
|
||||
// Verify a SettingsChangedEvent was fired.
|
||||
let events = app.world().resource::<Events<SettingsChangedEvent>>();
|
||||
let events = app.world().resource::<Messages<SettingsChangedEvent>>();
|
||||
let mut cursor = events.get_cursor();
|
||||
let count = cursor.read(events).count();
|
||||
assert!(count >= 1, "SettingsChangedEvent must be fired on toggle");
|
||||
|
||||
@@ -187,7 +187,7 @@ mod tests {
|
||||
});
|
||||
app.update();
|
||||
|
||||
let events = app.world().resource::<Events<LevelUpEvent>>();
|
||||
let events = app.world().resource::<Messages<LevelUpEvent>>();
|
||||
let mut cursor = events.get_cursor();
|
||||
let fired: Vec<_> = cursor.read(events).copied().collect();
|
||||
assert_eq!(fired.len(), 1, "exactly one level-up");
|
||||
@@ -204,7 +204,7 @@ mod tests {
|
||||
});
|
||||
app.update();
|
||||
|
||||
let events = app.world().resource::<Events<LevelUpEvent>>();
|
||||
let events = app.world().resource::<Messages<LevelUpEvent>>();
|
||||
let mut cursor = events.get_cursor();
|
||||
assert!(cursor.read(events).next().is_none());
|
||||
}
|
||||
@@ -219,7 +219,7 @@ mod tests {
|
||||
});
|
||||
app.update();
|
||||
|
||||
let events = app.world().resource::<Events<XpAwardedEvent>>();
|
||||
let events = app.world().resource::<Messages<XpAwardedEvent>>();
|
||||
let mut cursor = events.get_cursor();
|
||||
let fired: Vec<_> = cursor.read(events).copied().collect();
|
||||
assert_eq!(fired.len(), 1);
|
||||
@@ -238,7 +238,7 @@ mod tests {
|
||||
app.update();
|
||||
|
||||
let total_xp = app.world().resource::<ProgressResource>().0.total_xp;
|
||||
let events = app.world().resource::<Events<LevelUpEvent>>();
|
||||
let events = app.world().resource::<Messages<LevelUpEvent>>();
|
||||
let mut cursor = events.get_cursor();
|
||||
let fired: Vec<_> = cursor.read(events).copied().collect();
|
||||
assert_eq!(fired.len(), 1);
|
||||
|
||||
@@ -603,10 +603,10 @@ fn spawn_settings_panel(
|
||||
min_width: Val::Px(340.0),
|
||||
max_height: Val::Percent(88.0),
|
||||
overflow: Overflow::scroll_y(),
|
||||
border_radius: BorderRadius::all(Val::Px(8.0)),
|
||||
..default()
|
||||
},
|
||||
BackgroundColor(Color::srgb(0.11, 0.11, 0.14)),
|
||||
BorderRadius::all(Val::Px(8.0)),
|
||||
))
|
||||
.with_children(|card| {
|
||||
// Title
|
||||
@@ -755,10 +755,10 @@ fn spawn_settings_panel(
|
||||
height: Val::Px(40.0),
|
||||
justify_content: JustifyContent::Center,
|
||||
align_items: AlignItems::Center,
|
||||
border_radius: BorderRadius::all(Val::Px(4.0)),
|
||||
..default()
|
||||
},
|
||||
BackgroundColor(bg_color),
|
||||
BorderRadius::all(Val::Px(4.0)),
|
||||
))
|
||||
.with_children(|b| {
|
||||
b.spawn((
|
||||
@@ -801,10 +801,10 @@ fn spawn_settings_panel(
|
||||
height: Val::Px(40.0),
|
||||
justify_content: JustifyContent::Center,
|
||||
align_items: AlignItems::Center,
|
||||
border_radius: BorderRadius::all(Val::Px(4.0)),
|
||||
..default()
|
||||
},
|
||||
BackgroundColor(bg_color),
|
||||
BorderRadius::all(Val::Px(4.0)),
|
||||
))
|
||||
.with_children(|b| {
|
||||
b.spawn((
|
||||
@@ -839,10 +839,10 @@ fn spawn_settings_panel(
|
||||
Node {
|
||||
padding: UiRect::axes(Val::Px(10.0), Val::Px(4.0)),
|
||||
justify_content: JustifyContent::Center,
|
||||
border_radius: BorderRadius::all(Val::Px(4.0)),
|
||||
..default()
|
||||
},
|
||||
BackgroundColor(Color::srgb(0.20, 0.30, 0.45)),
|
||||
BorderRadius::all(Val::Px(4.0)),
|
||||
))
|
||||
.with_children(|b| {
|
||||
b.spawn((
|
||||
@@ -861,10 +861,10 @@ fn spawn_settings_panel(
|
||||
padding: UiRect::axes(Val::Px(20.0), Val::Px(8.0)),
|
||||
justify_content: JustifyContent::Center,
|
||||
margin: UiRect::top(Val::Px(6.0)),
|
||||
border_radius: BorderRadius::all(Val::Px(4.0)),
|
||||
..default()
|
||||
},
|
||||
BackgroundColor(Color::srgb(0.22, 0.45, 0.22)),
|
||||
BorderRadius::all(Val::Px(4.0)),
|
||||
))
|
||||
.with_children(|b| {
|
||||
b.spawn((
|
||||
@@ -934,10 +934,10 @@ fn icon_button(parent: &mut ChildSpawnerCommands, label: &str, action: SettingsB
|
||||
height: Val::Px(28.0),
|
||||
justify_content: JustifyContent::Center,
|
||||
align_items: AlignItems::Center,
|
||||
border_radius: BorderRadius::all(Val::Px(4.0)),
|
||||
..default()
|
||||
},
|
||||
BackgroundColor(Color::srgb(0.25, 0.25, 0.30)),
|
||||
BorderRadius::all(Val::Px(4.0)),
|
||||
))
|
||||
.with_children(|b| {
|
||||
b.spawn((
|
||||
@@ -995,7 +995,7 @@ mod tests {
|
||||
let after = app.world().resource::<SettingsResource>().0.sfx_volume;
|
||||
assert!(after < before);
|
||||
|
||||
let events = app.world().resource::<Events<SettingsChangedEvent>>();
|
||||
let events = app.world().resource::<Messages<SettingsChangedEvent>>();
|
||||
let mut cursor = events.get_cursor();
|
||||
assert_eq!(cursor.read(events).count(), 1);
|
||||
}
|
||||
@@ -1020,7 +1020,7 @@ mod tests {
|
||||
press(&mut app, KeyCode::BracketRight);
|
||||
app.update();
|
||||
|
||||
let events = app.world().resource::<Events<SettingsChangedEvent>>();
|
||||
let events = app.world().resource::<Messages<SettingsChangedEvent>>();
|
||||
let mut cursor = events.get_cursor();
|
||||
assert_eq!(cursor.read(events).count(), 0);
|
||||
}
|
||||
@@ -1036,7 +1036,7 @@ mod tests {
|
||||
let after = app.world().resource::<SettingsResource>().0.sfx_volume;
|
||||
assert!(after >= 0.0, "volume must not go below zero");
|
||||
|
||||
let events = app.world().resource::<Events<SettingsChangedEvent>>();
|
||||
let events = app.world().resource::<Messages<SettingsChangedEvent>>();
|
||||
let mut cursor = events.get_cursor();
|
||||
assert_eq!(cursor.read(events).count(), 0, "no event when clamped at floor");
|
||||
}
|
||||
|
||||
@@ -784,7 +784,7 @@ mod tests {
|
||||
app.world_mut().write_message(ForfeitEvent);
|
||||
app.update();
|
||||
|
||||
let events = app.world().resource::<Events<InfoToastEvent>>();
|
||||
let events = app.world().resource::<Messages<InfoToastEvent>>();
|
||||
let mut reader = events.get_cursor();
|
||||
let messages: Vec<&str> = reader
|
||||
.read(events)
|
||||
@@ -813,7 +813,7 @@ mod tests {
|
||||
app.world_mut().write_message(ForfeitEvent);
|
||||
app.update();
|
||||
|
||||
let events = app.world().resource::<Events<InfoToastEvent>>();
|
||||
let events = app.world().resource::<Messages<InfoToastEvent>>();
|
||||
let mut reader = events.get_cursor();
|
||||
let messages: Vec<&str> = reader
|
||||
.read(events)
|
||||
|
||||
@@ -151,7 +151,7 @@ mod tests {
|
||||
let session = app.world().resource::<TimeAttackResource>();
|
||||
assert!(!session.active);
|
||||
|
||||
let events = app.world().resource::<Events<NewGameRequestEvent>>();
|
||||
let events = app.world().resource::<Messages<NewGameRequestEvent>>();
|
||||
let mut cursor = events.get_cursor();
|
||||
assert!(cursor.read(events).next().is_none());
|
||||
}
|
||||
@@ -169,7 +169,7 @@ mod tests {
|
||||
assert_eq!(session.wins, 0);
|
||||
assert!((session.remaining_secs - TIME_ATTACK_DURATION_SECS).abs() < 1.0);
|
||||
|
||||
let events = app.world().resource::<Events<NewGameRequestEvent>>();
|
||||
let events = app.world().resource::<Messages<NewGameRequestEvent>>();
|
||||
let mut cursor = events.get_cursor();
|
||||
let fired: Vec<_> = cursor.read(events).copied().collect();
|
||||
assert_eq!(fired.len(), 1);
|
||||
@@ -193,7 +193,7 @@ mod tests {
|
||||
assert!(!session.active);
|
||||
assert_eq!(session.remaining_secs, 0.0);
|
||||
|
||||
let events = app.world().resource::<Events<TimeAttackEndedEvent>>();
|
||||
let events = app.world().resource::<Messages<TimeAttackEndedEvent>>();
|
||||
let mut cursor = events.get_cursor();
|
||||
let fired: Vec<_> = cursor.read(events).copied().collect();
|
||||
assert_eq!(fired.len(), 1);
|
||||
@@ -222,7 +222,7 @@ mod tests {
|
||||
let session = app.world().resource::<TimeAttackResource>();
|
||||
assert_eq!(session.wins, 1);
|
||||
|
||||
let events = app.world().resource::<Events<NewGameRequestEvent>>();
|
||||
let events = app.world().resource::<Messages<NewGameRequestEvent>>();
|
||||
let mut cursor = events.get_cursor();
|
||||
let fired: Vec<_> = cursor.read(events).copied().collect();
|
||||
assert_eq!(fired.len(), 1);
|
||||
@@ -286,7 +286,7 @@ mod tests {
|
||||
assert!(session.remaining_secs < 0.0, "remaining_secs must not change while paused");
|
||||
|
||||
// No ended event must have been emitted.
|
||||
let events = app.world().resource::<Events<TimeAttackEndedEvent>>();
|
||||
let events = app.world().resource::<Messages<TimeAttackEndedEvent>>();
|
||||
let mut cursor = events.get_cursor();
|
||||
assert!(
|
||||
cursor.read(events).next().is_none(),
|
||||
|
||||
@@ -228,7 +228,7 @@ mod tests {
|
||||
let base_win_xp = solitaire_data::xp_for_win(60, false);
|
||||
assert_eq!(p.total_xp - xp_before, base_win_xp + WEEKLY_GOAL_XP);
|
||||
|
||||
let events = app.world().resource::<Events<WeeklyGoalCompletedEvent>>();
|
||||
let events = app.world().resource::<Messages<WeeklyGoalCompletedEvent>>();
|
||||
let mut cursor = events.get_cursor();
|
||||
let fired: Vec<_> = cursor.read(events).cloned().collect();
|
||||
assert!(fired.iter().any(|e| e.goal_id == "weekly_3_fast"));
|
||||
@@ -286,7 +286,7 @@ mod tests {
|
||||
});
|
||||
app.update();
|
||||
|
||||
let events = app.world().resource::<Events<LevelUpEvent>>();
|
||||
let events = app.world().resource::<Messages<LevelUpEvent>>();
|
||||
let mut cursor = events.get_cursor();
|
||||
let fired: Vec<_> = cursor.read(events).copied().collect();
|
||||
assert!(!fired.is_empty(), "LevelUpEvent must fire when weekly bonus pushes past a level threshold");
|
||||
|
||||
@@ -442,10 +442,10 @@ fn spawn_overlay(
|
||||
row_gap: Val::Px(18.0),
|
||||
min_width: Val::Px(320.0),
|
||||
align_items: AlignItems::Center,
|
||||
border_radius: BorderRadius::all(Val::Px(12.0)),
|
||||
..default()
|
||||
},
|
||||
BackgroundColor(Color::srgb(0.10, 0.12, 0.10)),
|
||||
BorderRadius::all(Val::Px(12.0)),
|
||||
))
|
||||
.with_children(|card| {
|
||||
// Heading
|
||||
@@ -518,10 +518,10 @@ fn spawn_overlay(
|
||||
padding: UiRect::axes(Val::Px(28.0), Val::Px(12.0)),
|
||||
justify_content: JustifyContent::Center,
|
||||
margin: UiRect::top(Val::Px(8.0)),
|
||||
border_radius: BorderRadius::all(Val::Px(6.0)),
|
||||
..default()
|
||||
},
|
||||
BackgroundColor(Color::srgb(0.22, 0.45, 0.22)),
|
||||
BorderRadius::all(Val::Px(6.0)),
|
||||
))
|
||||
.with_children(|b| {
|
||||
b.spawn((
|
||||
|
||||
Reference in New Issue
Block a user