void onInitialized(bool ok) { LuaStack* stack = LUAENGINE->getLuaStack(); LuaValueDict dict; dict.insert(std::make_pair("event", LuaValue::stringValue("onInitialized"))); dict.insert(std::make_pair("ok", LuaValue::booleanValue(ok))); stack->pushLuaValueDict(dict); stack->executeFunctionByHandler(mLuaHandler, 1); }
void onChartboostReward(const std::string& name, int reward) { LuaStack* stack = LUAENGINE->getLuaStack(); LuaValueDict dict; dict.insert(std::make_pair("func", LuaValue::stringValue("onChartboostReward"))); dict.insert(std::make_pair("name", LuaValue::stringValue(name))); dict.insert(std::make_pair("reward", LuaValue::intValue(reward))); stack->pushLuaValueDict(dict); stack->executeFunctionByHandler(mLuaHandler, 1); }
void onChartboostFailToRecordClick(const std::string& name, sdkbox::CB_ClickError e) { LuaStack* stack = LUAENGINE->getLuaStack(); LuaValueDict dict; dict.insert(std::make_pair("func", LuaValue::stringValue("onChartboostFailToRecordClick"))); dict.insert(std::make_pair("name", LuaValue::stringValue(name))); dict.insert(std::make_pair("e", LuaValue::intValue(e))); stack->pushLuaValueDict(dict); stack->executeFunctionByHandler(mLuaHandler, 1); }
void onRestored(const sdkbox::Product& p) { LuaStack* stack = LUAENGINE->getLuaStack(); LuaValueDict dict; dict.insert(std::make_pair("event", LuaValue::stringValue("onRestored"))); dict.insert(std::make_pair("product", prouct2LuaValue(p))); stack->pushLuaValueDict(dict); stack->executeFunctionByHandler(mLuaHandler, 1); }
static sdkbox::FBAPIParam luaValueMap_to_APIParam(const LuaValueDict &dict) { sdkbox::FBAPIParam param; for (LuaValueDictIterator it = dict.begin(); it != dict.end(); it++) { param[it->first] = it->second.stringValue(); } return param; }
virtual void onReveal( const std::string& reveal_name) { LuaStack* stack = LUAENGINE->getLuaStack(); LuaValueDict dict; dict.insert(std::make_pair("name", LuaValue::stringValue("onReveal"))); dict.insert(std::make_pair("reveal_name", LuaValue::stringValue(reveal_name))); stack->pushLuaValueDict(dict); stack->executeFunctionByHandler(mLuaHandler, 1); }
virtual void onConnectionStatusChanged( int status ) { LuaStack* stack = LUAENGINE->getLuaStack(); LuaValueDict dict; dict.insert(std::make_pair("name", LuaValue::stringValue("onConnectionStatusChanged"))); dict.insert(std::make_pair("status", LuaValue::intValue((int)status))); stack->pushLuaValueDict(dict); stack->executeFunctionByHandler(mLuaHandler, 1); }
static LuaValue FBGraphUserToLua( const sdkbox::FBGraphUser& u ) { LuaValueDict d; for( std::pair<std::string, std::string> _p : u.getFields() ) { d.insert( std::make_pair(_p.first, LuaValue::stringValue(_p.second) ) ); } return LuaValue::dictValue(d); }
void onProductRequestFailure(const std::string& msg) { LuaStack* stack = LUAENGINE->getLuaStack(); LuaValueDict dict; dict.insert(std::make_pair("event", LuaValue::stringValue("onProductRequestFailure"))); dict.insert(std::make_pair("msg", LuaValue::stringValue(msg))); stack->pushLuaValueDict(dict); stack->executeFunctionByHandler(mLuaHandler, 1); }
void onProductRequestSuccess(const std::vector<sdkbox::Product>& products) { LuaStack* stack = LUAENGINE->getLuaStack(); LuaValueDict dict; dict.insert(std::make_pair("event", LuaValue::stringValue("onProductRequestSuccess"))); dict.insert(std::make_pair("products", proucts2LuaValue(products))); stack->pushLuaValueDict(dict); stack->executeFunctionByHandler(mLuaHandler, 1); }
void onSharedCancel() { LuaStack* stack = LUAENGINE->getLuaStack(); LuaValueDict dict; dict.insert(std::make_pair("name", LuaValue::stringValue("onSharedCancel"))); dict.insert(std::make_pair("data", LuaValue::stringValue("{}"))); stack->pushLuaValueDict(dict); stack->executeFunctionByHandler(mLuaHandler, 1); }
void onSharedFailed(const std::string& message) { LuaStack* stack = LUAENGINE->getLuaStack(); LuaValueDict dict; dict.insert(std::make_pair("name", LuaValue::stringValue("onSharedFailed"))); dict.insert(std::make_pair("data", LuaValue::stringValue(message))); stack->pushLuaValueDict(dict); stack->executeFunctionByHandler(mLuaHandler, 1); }
void onGetUserInfo( const sdkbox::FBGraphUser& user ) { LuaStack* stack = LUAENGINE->getLuaStack(); LuaValueDict dict; dict.insert(std::make_pair("name", LuaValue::stringValue("onGetUserInfo"))); dict.insert(std::make_pair("data", FBGraphUserToLua(user))); stack->pushLuaValueDict(dict); stack->executeFunctionByHandler(mLuaHandler, 1); }
void onPlayEnds(bool played_ok) { LuaStack* stack = LUAENGINE->getLuaStack(); LuaValueDict dict; dict.insert(std::make_pair("name", LuaValue::stringValue("onPlayEnds"))); dict.insert(std::make_pair("played_ok", LuaValue::booleanValue(played_ok))); stack->pushLuaValueDict(dict); stack->executeFunctionByHandler(mLuaHandler, 1); }
void LuaStack::pushLuaValueDict(const LuaValueDict& dict) { lua_newtable(_state); /* L: table */ for (LuaValueDictIterator it = dict.begin(); it != dict.end(); ++it) { lua_pushstring(_state, it->first.c_str()); /* L: table key */ pushLuaValue(it->second); /* L: table key value */ lua_rawset(_state, -3); /* table.key = value, L: table */ } }
virtual void onSetSteps( const std::string& step_name, double steps ) { LuaStack* stack = LUAENGINE->getLuaStack(); LuaValueDict dict; dict.insert(std::make_pair("name", LuaValue::stringValue("onSetSteps"))); dict.insert(std::make_pair("step_name", LuaValue::stringValue(step_name))); dict.insert(std::make_pair("steps", LuaValue::floatValue(steps))); stack->pushLuaValueDict(dict); stack->executeFunctionByHandler(mLuaHandler, 1); }
void invokeLuaHandler(const char* func, const char* name) { LuaStack* stack = LUAENGINE->getLuaStack(); LuaValueDict dict; dict.insert(std::make_pair("func", LuaValue::stringValue(func))); if (nullptr != name) { dict.insert(std::make_pair("name", LuaValue::stringValue(name))); } stack->pushLuaValueDict(dict); stack->executeFunctionByHandler(mLuaHandler, 1); }
void onCloseInterstitial(const char *placement) { LuaStack* stack = LUAENGINE->getLuaStack(); LuaValueDict dict; dict.insert(std::make_pair("event", LuaValue::stringValue("onCloseInterstitial"))); dict.insert(std::make_pair("placement", LuaValue::stringValue(placement))); stack->pushLuaValueDict(dict); stack->executeFunctionByHandler(mLuaHandler, 1); }
virtual void onSaveGameData(bool success, const std::string& error) { LuaStack* stack = LUAENGINE->getLuaStack(); LuaValueDict dict; dict.insert(std::make_pair("name", LuaValue::stringValue("onSaveGameData"))); dict.insert(std::make_pair("success", LuaValue::booleanValue(success))); dict.insert(std::make_pair("error", LuaValue::stringValue(error))); stack->pushLuaValueDict(dict); stack->executeFunctionByHandler(mLuaHandler, 1); }
virtual void onIncrementalAchievementUnlocked( const std::string& achievement_name ) { LuaStack* stack = LUAENGINE->getLuaStack(); LuaValueDict dict; dict.insert(std::make_pair("name", LuaValue::stringValue("onIncrementalAchievementUnlocked"))); dict.insert(std::make_pair("achievement_name", LuaValue::stringValue(achievement_name))); stack->pushLuaValueDict(dict); stack->executeFunctionByHandler(mLuaHandler, 1); }
virtual void onAchievementsLoaded( bool reload_forced, const std::string& json_achievements_info ) { LuaStack* stack = LUAENGINE->getLuaStack(); LuaValueDict dict; dict.insert(std::make_pair("name", LuaValue::stringValue("onAchievementsLoaded"))); dict.insert(std::make_pair("reload_forced", LuaValue::booleanValue(reload_forced))); dict.insert(std::make_pair("json_achievements_info", LuaValue::stringValue(json_achievements_info))); stack->pushLuaValueDict(dict); stack->executeFunctionByHandler(mLuaHandler, 1); }
void onRequestOpenURL(const char *placement, const char *URL) { LuaStack* stack = LUAENGINE->getLuaStack(); LuaValueDict dict; dict.insert(std::make_pair("event", LuaValue::stringValue("onRequestOpenURL"))); dict.insert(std::make_pair("placement", LuaValue::stringValue(placement))); dict.insert(std::make_pair("URL", LuaValue::stringValue(URL))); stack->pushLuaValueDict(dict); stack->executeFunctionByHandler(mLuaHandler, 1); }
void onInviteFriendsWithInviteIdsResult(bool ok, const std::string& msg) { LuaStack* stack = LUAENGINE->getLuaStack(); LuaValueDict dict; dict.insert(std::make_pair("name", LuaValue::stringValue("onInviteFriendsWithInviteIdsResult"))); dict.insert(std::make_pair("ok", LuaValue::booleanValue(ok))); dict.insert(std::make_pair("data", LuaValue::stringValue(msg))); stack->pushLuaValueDict(dict); stack->executeFunctionByHandler(mLuaHandler, 1); }
virtual void onRevealError( const std::string& reveal_name, int error_code, const std::string& error_description ) { LuaStack* stack = LUAENGINE->getLuaStack(); LuaValueDict dict; dict.insert(std::make_pair("name", LuaValue::stringValue("onRevealError"))); dict.insert(std::make_pair("reveal_name", LuaValue::stringValue(reveal_name))); dict.insert(std::make_pair("error_code", LuaValue::intValue(error_code))); dict.insert(std::make_pair("error_description", LuaValue::stringValue(error_description))); stack->pushLuaValueDict(dict); stack->executeFunctionByHandler(mLuaHandler, 1); }
void onLogin(bool isLogin, const std::string& error) { LuaStack* stack = LUAENGINE->getLuaStack(); LuaValueDict dict; dict.insert(std::make_pair("name", LuaValue::stringValue("onLogin"))); dict.insert(std::make_pair("isLoggedIn", LuaValue::booleanValue(isLogin))); dict.insert(std::make_pair("data", LuaValue::stringValue(error))); stack->pushLuaValueDict(dict); stack->executeFunctionByHandler(mLuaHandler, 1); }
virtual void onAchievementUnlockError( const std::string& achievement_name, int error_code, const std::string& error_description ) { LuaStack* stack = LUAENGINE->getLuaStack(); LuaValueDict dict; dict.insert(std::make_pair("name", LuaValue::stringValue(__FUNCTION__))); dict.insert(std::make_pair("achievement_name", LuaValue::stringValue(achievement_name))); dict.insert(std::make_pair("error_code", LuaValue::intValue(error_code))); dict.insert(std::make_pair("error_description", LuaValue::stringValue(error_description))); stack->pushLuaValueDict(dict); stack->executeFunctionByHandler(mLuaHandler, 1); }
virtual void onAdAction( const std::string& ad_unit_id, const std::string& zone_place_location, sdkbox::AdActionType action_type) { LuaStack* stack = LUAENGINE->getLuaStack(); LuaValueDict dict; dict.insert(std::make_pair("name", LuaValue::stringValue("onAdAction"))); dict.insert(std::make_pair("ad_unit_id", LuaValue::stringValue(ad_unit_id))); dict.insert(std::make_pair("ad_name", LuaValue::stringValue(zone_place_location))); dict.insert(std::make_pair("ad_action_type", LuaValue::intValue((int)action_type))); stack->pushLuaValueDict(dict); stack->executeFunctionByHandler(mLuaHandler, 1); }
void onAPI(const std::string& tag, const std::string& jsonData) { LuaStack* stack = LUAENGINE->getLuaStack(); LuaValueDict dict; dict.insert(std::make_pair("name", LuaValue::stringValue("onAPI"))); dict.insert(std::make_pair("tag", LuaValue::stringValue(tag))); dict.insert(std::make_pair("data", LuaValue::stringValue(jsonData))); stack->pushLuaValueDict(dict); stack->executeFunctionByHandler(mLuaHandler, 1); }
void onRestoreComplete(bool ok, const std::string& msg) { LuaStack* stack = LUAENGINE->getLuaStack(); LuaValueDict dict; dict.insert(std::make_pair("event", LuaValue::stringValue("onRestoreComplete"))); dict.insert(std::make_pair("ok", LuaValue::booleanValue(ok))); dict.insert(std::make_pair("msg", LuaValue::stringValue(msg))); stack->pushLuaValueDict(dict); stack->executeFunctionByHandler(mLuaHandler, 1); }
virtual void onRewardAction( const std::string& ad_unit_id, const std::string& zone_place_location, float reward_amount, bool reward_succeed) { LuaStack* stack = LUAENGINE->getLuaStack(); LuaValueDict dict; dict.insert(std::make_pair("name", LuaValue::stringValue("onRewardAction"))); dict.insert(std::make_pair("ad_unit_id", LuaValue::stringValue(ad_unit_id))); dict.insert(std::make_pair("ad_name", LuaValue::stringValue(zone_place_location))); dict.insert(std::make_pair("reward_amount", LuaValue::floatValue(reward_amount))); dict.insert(std::make_pair("reward_succeed", LuaValue::booleanValue(reward_succeed))); stack->pushLuaValueDict(dict); stack->executeFunctionByHandler(mLuaHandler, 1); }