@@ -94,8 +94,8 @@ bool ObjectWorkshop::setup(bool authenticated) {
9494 leftTopBar->addChildAtPosition (profileLabel, Anchor::Center, {-25 , 10 });
9595
9696 leftBar->addChildAtPosition (leftTopBar, Anchor::Top, {3 , -7 });
97- createCategoryBtn (" My Objects" , 0 );
98- createCategoryBtn (" Favorites" , 1 );
97+ createCategoryBtn (" My Objects" , 0 , !authenticated );
98+ createCategoryBtn (" Favorites" , 1 , !authenticated );
9999 auto vLine = CCSprite::createWithSpriteFrameName (" edit_vLine_001.png" );
100100 vLine->setRotation (90 );
101101 leftBar->addChildAtPosition (vLine, Anchor::Center, {0 , 40 });
@@ -491,6 +491,7 @@ void ObjectWorkshop::RegenCategory() {
491491 cocos::handleTouchPriority (m_buttonMenu);
492492 load ();
493493 });
494+ setKeyboardEnabled (true );
494495}
495496
496497void ObjectWorkshop::onRetryBtn (CCObject*) {
@@ -583,7 +584,7 @@ void ObjectWorkshop::load() {
583584 m_buttonMenu->addChildAtPosition (bottomPageLabel, Anchor::Bottom, {55 , 17 });
584585 m_scrollLayer->setTouchEnabled (true );
585586 m_amountItems = array.size ();
586- if (!m_user. authenticated || (currentMenuIndexGD != 0 && currentMenuIndexGD != -1 )) {
587+ if ((currentMenuIndexGD != 0 && currentMenuIndexGD != -1 )) {
587588 if (m_amountItems > 6 ) {
588589 categoryItems->setContentSize ({
589590 categoryItems->getContentWidth (),
@@ -953,7 +954,7 @@ void ObjectWorkshop::load() {
953954 return ;
954955 }
955956 if (currentMenuIndexGD < 2 || currentMenuIndexGD > 6 ) {
956- if (m_user.authenticated ) {
957+ if (m_user.authenticated || currentMenuIndexGD == - 1 ) {
957958 if (currentMenuIndexGD != -1 ) {
958959 auto myjson = matjson::Value ();
959960 myjson.set (" token" , m_token);
@@ -1033,6 +1034,31 @@ void ObjectWorkshop::createCategoryBtn(const char* string, int menuIndex) {
10331034 }
10341035}
10351036
1037+ void ObjectWorkshop::createCategoryBtn (const char * string, int menuIndex, bool disabled) {
1038+ if (!disabled) return createCategoryBtn (string, menuIndex);
1039+ auto label = CCLabelBMFont::create (string, " bigFont.fnt" );
1040+ label->limitLabelWidth (160 .0F , 0 .75F , 0 .2F );
1041+
1042+ auto bgNode = CategoryButton::create (string);
1043+ bgNode->setDisabled (true );
1044+ auto btn = CCMenuItemSpriteExtra::create (
1045+ bgNode,
1046+ this ,
1047+ nullptr
1048+ );
1049+ btn->setID (fmt::format (" category-{}" _spr, menuIndex));
1050+ if (menuIndex < 2 ) {
1051+ m_buttonMenu->addChildAtPosition (
1052+ btn,
1053+ Anchor::TopLeft,
1054+ {55 , (-60 .F ) + (-25 * menuIndex)}
1055+ );
1056+ } else {
1057+ m_categoryButtons->addChild (btn);
1058+ m_categoryButtons->updateLayout ();
1059+ }
1060+ }
1061+
10361062void ObjectWorkshop::onProfileSelf (CCObject*) {
10371063 if (!m_user.authenticated ) return FLAlertLayer::create (" Error" , " You cannot view your profile as you are <cy>not authenticated!</c>" , " OK" )->show ();
10381064 onClickUser (m_user.account_id );
@@ -1817,13 +1843,13 @@ void ObjectWorkshop::onClose(CCObject* sender) {
18171843 this ->setKeypadEnabled (false );
18181844 this ->setTouchEnabled (false );
18191845 if (!m_inEditor) {
1820- log::debug (" delete LEL!" );
18211846 if (auto gameManager = GameManager::sharedState ()) {
18221847 if (gameManager->m_levelEditorLayer != nullptr ) {
18231848 gameManager->m_levelEditorLayer ->release ();
18241849 gameManager->m_levelEditorLayer = nullptr ; // i LOVE dangling pointres, anyways i cant do `delete` because apparently game crashes if i close
18251850 }
18261851 gameManager->m_editorEnabled = false ;
1852+ log::debug (" delete LEL!" );
18271853 }
18281854 }
18291855 this ->removeFromParentAndCleanup (true );
@@ -1850,7 +1876,8 @@ void ObjectWorkshop::keyDown(cocos2d::enumKeyCodes key) {
18501876 return ;
18511877 }
18521878 if (key == cocos2d::enumKeyCodes::KEY_Space) return ;
1853- return FLAlertLayer::keyDown (key);
1879+ // log::info("they really tried");
1880+ // return FLAlertLayer::keyDown(key);
18541881}
18551882
18561883void ObjectWorkshop::keyBackClicked () {
0 commit comments