miduo_client/Assets/ManagedResources/~Lua/Modules/DataCenterService/CustomEventManager.lua

40 lines
1.6 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

CustomEventManager = {}
local this = CustomEventManager
local customEventConfig = ConfigManager.GetConfig(ConfigName.CustomEventConfig)
function this.SetisFirstLogVal(isDayFirst)
if isDayFirst == 0 then--今天第一次登陆
-- --LogGreen("埋点上报数据 "..CalculateSecondsNowTo_N_OClock(24).." "..GetTimeStamp().." "..PlayerManager.userCreateTime)
local cur24Times = CalculateSecondsNowTo_N_OClock(0) + GetTimeStamp()
local day = math.floor((cur24Times - PlayerManager.userCreateTime)/86400) + 1
-- --LogGreen("day "..day)
--发送埋点数据
this.SendCustomEvents(FBSDKCustomEventType.LoginNum,day)
end
end
function this.SendCustomEvents(CustomType,info)
--LogGreen("埋点上报数据 SendCustomEvents "..CustomType)
if not AppConst.isSDKLogin then return end
local curConfigData = nil
info = tonumber(info)
for _, configInfo in ConfigPairs(customEventConfig) do
if CustomType == configInfo.CustomEventType and (configInfo.value == "0" or info == tonumber(configInfo.value)) then
curConfigData = configInfo
if curConfigData then
local field = PackageManager.GetCustomEventField()
if field and curConfigData[field] and curConfigData[field] ~= "" then
this.SendCustomEvent(curConfigData[field], curConfigData.Info, curConfigData.type)
end
end
end
end
end
-- 打点事件
function this.SendCustomEvent(event, data,type)
if AppConst.isSDKLogin then
SDKMgr:CustomEvent(event,data,type)
end
end
return CustomEventManager