@@ -131,7 +131,7 @@ bool RouletteLayer::init()
131131 plusButton->setPosition ({ 135 .f , -20 .f });
132132 plusButton->setSizeMult (1 .2f );
133133 plusButton->setTag (11 );
134- plusButton->setVisible (g_rouletteManager.getArrayState (g_rouletteManager.difficultyArr , 5 ));
134+ plusButton->setVisible (g_rouletteManager.getArrayState (g_rouletteManager.getFromSaveContainer ( " difficulty-array " ) , 5 ));
135135 m_pMainMenu->addChild (plusButton);
136136
137137 auto startButtonText = CCLabelBMFont::create (" Start" , " bigFont.fnt" );
@@ -347,7 +347,7 @@ bool RouletteLayer::init()
347347 m_pErrorMenu->addChild (errorResetButton);
348348
349349
350- if (g_rouletteManager.getArrayState (g_rouletteManager.difficultyArr , 5 ))
350+ if (g_rouletteManager.getArrayState (g_rouletteManager.getFromSaveContainer ( " difficulty-array " ) , 5 ))
351351 {
352352 if (RouletteLayer::m_plus_button_state)
353353 {
@@ -356,7 +356,7 @@ bool RouletteLayer::init()
356356 }
357357
358358 for (int i = 6 ; i < 11 ; i++)
359- if (g_rouletteManager.getArrayState (g_rouletteManager.demonDifficultyArr , i - 6 ))
359+ if (g_rouletteManager.getArrayState (g_rouletteManager.getFromSaveContainer ( " demon-difficulty-array " ) , i - 6 ))
360360 static_cast <CCMenuItemSpriteExtra*>(
361361 m_pMainMenu->getChildByTag (i)
362362 )->setColor ({ 255 , 255 , 255 });
@@ -423,7 +423,7 @@ void RouletteLayer::onInfoButton(CCObject*)
423423void RouletteLayer::onDifficultyChosen (CCObject* sender)
424424{
425425 if (
426- auto ind = roulette::utils::getIndexOf (g_rouletteManager.selectedListArr -> as_array (), true );
426+ auto ind = roulette::utils::getIndexOf (g_rouletteManager.getFromSaveContainer ( " selected-list-array " ). as_array (), true );
427427 ind != 0
428428 )
429429 return ;
@@ -434,41 +434,41 @@ void RouletteLayer::onDifficultyChosen(CCObject* sender)
434434 // check if difficultyButton is one of the demon types and not a regular difficulty
435435 if (tag > 5 && (tag < 10 || tag > 5 ))
436436 {
437- int ind = roulette::utils::getIndexOf (g_rouletteManager.demonDifficultyArr -> as_array (), true );
437+ int ind = roulette::utils::getIndexOf (g_rouletteManager.getFromSaveContainer ( " demon-difficulty-array " ). as_array (), true );
438438 static_cast <CCMenuItemSpriteExtra*>(
439439 m_pMainMenu->getChildByTag (ind + 6 )
440440 )->setColor ({ 125 , 125 , 125 });
441441
442- g_rouletteManager.demonDifficultyArr -> as_array ().at (ind) = false ;
443- g_rouletteManager.demonDifficultyArr -> as_array ().at (tag - 6 ) = true ;
442+ g_rouletteManager.getFromSaveContainer ( " demon-difficulty-array " ). as_array ().at (ind) = false ;
443+ g_rouletteManager.getFromSaveContainer ( " demon-difficulty-array " ). as_array ().at (tag - 6 ) = true ;
444444 }
445445 else
446446 {
447447 if (m_plus_button_state && tag != 5 )
448448 onPlusButton (nullptr );
449449
450- int ind = roulette::utils::getIndexOf (g_rouletteManager.difficultyArr -> as_array (), true );
450+ int ind = roulette::utils::getIndexOf (g_rouletteManager.getFromSaveContainer ( " difficulty-array " ). as_array (), true );
451451 static_cast <CCMenuItemSpriteExtra*>(
452452 m_pMainMenu->getChildByTag (ind)
453453 )->setColor ({ 125 , 125 , 125 });
454454
455- g_rouletteManager.difficultyArr -> as_array ().at (ind) = false ;
456- g_rouletteManager.difficultyArr -> as_array ().at (tag) = true ;
455+ g_rouletteManager.getFromSaveContainer ( " difficulty-array " ). as_array ().at (ind) = false ;
456+ g_rouletteManager.getFromSaveContainer ( " difficulty-array " ). as_array ().at (tag) = true ;
457457 g_rouletteManager.previousDifficulty = tag;
458458 }
459459
460460 difficultyButton->setColor ({ 255 , 255 , 255 });
461461
462462 // demon
463- m_pMainMenu->getChildByTag (11 )->setVisible (g_rouletteManager.getArrayState (g_rouletteManager.difficultyArr , 5 ));
463+ m_pMainMenu->getChildByTag (11 )->setVisible (g_rouletteManager.getArrayState (g_rouletteManager.getFromSaveContainer ( " difficulty-array " ) , 5 ));
464464}
465465
466466void RouletteLayer::onStartButton (CCObject*)
467467{
468468 m_pMainMenu->setVisible (false );
469469
470- int diffInd = roulette::utils::getIndexOf (g_rouletteManager.difficultyArr -> as_array (), true );
471- int demonInd = roulette::utils::getIndexOf (g_rouletteManager.demonDifficultyArr -> as_array (), true );
470+ int diffInd = roulette::utils::getIndexOf (g_rouletteManager.getFromSaveContainer ( " difficulty-array " ). as_array (), true );
471+ int demonInd = roulette::utils::getIndexOf (g_rouletteManager.getFromSaveContainer ( " demon-difficulty-array " ). as_array (), true );
472472 int difficulty = diffInd == 5 ? (demonInd + 6 ) : (diffInd + 1 );
473473
474474 getRandomListLevel (difficulty, m_level, m_list_fetcher_error);
@@ -586,8 +586,8 @@ void RouletteLayer::onNextButton(CCObject*)
586586 m_pPlayingMenu->getChildByTag (20 )
587587 )->setString (fmt::format (" {}%" , g_rouletteManager.levelPercentageGoal ).c_str ());
588588
589- int diffInd = roulette::utils::getIndexOf (g_rouletteManager.difficultyArr -> as_array (), true );
590- int demonInd = roulette::utils::getIndexOf (g_rouletteManager.demonDifficultyArr -> as_array (), true );
589+ int diffInd = roulette::utils::getIndexOf (g_rouletteManager.getFromSaveContainer ( " difficulty-array " ). as_array (), true );
590+ int demonInd = roulette::utils::getIndexOf (g_rouletteManager.getFromSaveContainer ( " demon-difficulty-array " ). as_array (), true );
591591 int difficulty = diffInd == 5 ? (demonInd + 6 ) : (diffInd + 1 );
592592
593593 getRandomListLevel (difficulty, m_level, m_list_fetcher_error);
@@ -637,7 +637,7 @@ void RouletteLayer::onResetButton(CCObject*)
637637 m_pMainMenu->getChildByTag (12 )->setVisible (true );
638638 m_pMainMenu->getChildByTag (12 )->setPositionY (-85 .f );
639639
640- if (g_rouletteManager.getArrayState (g_rouletteManager.difficultyArr , 5 ))
640+ if (g_rouletteManager.getArrayState (g_rouletteManager.getFromSaveContainer ( " difficulty-array " ) , 5 ))
641641 {
642642 m_plus_button_state = true ;
643643 onPlusButton (nullptr );
@@ -664,8 +664,8 @@ void RouletteLayer::onSkipButton(CCObject*)
664664
665665 onNextLevel (false , true , -125 .f );
666666
667- int diffInd = roulette::utils::getIndexOf (g_rouletteManager.difficultyArr -> as_array (), true );
668- int demonInd = roulette::utils::getIndexOf (g_rouletteManager.demonDifficultyArr -> as_array (), true );
667+ int diffInd = roulette::utils::getIndexOf (g_rouletteManager.getFromSaveContainer ( " difficulty-array " ). as_array (), true );
668+ int demonInd = roulette::utils::getIndexOf (g_rouletteManager.getFromSaveContainer ( " demon-difficulty-array " ). as_array (), true );
669669 int difficulty = diffInd == 5 ? (demonInd + 6 ) : (diffInd + 1 );
670670
671671 getRandomListLevel (difficulty, m_level, m_list_fetcher_error);
@@ -719,8 +719,8 @@ void RouletteLayer::finishLevelRoulette()
719719 m_pPlayingMenu->getChildByTag (3 )->getChildren ()->objectAtIndex (0 )
720720 )->setString ((" ID: " + m_level.get <std::string>(" id" )).c_str ());
721721
722- auto diffInd = roulette::utils::getIndexOf (g_rouletteManager.difficultyArr -> as_array (), true );
723- auto demonInd = roulette::utils::getIndexOf (g_rouletteManager.demonDifficultyArr -> as_array (), true );
722+ auto diffInd = roulette::utils::getIndexOf (g_rouletteManager.getFromSaveContainer ( " difficulty-array " ). as_array (), true );
723+ auto demonInd = roulette::utils::getIndexOf (g_rouletteManager.getFromSaveContainer ( " demon-difficulty-array " ). as_array (), true );
724724 int difficultyTag = m_difficulty_to_tag.at (m_level.get <std::string>(" difficulty" ));
725725
726726 if (int coins = m_level.get <int >(" coins" ); coins > 0 )
@@ -810,7 +810,7 @@ void RouletteLayer::onNextLevel(bool levelTextVisible, bool enableLoadingCircle,
810810
811811void RouletteLayer::getRandomListLevel (int difficulty, matjson::Value& list, std::string& error)
812812{
813- int listType = roulette::utils::getIndexOf (g_rouletteManager.selectedListArr -> as_array (), true );
813+ int listType = roulette::utils::getIndexOf (g_rouletteManager.getFromSaveContainer ( " selected-list-array " ). as_array (), true );
814814 std::thread getListThread;
815815
816816 switch (listType)
@@ -853,12 +853,12 @@ CCMenuItemSpriteExtra* RouletteLayer::createDifficultyButton(int tag, CCNode* sp
853853 button->setTag (tag);
854854 if (isDemon)
855855 {
856- if (!g_rouletteManager.getArrayState (g_rouletteManager.difficultyArr , tag - 6 ))
856+ if (!g_rouletteManager.getArrayState (g_rouletteManager.getFromSaveContainer ( " difficulty-array " ) , tag - 6 ))
857857 button->setColor ({ 125 , 125 , 125 });
858858 }
859859 else
860860 {
861- if (!g_rouletteManager.getArrayState (g_rouletteManager.difficultyArr , tag))
861+ if (!g_rouletteManager.getArrayState (g_rouletteManager.getFromSaveContainer ( " difficulty-array " ) , tag))
862862 button->setColor ({ 125 , 125 , 125 });
863863 }
864864 button->setVisible (visible);
0 commit comments