From 63c5c4cf666ea1f3ff7c85b07a3873ede5af0a82 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 25 Mar 2026 20:55:40 +0100 Subject: [PATCH 1/2] feat(training): implement Meyer's Square visual workflow - Add `MeyerSequence`, `MeyerNode`, and `TechniqueType` structs to `src/resources.rs`. - Define the 4 concentric 4-strike sequences based on historical data in `src/constants.rs`. - Introduce `TrainingWorkflow` enum to toggle between `Circular` and `MeyerSquare` modes. - Implement UI toggle in `src/ui/settings.rs` and `workflow_toggle_system` in `src/ui/systems.rs`. - Refactor target rendering to hide circular targets when Meyer's Square mode is active. - Render the Meyer's Square geometric grid and "Ghost of Meyer" visual signatures (Cut, Thrust, Parry) using Bevy gizmos in `src/ui/systems.rs`. - Implement sequence logic to cycle through nodes and sequences based on rhythm duration in `src/logic.rs`. - Add unit tests for Meyer sequence logic in `src/logic_test.rs`. Co-authored-by: dynamikdev <717692+dynamikdev@users.noreply.github.com> --- src/components.rs | 6 ++ src/constants.rs | 43 ++++++++++++ src/logic.rs | 36 +++++++++- src/logic_test.rs | 47 ++++++++++++++ src/main.rs | 2 + src/resources.rs | 54 +++++++++++++++ src/ui/mod.rs | 2 + src/ui/settings.rs | 32 +++++++++ src/ui/systems.rs | 159 +++++++++++++++++++++++++++++++++++++++++++-- 9 files changed, 375 insertions(+), 6 deletions(-) diff --git a/src/components.rs b/src/components.rs index bb05394..6a37e6d 100644 --- a/src/components.rs +++ b/src/components.rs @@ -68,3 +68,9 @@ pub struct CurriculumPageText; /// Marker for the curriculum document image display node. #[derive(Component)] pub struct CurriculumDocumentImage; + +/// Marker for the UI button that switches the training workflow. +/// +/// Used to identify the button that toggles between Circular and Meyer's Square workflows. +#[derive(Component)] +pub struct WorkflowModeButton; diff --git a/src/constants.rs b/src/constants.rs index 059a806..1205504 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -24,6 +24,49 @@ pub const CIRCLE_RADIUS: f32 = 300.0; /// standard HEMA target diagrams (e.g., Meyer's Square). pub const LABELS: [u8; 8] = [7, 1, 5, 3, 8, 4, 6, 2]; +/// The four concentric sequences of Meyer's Square. +/// +/// Organized from outer to inner, with each sequence containing a 4-strike order. +/// Coordinates are normalized from -1.0 to 1.0, with (0,0) at the center. +pub const MEYER_SEQUENCES: [crate::resources::MeyerSequence; 4] = [ + // Outer Sequence + crate::resources::MeyerSequence { + nodes: [ + crate::resources::MeyerNode { x: -1.0, y: 1.0, technique: crate::resources::TechniqueType::Cut }, + crate::resources::MeyerNode { x: 1.0, y: -1.0, technique: crate::resources::TechniqueType::Cut }, + crate::resources::MeyerNode { x: -1.0, y: -1.0, technique: crate::resources::TechniqueType::Cut }, + crate::resources::MeyerNode { x: 1.0, y: 1.0, technique: crate::resources::TechniqueType::Cut }, + ], + }, + // Outer-Mid Sequence + crate::resources::MeyerSequence { + nodes: [ + crate::resources::MeyerNode { x: -0.66, y: 0.66, technique: crate::resources::TechniqueType::Thrust }, + crate::resources::MeyerNode { x: 0.66, y: -0.66, technique: crate::resources::TechniqueType::Thrust }, + crate::resources::MeyerNode { x: -0.66, y: -0.66, technique: crate::resources::TechniqueType::Thrust }, + crate::resources::MeyerNode { x: 0.66, y: 0.66, technique: crate::resources::TechniqueType::Thrust }, + ], + }, + // Inner-Mid Sequence + crate::resources::MeyerSequence { + nodes: [ + crate::resources::MeyerNode { x: -0.33, y: 0.33, technique: crate::resources::TechniqueType::Parry }, + crate::resources::MeyerNode { x: 0.33, y: -0.33, technique: crate::resources::TechniqueType::Parry }, + crate::resources::MeyerNode { x: -0.33, y: -0.33, technique: crate::resources::TechniqueType::Parry }, + crate::resources::MeyerNode { x: 0.33, y: 0.33, technique: crate::resources::TechniqueType::Parry }, + ], + }, + // Inner Sequence + crate::resources::MeyerSequence { + nodes: [ + crate::resources::MeyerNode { x: -0.1, y: 0.1, technique: crate::resources::TechniqueType::Cut }, + crate::resources::MeyerNode { x: 0.1, y: -0.1, technique: crate::resources::TechniqueType::Cut }, + crate::resources::MeyerNode { x: -0.1, y: -0.1, technique: crate::resources::TechniqueType::Cut }, + crate::resources::MeyerNode { x: 0.1, y: 0.1, technique: crate::resources::TechniqueType::Cut }, + ], + }, +]; + // --- Kinetic Brutalism Color Palette --- /// Background: The primary void. diff --git a/src/logic.rs b/src/logic.rs index 6bc519f..0b15b07 100644 --- a/src/logic.rs +++ b/src/logic.rs @@ -20,6 +20,7 @@ impl Plugin for TrainingPlugin { fn build(&self, app: &mut App) { app.add_systems(Update, ( update_sequence_logic, + update_meyer_sequence_logic, handle_session_controls, sync_rhythm_timer, sync_arrow_target, @@ -56,8 +57,9 @@ fn update_sequence_logic( mut current_number: ResMut, mut sequence_state: ResMut, mut rhythm_state: ResMut, + active_workflow: Res, ) { - if !sequence_state.running { + if !sequence_state.running || active_workflow.0 != TrainingWorkflow::Circular { return; } @@ -109,6 +111,38 @@ fn update_sequence_logic( } } +/// System to update the Meyer's Square training sequence logic. +/// +/// Cycles through the 16 nodes in their defined sequences. +fn update_meyer_sequence_logic( + time: Res