local PluginConfig = require("preload.PluginConfig") require("preload.Plugin") local PluginUmeng local PluginUmengParams function umengInit() local romSetting = loadRomSettingScript(); if romSetting and romSetting.ChannelId == 105 then print("umengInit(), return by channelid == 105") return end local targetPlatform = cc.Application:getInstance():getTargetPlatform(); if targetPlatform == 3 then PluginUmeng = cc.PluginManager:getInstance():createPlugin("PluginUmeng" , "com/ddgame/plugin/PluginUmeng"); PluginUmengParams = { UMengKey = PluginConfig.Umeng.appKeyAndroid, ChannelId = tostring(romSetting.ChannelId), }; elseif targetPlatform == 4 or targetPlatform == 5 then PluginUmeng = cc.PluginManager:getInstance():createPlugin("PluginUmeng" , "PluginUmeng"); PluginUmengParams = { UMengKey = PluginConfig.Umeng.appKeyIos, ChannelId = tostring(romSetting.ChannelId), }; end if PluginUmeng and PluginUmengParams then PluginUmeng:callVoid("initPlugin" , PluginUmengParams); end end function umengLogin(userId) print("PluginUmeng::umengLogin()", userId) if PluginUmeng then PluginUmeng:callVoid("login",tostring(userId)) end end function umengLogout() print("PluginUmeng::umengLogout()") if PluginUmeng then PluginUmeng:callVoid("logout") end end function umengPostEvent(eventId, eventKey) print("PluginUmeng::umengPostEvent()", eventId, eventKey) if PluginUmeng then local tt = { eventId = eventId, eventKey = eventKey, } PluginUmeng:callVoid("postEvent", tt); end end function umengPostEventObject(eventId, eventKey, eventValue) print("PluginUmeng::umengPostEventObject()",eventId, key, value) if PluginUmeng then local tt = { eventId = eventId, eventKey = eventKey, eventValue = eventValue, } PluginUmeng:callVoid("postEventObject", tt); end end