bool luaval_to_tdga_map(lua_State* L,int lo,EventParamMap* outValue) { if (NULL == L || NULL == outValue) return false; bool ok = true; tolua_Error tolua_err; if (!tolua_istable(L,lo,0,&tolua_err)) { #if COCOS2D_DEBUG >=1 luaval_to_native_err(L,"#ferror:",&tolua_err); #endif ok = false; } if (ok) { lua_pushnil(L); while (lua_next(L, lo)) { lua_pushvalue(L, -2); const char* key = lua_tostring(L, -1); const char* value = lua_tostring(L, -2); (*outValue).insert(EventParamPair(key, value)); lua_pop(L, 2); } } return ok; }
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); } }