fix(engine): prevent stock-tap from toggling HUD on Android

Every draw-from-stock tap was also firing the HUD auto-hide toggle
because the stock pile is not an ActionButton and toggle_hud_on_tap
had no way to know the tap was consumed by game logic.

Add GameInputConsumedResource(bool): handle_touch_stock_tap sets it
on TouchPhase::Started when a draw fires; toggle_hud_on_tap checks
and clears it on TouchPhase::Ended, treating it as equivalent to
started_on_button so the HUD stays put.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
funman300
2026-05-18 17:09:54 -07:00
parent 39cf8dcd6c
commit 3650788dc5
3 changed files with 22 additions and 3 deletions
+4 -1
View File
@@ -47,7 +47,7 @@ use crate::game_plugin::{ConfirmNewGameScreen, GameMutation, RestorePromptScreen
use crate::pause_plugin::PausedResource;
use crate::progress_plugin::ProgressResource;
use crate::layout::{Layout, LayoutResource};
use crate::resources::{DragState, GameStateResource, HintCycleIndex};
use crate::resources::{DragState, GameInputConsumedResource, GameStateResource, HintCycleIndex};
use crate::selection_plugin::SelectionState;
use crate::time_attack_plugin::TimeAttackResource;
@@ -95,6 +95,7 @@ impl Plugin for InputPlugin {
app.init_resource::<HintCycleIndex>()
.init_resource::<HintSolverConfig>()
.init_resource::<crate::pending_hint::PendingHintTask>()
.init_resource::<GameInputConsumedResource>()
.add_message::<StartZenRequestEvent>()
.add_message::<InfoToastEvent>()
.add_message::<ForfeitRequestEvent>()
@@ -501,6 +502,7 @@ fn handle_touch_stock_tap(
layout: Option<Res<LayoutResource>>,
drag: Res<DragState>,
mut draw: MessageWriter<DrawRequestEvent>,
mut game_consumed: ResMut<GameInputConsumedResource>,
) {
if paused.is_some_and(|p| p.0) {
return;
@@ -522,6 +524,7 @@ fn handle_touch_stock_tap(
};
if point_in_rect(world, stock_pos, layout.0.card_size) {
draw.write(DrawRequestEvent);
game_consumed.0 = true;
break; // one draw per tap frame
}
}