1
1
#include "../color_guess.h"
2
+ #include "../helpers/color_guess_custom_event.h"
3
+ #include "../views/color_guess_play.h"
4
+
5
+ void color_guess_play_callback (ColorGuessCustomEvent event , void * context ) {
6
+ furi_assert (context );
7
+ ColorGuess * app = context ;
8
+ view_dispatcher_send_custom_event (app -> view_dispatcher , event );
9
+ }
2
10
3
11
void color_guess_scene_play_on_enter (void * context ) {
12
+ furi_assert (context );
4
13
ColorGuess * app = context ;
5
- //UNUSED( app);
14
+ color_guess_play_set_callback ( app -> color_guess_play , color_guess_play_callback , app );
6
15
view_dispatcher_switch_to_view (app -> view_dispatcher , ColorGuessViewIdPlay );
7
16
}
8
17
9
18
bool color_guess_scene_play_on_event (void * context , SceneManagerEvent event ) {
10
- UNUSED (context );
11
- UNUSED (event );
12
- return false;
19
+ ColorGuess * app = context ;
20
+ bool consumed = false;
21
+
22
+ if (event .type == SceneManagerEventTypeCustom ) {
23
+ switch (event .event ) {
24
+ case ColorGuessCustomEventPlayLeft :
25
+ case ColorGuessCustomEventPlayRight :
26
+ break ;
27
+ case ColorGuessCustomEventPlayUp :
28
+ case ColorGuessCustomEventPlayDown :
29
+ break ;
30
+ case ColorGuessCustomEventPlayBack :
31
+ notification_message (app -> notification , & sequence_reset_red );
32
+ notification_message (app -> notification , & sequence_reset_green );
33
+ notification_message (app -> notification , & sequence_reset_blue );
34
+ if (!scene_manager_search_and_switch_to_previous_scene (
35
+ app -> scene_manager , ColorGuessSceneStart )) {
36
+ scene_manager_stop (app -> scene_manager );
37
+ view_dispatcher_stop (app -> view_dispatcher );
38
+ }
39
+ consumed = true;
40
+ break ;
41
+ }
42
+ }
43
+
44
+ return consumed ;
13
45
}
14
46
15
47
void color_guess_scene_play_on_exit (void * context ) {
16
- UNUSED ( context ) ;
17
-
48
+ ColorGuess * app = context ;
49
+ UNUSED ( app );
18
50
}
0 commit comments