| 68 | } |
| 69 | |
| 70 | bool CreatorLayer::init() |
| 71 | { |
| 72 | if (!Scene::init()) |
| 73 | return false; |
| 74 | |
| 75 | auto director = Director::getInstance(); |
| 76 | const auto& winSize = director->getWinSize(); |
| 77 | |
| 78 | GameToolbox::createBG(this); |
| 79 | GameToolbox::createAllCorners(this); |
| 80 | |
| 81 | auto menu = Menu::create(); |
| 82 | |
| 83 | auto backBtn = MenuItemSpriteExtra::create("GJ_arrow_03_001.png", [](Node*) { |
| 84 | Director::getInstance()->replaceScene(TransitionFade::create(.5, MenuLayer::scene())); |
| 85 | }); |
| 86 | backBtn->setPosition(menu->convertToNodeSpace({ 24.0, winSize.height - 23.0f })); |
| 87 | menu->addChild(backBtn); |
| 88 | |
| 89 | Sprite* secretLock = Sprite::createWithSpriteFrameName("GJ_lock_open_001.png"); |
| 90 | MenuItemSpriteExtra* secretLockBtn = MenuItemSpriteExtra::create(secretLock, [](Node*) { |
| 91 | Director::getInstance()->replaceScene(TransitionFade::create(.5, SecretLayer2::scene())); |
| 92 | }); |
| 93 | menu->addChild(secretLockBtn); |
| 94 | secretLockBtn->setPosition(menu->convertToNodeSpace({winSize.width - 23.0f, winSize.height - 24.0f})); // Wrong cuz the function doesnt want to decompile for some reason |
| 95 | |
| 96 | auto buttonTexture = [](int n) -> const char* |
| 97 | { |
| 98 | switch (n) |
| 99 | { |
| 100 | default: return "GJ_createBtn_001.png"; |
| 101 | case 1: return "GJ_savedBtn_001.png"; |
| 102 | case 2: return "GJ_highscoreBtn_001.png"; |
| 103 | case 3: return "GJ_challengeBtn_001.png"; |
| 104 | case 4: return "GJ_dailyBtn_001.png"; |
| 105 | case 5: return "GJ_weeklyBtn_001.png"; |
| 106 | case 6: return "GJ_gauntletsBtn_001.png"; |
| 107 | case 7: return "GJ_featuredBtn_001.png"; |
| 108 | //case 8: return "GJ_fameBtn_001.png"; hall of fame was removed from 2.2 |
| 109 | case 9: return "GJ_mapPacksBtn_001.png"; |
| 110 | case 10: return "GJ_searchBtn_001.png"; |
| 111 | } |
| 112 | }; |
| 113 | |
| 114 | auto onButtonsCallback = [this](Node* btn) -> void |
| 115 | { |
| 116 | GameToolbox::log("tag: {}", btn->getTag()); |
| 117 | switch (btn->getTag()) |
| 118 | { |
| 119 | case 0: { |
| 120 | auto level = GJGameLevel::createWithMinimumData("Unnamed 0", "You", 33); |
| 121 | |
| 122 | auto editor = LevelEditorLayer::scene(level); |
| 123 | |
| 124 | // addChild(editor, 1000); |
| 125 | |
| 126 | Director::getInstance()->replaceScene(ax::TransitionFade::create(0.5f, editor)); |
| 127 |
no test coverage detected