Advertisement
Guest User

Untitled

a guest
Dec 11th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.96 KB | None | 0 0
  1. #include <Games/Freibier/include/modules/Freibier_BasicGame.hpp>
  2. #include <Games/Freibier/include/modules/Freibier_BasicGameCmd.hpp>
  3. #include <vevt/include/VEVT_ReelsSubscriber.hpp>
  4. #include <vlib/include/suppliers/VLIB_FiguresProvider.hpp>
  5. #include <vcore/include/accounting/VCORE_Account.hpp>
  6. #include <vlib/include/factory/ObjectFac.hpp>
  7. #include <vgui/include/factory/VGUI_MovieFac.hpp>
  8. #include <vsdk/gameBS/include/BSViewSupplier.hpp>
  9. #include <vsdk/gameBS/include/BSCmd.hpp>
  10. #include <iostream>
  11.  
  12. using namespace freibier;
  13. using namespace vevt;
  14. using namespace vlib;
  15. using namespace vsdk;
  16. using namespace std;
  17.  
  18.  
  19. BasicGame::BasicGame() : m_respin_win(0)
  20. {
  21.  
  22. }
  23.  
  24. void BasicGame::ActionFinish(VEVT_Event* const event)
  25. {
  26.     printf("Action finish!!! \n");
  27.        
  28.     if (m_respin)
  29.     {
  30.         m_nor_chain.clear();
  31.         m_ext_chain.clear();
  32.         BSModel::ActionStart(nullptr);
  33.         Notify(COREFIRE.HIDE_GAME_MESSAGE);
  34.         printf("1# Action finish! m_respin = true\n");
  35.     }
  36.     else
  37.     {
  38.         printf("2# Action finish! m_respin = false\n");
  39.         BSModel::ActionFinish(event);
  40.     }
  41. }
  42.  
  43. void BasicGame::ProbeNormal(VEVT_Event* const event)
  44. {
  45.     if (m_first_probe)
  46.     {
  47.         printf("3# ProbeNormal m_first_probe = true\n");
  48.         ProcessRespin();
  49.     }
  50.     BSModel::ProbeNormal(event);
  51. }
  52.  
  53. void BasicGame::ActionStart(VEVT_Event* const event)
  54. {
  55.     printf("4# Action start");
  56.     BSModel::ActionStart(event);
  57.     indexes.clear();
  58. }
  59.  
  60. void BasicGame::MediaStateChanged(VEVT_Event* const event)
  61. {
  62.     BSModel::MediaStateChanged(event);
  63.            
  64.     if (event->GetCommand() != WL_EVENT.WHEEL_STOP)
  65.         return;
  66.  
  67.    
  68.     const auto scatter_id = VLIB_FiguresProvider::Instance()->Scatter()->GetIdentity();
  69.     const auto wheel = event->GetContent();
  70.     const auto curr_wheel = BSViewSupplier::Instance()->GetWheels()->GetWheel(wheel);
  71.     int symbol{ curr_wheel->GetVisibleCount() };
  72.  
  73.     while (symbol--)
  74.     {  
  75.         //Анимация скеттера при крутке только на 1-3 барабанах
  76.         if (curr_wheel->GetContents(symbol) == scatter_id) {
  77.  
  78.             indexes.push_back(wheel);
  79.             std::cout << "SIZE: " << indexes.size() << std::endl;
  80.            
  81.             if(wheel > 2)
  82.                 continue;
  83.  
  84.             StrBuf panel_name;
  85.             sprintf(panel_name, "app.overlay.profits.movie.W%d#R%d", wheel, symbol);
  86.             auto panel = ObjectFac::Instance()->LoadPanel(panel_name);
  87.             auto scatter_movie = VGUI_MovieFac::Instance()->GetMovie("bs_F10_appear"); VLIB_ASSERT(scatter_movie);
  88.             panel->SetImage(scatter_movie);
  89.             scatter_movie->Play();
  90.         }
  91.     }
  92. }
  93.  
  94. void freibier::BasicGame::ProcessRespin()
  95. {
  96.     auto wheels = BSViewSupplier::Instance()->GetWheels();
  97.  
  98.     if (!m_respin && (indexes.size() > 1))
  99.     {
  100.  
  101.         printf("5# ProcessRespin !m_respin && (indexes.size() > 1)");
  102.         m_respin = true;
  103.         m_ext_chain.clear();
  104.         wheels->SetNotSpinningWheels(indexes);
  105.     }
  106.     else
  107.     {
  108.         printf("6# ProcessRespin ResetNotSpinningWheels");
  109.         Notify(BASIC_GAME_EVENT.STOP_RESPIN);
  110.         SetGameWin(m_respin_win);
  111.         m_respin = false;
  112.         m_respin_win = 0;
  113.         wheels->ResetNotSpinningWheels();
  114.     }
  115. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement