void VirtualCurrencyLayer::eventMenuCallback(CCObject* pSender) { CCMenuItemLabel* pMenuItem = (CCMenuItemLabel*)pSender; int i = pMenuItem->getTag(); EventParamMap paramMap; pthread_t thread; switch (i) { case ONREQUEST: TDCCVirtualCurrency::onChargeRequest("o_1", "iap", 10, "CN", 20, "T1"); break; case ONSUCCESS: pthread_create(&thread, NULL, runThread, NULL); break; case ONREWARD: TDCCVirtualCurrency::onReward(100, "reason"); break; case ONEVENT: paramMap.insert(EventParamPair("type", "popular")); paramMap.insert(EventParamPair("artist", "JJLin")); paramMap["aa"] = "bb"; TDCCTalkingDataGA::onEvent("music", ¶mMap); break; default: break; } }
void chargeInfoLayer::payCallBack() { if(CPersonalData::getInstance()->getChargeSucess()) { log("支付回调,保存魔法石"); CPersonalData::getInstance()->setChargeSucess(false); //保存魔法师数量到本地服务器 log("保存数据库%d", m_stoneNum); CPersonalData::getInstance()->setUserStone(CPersonalData::getInstance()->getUserStone() + m_stoneNum); char buf[256]; sprintf(buf, "%d", m_stoneNum); std::string tempStr = "购买成功!\n"; tempStr += "获得"; tempStr += buf; tempStr += "宝石"; /*Label* pLabel = Label::createWithSystemFont(tempStr.c_str(), "Arial", 35); addChild(pLabel, 100); pLabel->setPosition(Vec2(m_winSize.width * 0.5f, m_winSize.height * 0.5f)); pLabel->setScaleX(0); pLabel->runAction(Sequence::create(ScaleTo::create(0.5, 1, 1), DelayTime::create(1.0f), ScaleTo::create(0.5, 1, 0), RemoveSelf::create(), NULL));*/ Sprite * thetarget = CFightManager::getTheFlyWord(tempStr,"fonts/cuti.ttf"); thetarget->setPosition(Vec2(m_winSize.width / 2, m_winSize.height / 2)); addChild(thetarget, 100); m_chargeNum = m_tempValue; log("支付回调talkData"); __String* tempStr1 = __String::createWithFormat("%d", m_stoneNum); EventParamMap paramMap; paramMap.insert(EventParamPair("购买魔法石",tempStr1->getCString())); TDCCTalkingDataGA::onEvent("充值界面", ¶mMap); //showGoodsInfo(); removeFromParent(); } else{ /*Label* pLabel = Label::createWithSystemFont("购买失败咯!", "Arial", 35); addChild(pLabel, 100); pLabel->setPosition(Vec2(m_winSize.width * 0.5f, m_winSize.height * 0.5f)); pLabel->setScaleX(0); pLabel->runAction(Sequence::create(ScaleTo::create(0.5, 1, 1), DelayTime::create(1.0f), ScaleTo::create(0.3, 1, 0), RemoveSelf::create(), NULL));*/ Sprite * thetarget = CFightManager::getTheFlyWord("购买失败哟!","fonts/cuti.ttf"); thetarget->setPosition(Vec2(m_winSize.width / 2, m_winSize.height / 2)); addChild(thetarget, 100); } }