1- use crate :: game:: dialog:: { Opened , ShowCongrats , ShowSettings } ;
2- use crate :: loading:: AudioAssets ;
31use crate :: {
2+ GameState ,
43 color:: * ,
54 game:: {
6- board:: ConflictContainer ,
7- board:: { play_board, PreviewCandidate } ,
5+ board:: { ConflictContainer , PreviewCandidate , play_board} ,
86 cell_state:: {
97 AutoCandidates , CandidatesValue , CellMode , CellValueBundle , ConflictCell ,
108 CorrectionCell , DigitValueCell , FixedCell , ManualCandidates , RevealedCell ,
119 SelectedCell ,
1210 } ,
1311 control_tab:: control_board,
14- dialog:: { dialog_container , PauseGame , ShowHint } ,
12+ dialog:: { Opened , PauseGame , ShowCongrats , ShowHint , ShowSettings , dialog_container } ,
1513 input:: { keyboard_input, keyboard_move_cell} ,
1614 position:: CellPosition ,
1715 } ,
18- loading:: { FontAssets , TextureAssets } ,
16+ loading:: { AudioAssets , FontAssets , TextureAssets } ,
1917 share:: title_bar,
20- GameState ,
2118} ;
22- use bevy:: { prelude :: * , time :: Stopwatch , utils :: HashSet } ;
19+ use bevy:: { platform :: collections :: HashSet , prelude :: * , time :: Stopwatch } ;
2320use bevy_kira_audio:: { Audio , AudioControl } ;
2421use sudoku:: {
22+ Sudoku ,
2523 bitset:: Set ,
2624 board:: { CellState , Digit } ,
2725 strategy:: StrategySolver ,
28- Sudoku ,
2926} ;
3027
3128mod board;
@@ -171,7 +168,7 @@ fn setup_ui(
171168fn toolbars (
172169 font_assets : & Res < FontAssets > ,
173170 texture_assets : & Res < TextureAssets > ,
174- builder : & mut ChildBuilder ,
171+ builder : & mut ChildSpawnerCommands < ' _ > ,
175172) {
176173 builder
177174 . spawn ( (
@@ -213,7 +210,7 @@ fn toolbars(
213210fn right_bar (
214211 _font_assets : & Res < FontAssets > ,
215212 texture_assets : & Res < TextureAssets > ,
216- builder : & mut ChildBuilder ,
213+ builder : & mut ChildSpawnerCommands < ' _ > ,
217214) {
218215 builder
219216 . spawn ( (
@@ -306,7 +303,7 @@ fn right_bar(
306303fn center_bar (
307304 font_assets : & Res < FontAssets > ,
308305 texture_assets : & Res < TextureAssets > ,
309- builder : & mut ChildBuilder ,
306+ builder : & mut ChildSpawnerCommands < ' _ > ,
310307) {
311308 builder
312309 . spawn ( (
@@ -373,7 +370,7 @@ struct PauseButton;
373370fn left_bar (
374371 font_assets : & Res < FontAssets > ,
375372 texture_assets : & Res < TextureAssets > ,
376- builder : & mut ChildBuilder ,
373+ builder : & mut ChildSpawnerCommands < ' _ > ,
377374) {
378375 builder
379376 . spawn ( (
@@ -517,7 +514,7 @@ fn init_puzzle(
517514}
518515
519516fn on_select_cell ( trigger : Trigger < OnInsert , SelectedCell > , mut cell : Query < & mut BackgroundColor > ) {
520- let entity = trigger. entity ( ) ;
517+ let entity = trigger. target ( ) ;
521518 if let Ok ( mut background) = cell. get_mut ( entity) {
522519 background. 0 = * STRANDS_YELLOW ;
523520 }
@@ -527,7 +524,7 @@ fn on_unselect_cell(
527524 trigger : Trigger < OnRemove , SelectedCell > ,
528525 mut cell : Query < ( & mut BackgroundColor , Option < & FixedCell > ) > ,
529526) {
530- let entity = trigger. entity ( ) ;
527+ let entity = trigger. target ( ) ;
531528 if let Ok ( ( mut background, opt_fixed) ) = cell. get_mut ( entity) {
532529 if opt_fixed. is_some ( ) {
533530 background. 0 = * EXTRA_LIGHT_GRAY ;
@@ -546,7 +543,7 @@ fn on_new_digit(
546543 mut commands : Commands ,
547544 settings : Res < Settings > ,
548545) {
549- let entity = trigger. entity ( ) ;
546+ let entity = trigger. target ( ) ;
550547 let new_digit = trigger. event ( ) . 0 ;
551548 if let Ok ( ( mut cell_value, mut cell_mode) ) = q_cell. get_mut ( entity) {
552549 * cell_mode = CellMode :: Digit ;
@@ -633,7 +630,7 @@ fn on_clean_cell(
633630 mut commands : Commands ,
634631) {
635632 if let Ok ( ( entity, mut digit_value, mut manual_candidates, mut cell_mode) ) =
636- q_cell. get_mut ( trigger. entity ( ) )
633+ q_cell. get_mut ( trigger. target ( ) )
637634 {
638635 match * cell_mode {
639636 CellMode :: Digit => {
@@ -774,7 +771,7 @@ fn check_conflict(
774771 ) > ,
775772 mut commands : Commands ,
776773) {
777- if let Ok ( ( check_entity, digit_cell, cell_position) ) = update_cell. get_single ( ) {
774+ if let Ok ( ( check_entity, digit_cell, cell_position) ) = update_cell. single ( ) {
778775 if let Some ( check_digit) = digit_cell. 0 {
779776 debug ! ( "check conflict: {:?}" , check_digit) ;
780777 let mut conflict_list = vec ! [ ] ;
@@ -824,7 +821,7 @@ fn show_conflict(
824821 commands. entity ( entity) . remove :: < ConflictCell > ( ) ;
825822 } else {
826823 for child in children. iter ( ) {
827- if let Ok ( mut text) = q_text. get_mut ( * child) {
824+ if let Ok ( mut text) = q_text. get_mut ( child) {
828825 text. 0 = conflict. len ( ) . to_string ( ) ;
829826 }
830827 }
@@ -862,7 +859,7 @@ pub struct AutoCandidateMode(pub bool);
862859
863860fn cleanup_game ( mut commands : Commands , menu : Query < Entity , With < Game > > ) {
864861 for entity in menu. iter ( ) {
865- commands. entity ( entity) . despawn_recursive ( ) ;
862+ commands. entity ( entity) . despawn ( ) ;
866863 }
867864}
868865
@@ -905,7 +902,11 @@ fn update_game_time(
905902 }
906903}
907904
908- fn spawn_show_more ( font_assets : & Res < FontAssets > , builder : & mut ChildBuilder , is_solved : bool ) {
905+ fn spawn_show_more (
906+ font_assets : & Res < FontAssets > ,
907+ builder : & mut ChildSpawnerCommands < ' _ > ,
908+ is_solved : bool ,
909+ ) {
909910 builder
910911 . spawn ( (
911912 ShowMoreContainer ,
@@ -988,7 +989,7 @@ fn spawn_show_more(font_assets: &Res<FontAssets>, builder: &mut ChildBuilder, is
988989
989990fn more_item (
990991 font_assets : & Res < FontAssets > ,
991- builder : & mut ChildBuilder ,
992+ builder : & mut ChildSpawnerCommands < ' _ > ,
992993 text : & str ,
993994 trigger : fn ( Trigger < Pointer < Click > > , Commands , Single < Entity , With < SelectedCell > > ) ,
994995) {
@@ -1031,15 +1032,15 @@ fn more_item(
10311032 } )
10321033 . observe (
10331034 |trigger : Trigger < Pointer < Over > > , mut item : Query < & mut BackgroundColor > | {
1034- let entity = trigger. entity ( ) ;
1035+ let entity = trigger. target ( ) ;
10351036 if let Ok ( mut item) = item. get_mut ( entity) {
10361037 item. 0 = * EXTRA_LIGHT_GRAY ;
10371038 }
10381039 } ,
10391040 )
10401041 . observe (
10411042 |trigger : Trigger < Pointer < Out > > , mut item : Query < & mut BackgroundColor > | {
1042- let entity = trigger. entity ( ) ;
1043+ let entity = trigger. target ( ) ;
10431044 if let Ok ( mut item) = item. get_mut ( entity) {
10441045 item. 0 = WHITE_COLOR ;
10451046 }
@@ -1059,12 +1060,12 @@ fn on_show_more(
10591060 mut commands : Commands ,
10601061 sudoku_manager : Res < SudokuManager > ,
10611062) {
1062- let parent = trigger. entity ( ) ;
1063+ let parent = trigger. target ( ) ;
10631064
10641065 if opened. 0 {
10651066 opened. 0 = false ;
10661067 for entity in q_more. iter ( ) {
1067- commands. entity ( entity) . despawn_recursive ( ) ;
1068+ commands. entity ( entity) . despawn ( ) ;
10681069 }
10691070 } else {
10701071 opened. 0 = true ;
@@ -1149,7 +1150,7 @@ fn on_reveal_cell(
11491150 sudoku_manager : Res < SudokuManager > ,
11501151 mut commands : Commands ,
11511152) {
1152- let entity = trigger. entity ( ) ;
1153+ let entity = trigger. target ( ) ;
11531154
11541155 if let Ok ( cell_position) = q_select. get ( entity) {
11551156 for ( index, num) in sudoku_manager. solution . iter ( ) . enumerate ( ) {
@@ -1194,7 +1195,7 @@ fn on_check_cell(
11941195 mut commands : Commands ,
11951196 settings : Res < Settings > ,
11961197) {
1197- let entity = trigger. entity ( ) ;
1198+ let entity = trigger. target ( ) ;
11981199 if let Ok ( ( cell_value, cell_position) ) = q_cell. get ( entity) {
11991200 if let Some ( digit) = cell_value. 0 {
12001201 for ( index, num) in sudoku_manager. solution . iter ( ) . enumerate ( ) {
0 commit comments