bool PaymentTstoreCommand::handleRecieve(cocos2d::CCDictionary *dict) { if (dict->valueForKey("cmd")->compare(PAYMENT_TSTORE_COMMAND) != 0) return false; PayController::getInstance()->setGoldExchangeSaleBoughtFlag(m_itemId, false); CCDictionary *params = _dict(dict->objectForKey("params")); if (m_orderId.compare(params->valueForKey("orderId")->getCString()) != 0) { return false; } if (params->objectForKey("errorCode")) { callFail(NetResult::createWithFail(params)); return true; } int status = params->valueForKey("status")->intValue(); if(CCCommonUtils::payParseData(params)) { auto ret = CCDictionary::create(); ret->setObject(CCInteger::create(status), "status"); ret->setObject(CCString::create(m_orderId), "orderId"); callSuccess(NetResult::createWithSuccess(ret)); } return true; }
bool UseSkillCommand::handleRecieve(cocos2d::CCDictionary *dict) { if (dict->valueForKey("cmd")->compare(USE_SKILL_COMMAND) != 0) return false; CCDictionary *params=_dict(dict->objectForKey("params")); if (!params) { return false; } const CCString *pStr = params->valueForKey("errorCode"); if (pStr->compare("")!=0) { CCCommonUtils::flyText(_lang(pStr->getCString())); callFail(NetResult::create()); }else{ map<std::string, SkillCDInfo*>::iterator it = GeneralManager::getInstance()->SkillCDMap.find(m_skillId); if(it != GeneralManager::getInstance()->SkillCDMap.end()){ it->second->parse(params); }else{ SkillCDInfo* cdInfo = SkillCDInfo::create(); cdInfo->parse(params); cdInfo->retain(); GeneralManager::getInstance()->SkillCDMap[m_skillId] = cdInfo; } auto effectState = _dict(params->objectForKey("effectState")); if(effectState){ if(effectState->objectForKey(CC_ITOA(LORD_SKILL_PROTECTED))){ auto protectTime = effectState->valueForKey(CC_ITOA(LORD_SKILL_PROTECTED))->doubleValue(); GlobalData::shared()->playerInfo.resourceProtectTimeStamp = protectTime; } } callSuccess(NetResult::create(Error_OK, params)); } return true; }
bool handleRecieve(cocos2d::CCDictionary *dict) { if (dict->valueForKey("cmd")->compare(DRAGON_BATTLE_PERSONAL_REWARD_COMMAND) != 0) return false; CCDictionary *params = _dict(dict->objectForKey("params")); if (params->objectForKey("errorCode")) { callFail(NetResult::createWithFail(params)); } else { callSuccess(NetResult::createWithSuccess(params)); } return true; }
void MainWindow::init() { QMenuBar *myMenuBar = menuBar(); QMenu *fileMenu = myMenuBar->addMenu("File"); QMenu *EditionMenu = myMenuBar->addMenu("Edition"); QMenu *helpMenu = myMenuBar->addMenu("Help"); myMenuBar->setObjectName("myMenuBar"); fileMenu->setObjectName("myFileMenu"); EditionMenu->setObjectName("myEditionMenu"); helpMenu->setObjectName("myHelpMenu"); _dockWidget = new QDockWidget; _dockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures | QDockWidget::DockWidgetMovable); _dockWidget->setVisible(false); _stackedWidget = new QStackedWidget; _accountInterface = AccountSingleton::getInstance(); _centralWidget = CentralWidgetSingleton::getInstance(); _dockWidgetContent = DockWidgetContentSingleton::getInstance(); _stackedWidget->addWidget(_accountInterface); _stackedWidget->addWidget(_centralWidget); setCentralWidget(_stackedWidget); _dockWidget->setWidget(_dockWidgetContent); _dockWidget->setMinimumSize(400, 600); addDockWidget(Qt::LeftDockWidgetArea, _dockWidget, Qt::Vertical); setWindowTitle("Babel Client"); setMinimumSize(800, 700); connect(ListenServerSingleton::getInstance(), SIGNAL(connected()), this, SLOT(switchOnConnectedState())); connect(ListenServerSingleton::getInstance(), SIGNAL(warningPopUp(QString const&,QString const&)), this, SLOT(showWarningPopUp(QString const&,QString const&))); connect(ListenServerSingleton::getInstance(), SIGNAL(successPopUp(QString const&,QString const&)), this, SLOT(showSuccessPopUp(QString const&,QString const&))); connect(ListenServerSingleton::getInstance(), SIGNAL(contactStatusChanged(QString,int)), _dockWidgetContent, SLOT(updateStatusForContact(QString,int))); connect(ListenServerSingleton::getInstance(), SIGNAL(callOccured(QString const &, unsigned int)), _centralWidget, SLOT(showCallPopUp(QString const &, unsigned int))); connect(ListenServerSingleton::getInstance(), SIGNAL(callFail()), _centralWidget, SLOT(showFailCall())); connect(ListenServerSingleton::getInstance(), SIGNAL(newContactToUpdateList(QString const &)), _dockWidgetContent, SLOT(addContactToUpdateList(QString const &))); connect(ListenServerSingleton::getInstance(), SIGNAL(textMessageChanged(QString const &)), _centralWidget, SLOT(updateTalkWindowText(QString const&))); connect(ListenServerSingleton::getInstance(), SIGNAL(hungUp(QString const &)), _centralWidget, SLOT(applyHangUp(QString const&))); connect(_dockWidgetContent, SIGNAL(called()), _centralWidget, SLOT(call())); }
bool FeedRewardCommand::handleRecieve(cocos2d::CCDictionary *dict) { if (dict->valueForKey("cmd")->compare(FEED_REWARD_COMMAND) != 0) return false; CCDictionary *params=_dict(dict->objectForKey("params")); if (!params) { return false; } const CCString *pStr = params->valueForKey("errorCode"); if (pStr->compare("")!=0) { callFail(NetResult::create()); }else{ callSuccess(NetResult::create(Error_OK, params)); } return true; }
bool GeAlliancetRankInfoCommand::handleRecieve(cocos2d::CCDictionary *dict) { if (dict->valueForKey("cmd")->compare(MS_GET_TOP_INFO) != 0) return false; CCDictionary *params=_dict(dict->objectForKey("params")); if (!params) { return false; } const CCString *pStr = params->valueForKey("errorCode"); if (pStr->compare("")!=0) { callFail(NetResult::create()); }else{ callSuccess(NetResult::create(Error_OK, params)); } return true; }
bool GetAllianceConRankCommand::handleRecieve(cocos2d::CCDictionary *dict) { if (dict->valueForKey("cmd")->compare(ACTIVITY_AL_RANK_CON_COMMAND) != 0) return false; CCDictionary *params=_dict(dict->objectForKey("params")); if (!params) { return false; } const CCString *pStr = params->valueForKey("errorCode"); if (pStr->compare("")!=0) { CCCommonUtils::flyText(pStr->getCString()); callFail(NetResult::create()); }else{ ActivityController::getInstance()->retAllianceConRank(params); } return true; }
bool CDkeyRewardCommand::handleRecieve(cocos2d::CCDictionary *dict) { if (dict->valueForKey("cmd")->compare(CDKEY_REWARD_CMD) != 0) return false; CCDictionary *params=_dict(dict->objectForKey("params")); if (!params) { return false; } const CCString *pStr = params->valueForKey("errorCode"); if (pStr->compare("")!=0) { CCCommonUtils::flyText(_lang(pStr->getCString())); callFail(NetResult::create()); }else{ callSuccess(NetResult::create(Error_OK, params)); } return true; }
bool FBMineHelpCommand::handleRecieve(cocos2d::CCDictionary *dict) { if (dict->valueForKey("cmd")->compare(FB_MINE_HELP) != 0) return false; CCDictionary *params=_dict(dict->objectForKey("params")); if (!params) { return false; } const CCString *pStr = params->valueForKey("errorCode"); if (pStr->compare("")!=0) { //CCCommonUtils::flyText(pStr->getCString()); callFail(NetResult::create()); }else{ callSuccess(NetResult::create(Error_OK, params)); } return true; }
bool KingdomOfficersCommand::handleRecieve(cocos2d::CCDictionary *dict) { if (dict->valueForKey("cmd")->compare(KINGDOM_OFFICERS) != 0) return false; CCDictionary *params=dynamic_cast<CCDictionary*> (dict->objectForKey("params")); if (!params) { return false; } const CCString *pStr = params->valueForKey("errorCode"); if (pStr->compare("")!=0) { //CCCommonUtils::flyText(pStr->getCString()); callFail(NetResult::create()); }else{ callSuccess(NetResult::create(Error_OK, params)); } return true; }
bool AllianceEventCommand::handleRecieve(cocos2d::CCDictionary *dict) { if (dict->valueForKey("cmd")->compare(ALLIANCE_AL_EVENT) != 0) return false; CCDictionary *params=dynamic_cast<CCDictionary*>(dict->objectForKey("params")); if (!params) { return false; } const CCString *pStr = params->valueForKey("errorCode"); if (pStr->compare("")!=0) { CCCommonUtils::flyText(pStr->getCString()); callFail(NetResult::create()); }else{ callSuccess(NetResult::create(Error_OK, params)); } return true; }
bool AllianceApplyInfoGetCommand::handleRecieve(cocos2d::CCDictionary *dict) { if (dict->valueForKey("cmd")->compare(ALLIANCE_APPLY_INFO_GET) != 0) return false; CCDictionary *params=_dict(dict->objectForKey("params")); if (!params) { return false; } GameController::getInstance()->removeWaitInterface(); const CCString *pStr = params->valueForKey("errorCode"); if (pStr->compare("")!=0) { CCCommonUtils::flyHint("", "", (_lang(pStr->getCString()).c_str())); callFail(NetResult::create(Error_OK, params)); }else{ callSuccess(NetResult::create(Error_OK, params)); } return true; }
bool KingdomKingChooseCommand::handleRecieve(cocos2d::CCDictionary *dict) { if (dict->valueForKey("cmd")->compare(KINGDOM_KING_CHOOSE) != 0) return false; CCDictionary *params=_dict(dict->objectForKey("params")); if (!params) { return false; } const CCString *pStr = params->valueForKey("errorCode"); if (pStr->compare("")!=0) { //CCCommonUtils::flyText(pStr->getCString()); CCLOG("errorCode = %s",pStr->getCString()); callFail(NetResult::create()); }else{ callSuccess(NetResult::create(Error_OK, params)); } GameController::getInstance()->removeWaitInterface(); return true; }
bool InviteRewardCommand::handleRecieve(cocos2d::CCDictionary *dict){ if(dict->valueForKey("cmd")->compare(INVITE_REWARD) != 0) { return false; } CCDictionary *params = _dict(dict->objectForKey("params")); if (!params) { return false; } if (params->objectForKey("errorCode")) { callFail(NetResult::createWithFail(params)); } else { callSuccess(NetResult::createWithSuccess(params)); } CCSafeNotificationCenter::sharedNotificationCenter()->postNotification(MSG_REFREASH_TOOL_DATA); return true; }
bool InviteInfoCommand::handleRecieve(cocos2d::CCDictionary *dict){ if(dict->valueForKey("cmd")->compare(INVITE_INFO) != 0) { return false; } CCDictionary *params = _dict(dict->objectForKey("params")); if (!params) { return false; } if (params->objectForKey("errorCode")) { callFail(NetResult::createWithFail(params)); } else { callSuccess(NetResult::createWithSuccess(params)); } return true; }
bool GeneralSkillSaveCommand::handleRecieve(cocos2d::CCDictionary *dict){ if (dict->valueForKey("cmd")->compare(GENERAL_SKILL_SAVE_COMMAND) != 0){ return false; } CCDictionary *params=_dict(dict->objectForKey("params")); const CCString *pStr = params->valueForKey("errorCode"); if (pStr->compare("")!=0) {; CCCommonUtils::flyText(_lang(pStr->getCString()).c_str()); if(m_flag){//单一的一次点存 GeneralManager::getInstance()->saveSkillFail(m_abilityId,m_skillId); CCSafeNotificationCenter::sharedNotificationCenter()->postNotification(SAVE_SKILL_FAIL,CCString::create(m_skillId)); } callFail(NetResult::create(Error_OK, params)); }else{ //todo CCSafeNotificationCenter::sharedNotificationCenter()->postNotification(SAVE_SKILL_SUCCESS,CCString::create(m_skillId)); callSuccess(NetResult::create(Error_OK, params)); } return true; }
bool ActivityEventCommand::handleRecieve(cocos2d::CCDictionary *dict) { if (dict->valueForKey("cmd")->compare(ACTIVITY_EVENT_COMMAND) != 0) return false; CCDictionary *params=_dict(dict->objectForKey("params")); if (!params) { return false; } const CCString *pStr = params->valueForKey("errorCode"); if (pStr->compare("")!=0) { CCCommonUtils::flyText(pStr->getCString()); callFail(NetResult::create()); }else{ auto scoreAct = _dict(params->objectForKey("scoreAct")); if(scoreAct){ ActivityController::getInstance()->updateCurrentEvent(scoreAct); } CCSafeNotificationCenter::sharedNotificationCenter()->postNotification(MSG_INIT_ACTIVITY_EVENT); callSuccess(NetResult::create(Error_OK, params)); } return true; }
bool AllianceApplylistCommand::handleRecieve(cocos2d::CCDictionary *dict) { if (dict->valueForKey("cmd")->compare(AL_APPLY_LIST) != 0) return false; CCDictionary *params=_dict(dict->objectForKey("params")); if (!params) { return false; } const CCString *pStr = params->valueForKey("errorCode"); if (pStr->compare("")!=0) { CCCommonUtils::flyText(_lang(pStr->getCString())); callFail(NetResult::create()); }else{ map<std::string, PlayerInfo*>::iterator it; AllianceManager::getInstance()->applyUserList.clear(); CCArray* arr = (CCArray*)params->objectForKey("list"); int num = arr->count(); for (int i=0; i<num; i++) { CCDictionary* dicPlayer = (CCDictionary*)arr->objectAtIndex(i); PlayerInfo* player = new PlayerInfo(); player->updateInfo(dicPlayer); AllianceManager::getInstance()->applyUserList[player->uid] = player; if(player->uid==GlobalData::shared()->playerInfo.uid){ if(dicPlayer->objectForKey("relinquishEndTime")){ GlobalData::shared()->playerInfo.relinquishEndTime = dicPlayer->valueForKey("relinquishEndTime")->doubleValue(); } if(dicPlayer->objectForKey("officer")){ GlobalData::shared()->playerInfo.officer = dicPlayer->valueForKey("officer")->getCString(); } } } callSuccess(NetResult::create(Error_OK, params)); } return true; }
bool BuyCityDefCommand::handleRecieve(cocos2d::CCDictionary *dict) { if (dict->valueForKey("cmd")->compare(BUY_CITY_DEF) != 0) return false; CCDictionary *params=_dict(dict->objectForKey("params")); if (!params) { return false; } const CCString *pStr = params->valueForKey("errorCode"); if (pStr->compare("")!=0) { CCCommonUtils::flyText(pStr->getCString()); callFail(NetResult::create()); }else{ if(params->objectForKey("remainGold")){ int gold = params->valueForKey("remainGold")->intValue(); GlobalData::shared()->playerInfo.gold = gold; CCSafeNotificationCenter::sharedNotificationCenter()->postNotification(MSG_CITY_RESOURCES_UPDATE); } callSuccess(NetResult::create(Error_OK, params)); } GameController::getInstance()->removeWaitInterface(); return true; }