refactor(core): card_game redundancy cleanup + derive scoring from upstream stats #88

Merged
funman300 merged 16 commits from refactor/strip-card_game-redundancies into master 2026-06-22 18:44:38 +00:00
Showing only changes of commit e3b8a403ef - Show all commits
+13 -12
View File
@@ -36,7 +36,6 @@ use crate::game_plugin::GameMutation;
use crate::input_plugin::TouchDragSet; use crate::input_plugin::TouchDragSet;
use crate::layout::HUD_BAND_HEIGHT; use crate::layout::HUD_BAND_HEIGHT;
use crate::layout::LayoutSystem; use crate::layout::LayoutSystem;
#[cfg(target_os = "android")]
use crate::pause_plugin::PausedResource; use crate::pause_plugin::PausedResource;
use crate::platform::{SHOW_KEYBOARD_ACCELERATORS, USE_TOUCH_UI_LAYOUT}; use crate::platform::{SHOW_KEYBOARD_ACCELERATORS, USE_TOUCH_UI_LAYOUT};
use crate::progress_plugin::ProgressResource; use crate::progress_plugin::ProgressResource;
@@ -174,7 +173,7 @@ pub enum HudVisibility {
#[cfg(target_os = "android")] #[cfg(target_os = "android")]
#[derive(Resource, Debug, Default)] #[derive(Resource, Debug, Default)]
struct HudTapTracker { struct HudTapTracker {
start_pos: Option<bevy::math::Vec2>, start_pos: Option<Vec2>,
/// Set `true` when the finger-down hit an action button so the /// Set `true` when the finger-down hit an action button so the
/// finger-up never toggles bar visibility. /// finger-up never toggles bar visibility.
started_on_button: bool, started_on_button: bool,
@@ -529,7 +528,7 @@ impl Plugin for HudPlugin {
#[cfg(target_os = "android")] #[cfg(target_os = "android")]
{ {
app.init_resource::<HudTapTracker>() app.init_resource::<HudTapTracker>()
.add_message::<bevy::input::touch::TouchInput>() .add_message::<TouchInput>()
.add_systems( .add_systems(
Update, Update,
toggle_hud_on_tap toggle_hud_on_tap
@@ -1140,7 +1139,7 @@ fn handle_help_button(
fn handle_hint_button( fn handle_hint_button(
interaction_query: Query<&Interaction, (With<HintButton>, Changed<Interaction>)>, interaction_query: Query<&Interaction, (With<HintButton>, Changed<Interaction>)>,
paused: Option<Res<crate::PausedResource>>, paused: Option<Res<PausedResource>>,
game: Option<Res<GameStateResource>>, game: Option<Res<GameStateResource>>,
solver_config: Option<Res<crate::input_plugin::HintSolverConfig>>, solver_config: Option<Res<crate::input_plugin::HintSolverConfig>>,
mut pending_hint: Option<ResMut<crate::pending_hint::PendingHintTask>>, mut pending_hint: Option<ResMut<crate::pending_hint::PendingHintTask>>,
@@ -2658,8 +2657,9 @@ fn resize_action_bar_labels(
} }
#[cfg(target_os = "android")] #[cfg(target_os = "android")]
#[allow(clippy::too_many_arguments)]
fn toggle_hud_on_tap( fn toggle_hud_on_tap(
mut touch_events: MessageReader<bevy::input::touch::TouchInput>, mut touch_events: MessageReader<TouchInput>,
drag: Res<DragState>, drag: Res<DragState>,
scrims: Query<(), With<ModalScrim>>, scrims: Query<(), With<ModalScrim>>,
paused: Option<Res<PausedResource>>, paused: Option<Res<PausedResource>>,
@@ -2697,13 +2697,14 @@ fn toggle_hud_on_tap(
// regardless of whether we toggle. // regardless of whether we toggle.
let on_button = tracker.started_on_button || game_consumed.0; let on_button = tracker.started_on_button || game_consumed.0;
game_consumed.0 = false; game_consumed.0 = false;
if let Some(start) = tracker.start_pos.take() { if let Some(start) = tracker.start_pos.take()
if !on_button && (event.position - start).length() < HUD_TAP_SLOP_PX { && !on_button
*hud_vis = match *hud_vis { && (event.position - start).length() < HUD_TAP_SLOP_PX
HudVisibility::Visible => HudVisibility::Hidden, {
HudVisibility::Hidden => HudVisibility::Visible, *hud_vis = match *hud_vis {
}; HudVisibility::Visible => HudVisibility::Hidden,
} HudVisibility::Hidden => HudVisibility::Visible,
};
} }
tracker.started_on_button = false; tracker.started_on_button = false;
} }