void HelloWorld::menuEventCallback(cocos2d::Ref* pSender){ MenuItemLabel* pMenuItem = (MenuItemLabel*)pSender; char buf[64]; int i = pMenuItem->getTag(); sprintf(buf, s_EventMenuItem[i].id.c_str(), ++_indexes[i]); LabelTTF* label = (LabelTTF*)pMenuItem->getLabel(); label->setString(buf); switch (i) { case CREATE_USER_ID: mTDGAaccount = TDCCAccount::setAccount(label->getString().c_str()); break; case ADD_LEVEL: if (mTDGAaccount) mTDGAaccount->setLevel(_indexes[i]); break; case UPDATE_GAME_SERVER: if (mTDGAaccount) mTDGAaccount->setGameServer(label->getString().c_str()); break; case UPDATE_USER_NAME: if (mTDGAaccount) mTDGAaccount->setAccountName(label->getString().c_str()); break; case UPDATE_GENDER: if (mTDGAaccount) mTDGAaccount->setGender(mTDGAaccount->kGenderMale); break; case UPDATE_TYPE: if (mTDGAaccount) mTDGAaccount->setAccountType(mTDGAaccount->kAccountType1); break; default: break; } }
/** * Delegate to respond touch event * * @param table table contains the given cell * @param cell cell that is touched * @js NA * @lua NA */ void HelloWorld::tableCellTouched(cocos2d::extension::TableView *table, TableViewCell* cell){ LabelTTF *label = (LabelTTF*)cell->getChildByTag(2); log("%s",label->getString().c_str()); };