@@ -953,196 +953,6 @@ bool IslandSelectLayer::init(int page) {
953953 level10->setVisible (false );
954954 }
955955
956- return true ;
957- }
958-
959- void IslandSelectLayer::runParticle () {
960- auto winSize = CCDirector::sharedDirector ()->getWinSize ();
961- auto particles = CCParticleSystemQuad::create (" coinPickupEffect.plist" , 1 );
962-
963- auto levelunlocked = Mod::get ()->getSavedValue <int >(" iLevelUnlocked" );
964-
965- auto extendedLayer = (ExtendedLayer*)m_scrollLayer->getChildren ()->objectAtIndex (0 );
966-
967- auto levelsnode1 = (IslandNode*)extendedLayer->getChildren ()->objectAtIndex (0 );
968- auto levelsmenu1 = (CCMenu*)levelsnode1->getChildren ()->objectAtIndex (2 );
969-
970- auto levelsnode2 = (IslandNode*)extendedLayer->getChildren ()->objectAtIndex (1 );
971- auto levelsmenu2 = (CCMenu*)levelsnode2->getChildren ()->objectAtIndex (2 );
972-
973- particles->setAnchorPoint ({ 0 .5f , 0 .5f });
974- particles->setScale (0 .5f );
975- particles->setZOrder (3 );
976-
977- auto circlewave = CCCircleWave::create (16.0 , 30 , 0.3 , 0 ,1 );
978- circlewave->setAnchorPoint ({ 0 .5f , 0 .5f });
979- circlewave->setScale (0 .5f );
980- circlewave->setZOrder (3 );
981-
982- auto circlewave2 = CCCircleWave::create (16 , 80 , 0.3 , 1 , 1 );
983- circlewave2->setAnchorPoint ({ 0 .5f , 0 .5f });
984- circlewave2->setScale (0 .5f );
985- circlewave->setZOrder (3 );
986-
987- if (levelunlocked == 1 ) {
988- particles->setPosition ({ -80 , -30 });
989- }
990- if (levelunlocked == 2 ) {
991- particles->setPosition ({ -10 , 10 });
992- }
993- if (levelunlocked == 3 ) {
994- particles->setPosition ({ 50 , -25 });
995- }
996- if (levelunlocked == 4 ) {
997- particles->setPosition ({ 155 , -10 });
998- }
999- if (levelunlocked == 5 ) {
1000- particles->setPosition ({ -175 , -12 });
1001- }
1002- if (levelunlocked == 6 ) {
1003- particles->setPosition ({ -73 , -28 });
1004- }
1005- if (levelunlocked == 7 ) {
1006- particles->setPosition ({ -10 , 15 });
1007- }
1008- if (levelunlocked == 8 ) {
1009- particles->setPosition ({ 80 , -38 });
1010- }
1011- if (levelunlocked == 9 ) {
1012- particles->setPosition ({ 170 , -10 });
1013- }
1014-
1015- particles->init ();
1016-
1017- if (levelunlocked >= 1 && levelunlocked <= 4 ) {
1018- levelsmenu1->addChild (particles, 2 );
1019-
1020- }
1021- else if (levelunlocked >= 5 && levelunlocked <= 9 ) {
1022- levelsmenu2->addChild (particles, 2 );
1023- }
1024- particles->addChild (circlewave, 2 );
1025- particles->addChild (circlewave2, 2 );
1026- }
1027-
1028- void IslandSelectLayer::keyBackClicked () {
1029- CCDirector::sharedDirector ()->popSceneWithTransition (0 .5f , PopTransition::kPopTransitionFade );
1030- }
1031-
1032- void IslandSelectLayer::onIslandLevel (CCObject* sender) {
1033- CCMenuItemSpriteExtra* button = typeinfo_cast<CCMenuItemSpriteExtra*>(sender);
1034- auto GLM = GameLevelManager::sharedState ();
1035- IslandLevel::create (level, button)->show ();
1036- }
1037-
1038- cocos2d::ccColor3B IslandSelectLayer::colorForPage (int page) {
1039- auto GM = GameManager::sharedState ();
1040- int colIDs[9 ] = { 6 , 17 , 4 , 9 , 3 , 11 , 1 , 3 , 4 };
1041-
1042- return GM->colorForIdx (colIDs[page % 5 ]);
1043- }
1044-
1045- ccColor3B IslandSelectLayer::getColorValue (int level, int level2, float a3) {
1046- float mod = (a3 * (2 / 3 )) - 0 .2f ; // do NOT touch this line
1047- if (mod < 1 .0f ) {
1048- if (mod <= 0 .0f )
1049- mod = 0 .0f ;
1050- } else mod = 1 .0f ;
1051-
1052- ccColor3B col1 = colorForPage (level);
1053- ccColor3B col2 = colorForPage (level2);
1054-
1055- ccColor3B col3 = {
1056- static_cast <GLubyte>((col2.r * mod) + col1.r * (1 .0f - mod)),
1057- static_cast <GLubyte>((col2.g * mod) + col1.g * (1 .0f - mod)),
1058- static_cast <GLubyte>((col2.b * mod) + col1.b * (1 .0f - mod))
1059- };
1060- return col3;
1061- }
1062-
1063- void IslandSelectLayer::scrollLayerMoved (CCPoint point) {
1064- const int pageCount = 3 ;
1065- const float threshold = 0 .7f ;
1066-
1067- float x = -point.x / this ->m_fWindowWidth ;
1068- while (x < 0 .0f ) {
1069- x += pageCount;
1070- }
1071-
1072- int ix = std::floor (x);
1073-
1074- float offset = x - ix;
1075-
1076- int firstPage = ix % pageCount;
1077-
1078- int lmao = firstPage + 1 ;
1079- int secondPage = lmao % pageCount;
1080-
1081- m_level = firstPage;
1082-
1083- if (std::abs (offset) > threshold) {
1084- ccColor3B color = getColorValue (firstPage, secondPage - 1 , 12 );
1085- m_background->setColor (color);
1086-
1087- ccColor3B Color1 = color;
1088- Color1.r = color.r * 0.8 ;
1089- Color1.g = color.g * 0.8 ;
1090- Color1.b = color.b * 0.8 ;
1091-
1092- ccColor3B Color2 = color;
1093- Color2.r = color.r * 0.9 ;
1094- Color2.g = color.g * 0.9 ;
1095- Color2.b = color.b * 0.9 ;
1096- }
1097-
1098- updatePageButtons ();
1099- }
1100-
1101- void IslandSelectLayer::onClose (CCObject*) {
1102- keyBackClicked ();
1103- }
1104-
1105- void IslandSelectLayer::updatePageWithObject (CCObject* page, CCObject* object) {
1106- if (!page || !object) {
1107- return ;
1108- }
1109-
1110- GJGameLevel* level = static_cast <GJGameLevel*>(object);
1111-
1112- LevelPage* levelPage = typeinfo_cast<LevelPage*>(page);
1113-
1114- if (!levelPage) {
1115- return ;
1116- }
1117-
1118- levelPage->updateDynamicPage (level);
1119-
1120- }
1121-
1122- void IslandSelectLayer::onNext (CCObject*) {
1123- m_scrollLayer->quickUpdate ();
1124- m_scrollLayer->moveToPage (m_level + 1 );
1125-
1126- updatePageButtons ();
1127- }
1128-
1129- void IslandSelectLayer::onPrev (CCObject*) {
1130- m_scrollLayer->quickUpdate ();
1131- m_scrollLayer->moveToPage (m_level - 1 );
1132-
1133- updatePageButtons ();
1134- }
1135-
1136- void IslandSelectLayer::onEnterTransitionDidFinish () {
1137- CCLayer::onEnterTransitionDidFinish ();
1138-
1139- if (!m_scaleWithBounce) {
1140- m_scaleWithBounce = CCEaseBounceOut::create (CCScaleTo::create (0.5 ,1 , 0.5 ));
1141- }
1142- if (!m_scaleWithBounce2) {
1143- m_scaleWithBounce2 = CCEaseBounceOut::create (CCScaleTo::create (0.5 ,1 ));
1144- }
1145-
1146956 if (m_iLevels.iLevel1 ->m_normalPercent == 100 && m_iLevels.iLevel2 ->m_normalPercent == 0 && m_iLevels.level1complete == 0 ) {
1147957 m_points.level1PathPoint1 ->setScaleY (1.2 );
1148958 m_points.level1PathPoint2 ->setScaleY (1.2 );
@@ -1514,6 +1324,198 @@ void IslandSelectLayer::onEnterTransitionDidFinish() {
15141324 this ->addChild (dl, 3 );
15151325 Mod::get ()->setSavedValue (" islandlevel10complete" , 1 );
15161326 }
1327+
1328+ return true ;
1329+ }
1330+
1331+ void IslandSelectLayer::runParticle () {
1332+ auto winSize = CCDirector::sharedDirector ()->getWinSize ();
1333+ auto particles = CCParticleSystemQuad::create (" coinPickupEffect.plist" , 1 );
1334+
1335+ auto levelunlocked = Mod::get ()->getSavedValue <int >(" iLevelUnlocked" );
1336+
1337+ auto extendedLayer = (ExtendedLayer*)m_scrollLayer->getChildren ()->objectAtIndex (0 );
1338+
1339+ auto levelsnode1 = (IslandNode*)extendedLayer->getChildren ()->objectAtIndex (0 );
1340+ auto levelsmenu1 = (CCMenu*)levelsnode1->getChildren ()->objectAtIndex (2 );
1341+
1342+ auto levelsnode2 = (IslandNode*)extendedLayer->getChildren ()->objectAtIndex (1 );
1343+ auto levelsmenu2 = (CCMenu*)levelsnode2->getChildren ()->objectAtIndex (2 );
1344+
1345+ particles->setAnchorPoint ({ 0 .5f , 0 .5f });
1346+ particles->setScale (0 .5f );
1347+ particles->setZOrder (3 );
1348+
1349+ auto circlewave = CCCircleWave::create (16.0 , 30 , 0.3 , 0 ,1 );
1350+ circlewave->setAnchorPoint ({ 0 .5f , 0 .5f });
1351+ circlewave->setScale (0 .5f );
1352+ circlewave->setZOrder (3 );
1353+
1354+ auto circlewave2 = CCCircleWave::create (16 , 80 , 0.3 , 1 , 1 );
1355+ circlewave2->setAnchorPoint ({ 0 .5f , 0 .5f });
1356+ circlewave2->setScale (0 .5f );
1357+ circlewave->setZOrder (3 );
1358+
1359+ if (levelunlocked == 1 ) {
1360+ particles->setPosition ({ -80 , -30 });
1361+ }
1362+ if (levelunlocked == 2 ) {
1363+ particles->setPosition ({ -10 , 10 });
1364+ }
1365+ if (levelunlocked == 3 ) {
1366+ particles->setPosition ({ 50 , -25 });
1367+ }
1368+ if (levelunlocked == 4 ) {
1369+ particles->setPosition ({ 155 , -10 });
1370+ }
1371+ if (levelunlocked == 5 ) {
1372+ particles->setPosition ({ -175 , -12 });
1373+ }
1374+ if (levelunlocked == 6 ) {
1375+ particles->setPosition ({ -73 , -28 });
1376+ }
1377+ if (levelunlocked == 7 ) {
1378+ particles->setPosition ({ -10 , 15 });
1379+ }
1380+ if (levelunlocked == 8 ) {
1381+ particles->setPosition ({ 80 , -38 });
1382+ }
1383+ if (levelunlocked == 9 ) {
1384+ particles->setPosition ({ 170 , -10 });
1385+ }
1386+
1387+ particles->init ();
1388+
1389+ if (levelunlocked >= 1 && levelunlocked <= 4 ) {
1390+ levelsmenu1->addChild (particles, 2 );
1391+
1392+ }
1393+ else if (levelunlocked >= 5 && levelunlocked <= 9 ) {
1394+ levelsmenu2->addChild (particles, 2 );
1395+ }
1396+ particles->addChild (circlewave, 2 );
1397+ particles->addChild (circlewave2, 2 );
1398+ }
1399+
1400+ void IslandSelectLayer::keyBackClicked () {
1401+ CCDirector::sharedDirector ()->popSceneWithTransition (0 .5f , PopTransition::kPopTransitionFade );
1402+ }
1403+
1404+ void IslandSelectLayer::onIslandLevel (CCObject* sender) {
1405+ CCMenuItemSpriteExtra* button = typeinfo_cast<CCMenuItemSpriteExtra*>(sender);
1406+ auto GLM = GameLevelManager::sharedState ();
1407+ IslandLevel::create (level, button)->show ();
1408+ }
1409+
1410+ cocos2d::ccColor3B IslandSelectLayer::colorForPage (int page) {
1411+ auto GM = GameManager::sharedState ();
1412+ int colIDs[9 ] = { 6 , 17 , 4 , 9 , 3 , 11 , 1 , 3 , 4 };
1413+
1414+ return GM->colorForIdx (colIDs[page % 5 ]);
1415+ }
1416+
1417+ ccColor3B IslandSelectLayer::getColorValue (int level, int level2, float a3) {
1418+ float mod = (a3 * (2 / 3 )) - 0 .2f ; // do NOT touch this line
1419+ if (mod < 1 .0f ) {
1420+ if (mod <= 0 .0f )
1421+ mod = 0 .0f ;
1422+ } else mod = 1 .0f ;
1423+
1424+ ccColor3B col1 = colorForPage (level);
1425+ ccColor3B col2 = colorForPage (level2);
1426+
1427+ ccColor3B col3 = {
1428+ static_cast <GLubyte>((col2.r * mod) + col1.r * (1 .0f - mod)),
1429+ static_cast <GLubyte>((col2.g * mod) + col1.g * (1 .0f - mod)),
1430+ static_cast <GLubyte>((col2.b * mod) + col1.b * (1 .0f - mod))
1431+ };
1432+ return col3;
1433+ }
1434+
1435+ void IslandSelectLayer::scrollLayerMoved (CCPoint point) {
1436+ const int pageCount = 3 ;
1437+ const float threshold = 0 .7f ;
1438+
1439+ float x = -point.x / this ->m_fWindowWidth ;
1440+ while (x < 0 .0f ) {
1441+ x += pageCount;
1442+ }
1443+
1444+ int ix = std::floor (x);
1445+
1446+ float offset = x - ix;
1447+
1448+ int firstPage = ix % pageCount;
1449+
1450+ int lmao = firstPage + 1 ;
1451+ int secondPage = lmao % pageCount;
1452+
1453+ m_level = firstPage;
1454+
1455+ if (std::abs (offset) > threshold) {
1456+ ccColor3B color = getColorValue (firstPage, secondPage - 1 , 12 );
1457+ m_background->setColor (color);
1458+
1459+ ccColor3B Color1 = color;
1460+ Color1.r = color.r * 0.8 ;
1461+ Color1.g = color.g * 0.8 ;
1462+ Color1.b = color.b * 0.8 ;
1463+
1464+ ccColor3B Color2 = color;
1465+ Color2.r = color.r * 0.9 ;
1466+ Color2.g = color.g * 0.9 ;
1467+ Color2.b = color.b * 0.9 ;
1468+ }
1469+
1470+ updatePageButtons ();
1471+ }
1472+
1473+ void IslandSelectLayer::onClose (CCObject*) {
1474+ keyBackClicked ();
1475+ }
1476+
1477+ void IslandSelectLayer::updatePageWithObject (CCObject* page, CCObject* object) {
1478+ if (!page || !object) {
1479+ return ;
1480+ }
1481+
1482+ GJGameLevel* level = static_cast <GJGameLevel*>(object);
1483+
1484+ LevelPage* levelPage = typeinfo_cast<LevelPage*>(page);
1485+
1486+ if (!levelPage) {
1487+ return ;
1488+ }
1489+
1490+ levelPage->updateDynamicPage (level);
1491+
1492+ }
1493+
1494+ void IslandSelectLayer::onNext (CCObject*) {
1495+ m_scrollLayer->quickUpdate ();
1496+ m_scrollLayer->moveToPage (m_level + 1 );
1497+
1498+ updatePageButtons ();
1499+ }
1500+
1501+ void IslandSelectLayer::onPrev (CCObject*) {
1502+ m_scrollLayer->quickUpdate ();
1503+ m_scrollLayer->moveToPage (m_level - 1 );
1504+
1505+ updatePageButtons ();
1506+ }
1507+
1508+ void IslandSelectLayer::onEnterTransitionDidFinish () {
1509+ CCLayer::onEnterTransitionDidFinish ();
1510+
1511+ if (!m_scaleWithBounce) {
1512+ m_scaleWithBounce = CCEaseBounceOut::create (CCScaleTo::create (0.5 ,1 , 0.5 ));
1513+ }
1514+ if (!m_scaleWithBounce2) {
1515+ m_scaleWithBounce2 = CCEaseBounceOut::create (CCScaleTo::create (0.5 ,1 ));
1516+ }
1517+
1518+ // gonna look into it later
15171519}
15181520
15191521void IslandSelectLayer::updatePageButtons () {
0 commit comments