Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fae5933d29 | |||
| 6cd8c6c013 |
@@ -1147,7 +1147,7 @@ fn add_android_corner_label(
|
||||
let bg_w = font_size * 2.0;
|
||||
let bg_h = font_size * 1.25;
|
||||
|
||||
// Background covers the PNG's baked-in small corner text.
|
||||
// Background covers the PNG's baked-in small corner text (top-left).
|
||||
// Classic PNG cards have a white face, so the background must be white too.
|
||||
// (CARD_FACE_COLOUR is the Terminal theme's dark face colour — wrong here.)
|
||||
parent.spawn((
|
||||
@@ -1163,6 +1163,20 @@ fn add_android_corner_label(
|
||||
0.015,
|
||||
),
|
||||
));
|
||||
// Cover the matching rotated baked-in text at the bottom-right corner.
|
||||
parent.spawn((
|
||||
AndroidCornerBg,
|
||||
Sprite {
|
||||
color: Color::WHITE,
|
||||
custom_size: Some(Vec2::new(bg_w, bg_h)),
|
||||
..default()
|
||||
},
|
||||
Transform::from_xyz(
|
||||
card_size.x / 2.0 - inset - bg_w / 2.0,
|
||||
-card_size.y / 2.0 + inset + bg_h / 2.0,
|
||||
0.015,
|
||||
),
|
||||
));
|
||||
|
||||
// Large rank+suit text drawn on top of the background. FiraMono must be
|
||||
// wired here explicitly — the suit glyphs (U+2660–U+2666) are not in
|
||||
|
||||
@@ -202,6 +202,8 @@ impl Plugin for GamePlugin {
|
||||
.add_message::<FoundationCompletedEvent>()
|
||||
.add_message::<InfoToastEvent>()
|
||||
.add_message::<AppLifecycle>()
|
||||
// add_message is idempotent; SettingsPlugin also registers this.
|
||||
.add_message::<crate::settings_plugin::SettingsChangedEvent>()
|
||||
.add_systems(
|
||||
Update,
|
||||
poll_pending_new_game_seed.before(GameMutation),
|
||||
@@ -228,6 +230,7 @@ impl Plugin for GamePlugin {
|
||||
// GameMutation flow.
|
||||
.add_systems(Update, spawn_restore_prompt_if_pending)
|
||||
.add_systems(Update, handle_restore_prompt.before(GameMutation))
|
||||
.add_systems(Update, sync_settings_to_game.before(GameMutation))
|
||||
.init_resource::<AutoSaveTimer>()
|
||||
.add_systems(Update, tick_elapsed_time)
|
||||
.add_systems(Update, auto_save_game_state)
|
||||
@@ -235,6 +238,23 @@ impl Plugin for GamePlugin {
|
||||
}
|
||||
}
|
||||
|
||||
/// Forwards `take_from_foundation` from [`SettingsResource`] to the live
|
||||
/// [`GameStateResource`] every time [`SettingsChangedEvent`] fires.
|
||||
///
|
||||
/// This covers two cases that the new-game path misses:
|
||||
/// 1. The initial settings load at startup: saves on disk default to `false`
|
||||
/// but `Settings` defaults to `true`; the event fires once when the
|
||||
/// settings file is first read.
|
||||
/// 2. A user toggling the setting mid-session in the Settings panel.
|
||||
fn sync_settings_to_game(
|
||||
mut events: MessageReader<crate::settings_plugin::SettingsChangedEvent>,
|
||||
mut game: ResMut<GameStateResource>,
|
||||
) {
|
||||
for ev in events.read() {
|
||||
game.0.take_from_foundation = ev.0.take_from_foundation;
|
||||
}
|
||||
}
|
||||
|
||||
/// Pure, testable helper. Updates `elapsed_seconds` and drains the
|
||||
/// fractional accumulator into whole-second ticks. No-op when `is_won`.
|
||||
pub fn advance_elapsed(
|
||||
@@ -614,6 +634,7 @@ fn handle_restore_prompt(
|
||||
new_game_buttons: Query<&Interaction, (With<RestoreNewGameButton>, Changed<Interaction>)>,
|
||||
mut pending: ResMut<PendingRestoredGame>,
|
||||
mut game: ResMut<GameStateResource>,
|
||||
settings: Option<Res<crate::settings_plugin::SettingsResource>>,
|
||||
mut changed: MessageWriter<StateChangedEvent>,
|
||||
mut new_game: MessageWriter<NewGameRequestEvent>,
|
||||
mut launch_home_shown: Option<ResMut<crate::home_plugin::LaunchHomeShown>>,
|
||||
@@ -639,6 +660,10 @@ fn handle_restore_prompt(
|
||||
let resolved = if key_continue || click_continue {
|
||||
if let Some(restored) = pending.0.take() {
|
||||
game.0 = restored;
|
||||
// Patch setting that serialized with the old core default of `false`.
|
||||
if let Some(s) = settings.as_ref() {
|
||||
game.0.take_from_foundation = s.0.take_from_foundation;
|
||||
}
|
||||
changed.write(StateChangedEvent);
|
||||
}
|
||||
for entity in &screens {
|
||||
|
||||
@@ -989,7 +989,7 @@ fn spawn_action_button<M: Component>(
|
||||
// centred with room to breathe. On desktop, keep the comfortable 48 dp
|
||||
// floor and 8 dp side padding.
|
||||
#[cfg(target_os = "android")]
|
||||
let (pad, min_w, min_h) = (UiRect::axes(Val::Px(4.0), Val::Px(4.0)), Val::Px(44.0), Val::Px(44.0));
|
||||
let (pad, min_w, min_h) = (UiRect::axes(Val::Px(4.0), Val::Px(4.0)), Val::Px(52.0), Val::Px(44.0));
|
||||
#[cfg(not(target_os = "android"))]
|
||||
let (pad, min_w, min_h) = (UiRect::axes(VAL_SPACE_2, VAL_SPACE_2), Val::Px(48.0), Val::Px(48.0));
|
||||
|
||||
|
||||
@@ -117,6 +117,7 @@ pub const HUD_BAND_HEIGHT: f32 = 112.0;
|
||||
///
|
||||
/// Derivation (Android): `min_height 44 px` buttons
|
||||
/// + `padding.top 8 px` + `padding.bottom 8 px` outer bar padding = **60 px**.
|
||||
///
|
||||
/// Desktop: no persistent bottom bar, so 0.
|
||||
#[cfg(not(target_os = "android"))]
|
||||
const BOTTOM_BAR_HEIGHT: f32 = 0.0;
|
||||
|
||||
@@ -473,8 +473,11 @@ fn radial_open_on_long_press(
|
||||
mut state: ResMut<RightClickRadialState>,
|
||||
) {
|
||||
// Guard: only count while a touch is down, uncommitted, and radial is idle.
|
||||
let active_id = drag.active_touch_id;
|
||||
if active_id.is_none() || drag.committed || state.is_active() || paused.is_some_and(|p| p.0) {
|
||||
let Some(active_id) = drag.active_touch_id else {
|
||||
*hold_timer = 0.0;
|
||||
return;
|
||||
};
|
||||
if drag.committed || state.is_active() || paused.is_some_and(|p| p.0) {
|
||||
*hold_timer = 0.0;
|
||||
return;
|
||||
}
|
||||
@@ -487,7 +490,7 @@ fn radial_open_on_long_press(
|
||||
|
||||
// Resolve current touch world position.
|
||||
let Some(touches) = touches else { return };
|
||||
let Some(touch) = touches.iter().find(|t| t.id() == active_id.unwrap()) else {
|
||||
let Some(touch) = touches.iter().find(|t| t.id() == active_id) else {
|
||||
return;
|
||||
};
|
||||
let Some((camera, cam_xf)) = cameras.single().ok() else { return };
|
||||
|
||||
Reference in New Issue
Block a user