flipchess_scene_scene_1.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #include "../flipchess.h"
  2. #include "../helpers/flipchess_voice.h"
  3. #include "../helpers/flipchess_custom_event.h"
  4. #include "../views/flipchess_scene_1.h"
  5. void flipchess_scene_1_callback(FlipChessCustomEvent event, void* context) {
  6. furi_assert(context);
  7. FlipChess* app = context;
  8. view_dispatcher_send_custom_event(app->view_dispatcher, event);
  9. }
  10. void flipchess_scene_scene_1_on_enter(void* context) {
  11. furi_assert(context);
  12. FlipChess* app = context;
  13. if(app->sound == 1) {
  14. flipchess_voice_how_about_chess();
  15. }
  16. flipchess_scene_1_set_callback(app->flipchess_scene_1, flipchess_scene_1_callback, app);
  17. view_dispatcher_switch_to_view(app->view_dispatcher, FlipChessViewIdScene1);
  18. }
  19. bool flipchess_scene_scene_1_on_event(void* context, SceneManagerEvent event) {
  20. FlipChess* app = context;
  21. bool consumed = false;
  22. if(event.type == SceneManagerEventTypeCustom) {
  23. switch(event.event) {
  24. case FlipChessCustomEventScene1Left:
  25. case FlipChessCustomEventScene1Right:
  26. break;
  27. case FlipChessCustomEventScene1Up:
  28. case FlipChessCustomEventScene1Down:
  29. break;
  30. case FlipChessCustomEventScene1Back:
  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, FlipChessSceneMenu)) {
  36. scene_manager_stop(app->scene_manager);
  37. view_dispatcher_stop(app->view_dispatcher);
  38. }
  39. consumed = true;
  40. break;
  41. }
  42. }
  43. return consumed;
  44. }
  45. void flipchess_scene_scene_1_on_exit(void* context) {
  46. FlipChess* app = context;
  47. UNUSED(app);
  48. }