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

60 lines
3.7 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 IsSDKLogin = AppConst.isSDKLogin
local FBSDKCustomEvents = {
[1] = {id = 1, info = 1,FBSDKCustomEventType = 1,event = "Registration",data = "用户完成注册或使用第三方渠道首次登陆"},
[2] = {id = 2, info = 2,FBSDKCustomEventType = 1,event = "Next day login",data = "次日登陆,即 次留"},
[3] = {id = 3, info = 3,FBSDKCustomEventType = 1,event = "3rd day login",data = "3留" },
[4] = {id = 4, info = 7,FBSDKCustomEventType = 1,event = "7th day login",data = "7留" },
[5] = {id = 5, info = 2,FBSDKCustomEventType = 2,event = "特权等级 2",data = "特权等级达到2" },
[6] = {id = 6, info = 4,FBSDKCustomEventType = 2,event = "特权等级 4",data = "特权等级达到4" },
[7] = {id = 7, info = 6,FBSDKCustomEventType = 2,event = "特权等级 6",data = "特权等级达到6" },
[8] = {id = 8, info = 8,FBSDKCustomEventType = 2,event = "特权等级 8",data = "特权等级达到8" },
[9] = {id = 9, info = 10,FBSDKCustomEventType = 2,event = "特权等级 10",data = "特权等级达到10" },
[10] = {id = 10, info = 13,FBSDKCustomEventType = 2,event = "特权等级 13",data = "特权等级达到13"},
[11] = {id = 11, info = 0,FBSDKCustomEventType = 3,event = "New role tutorial",data = "完成新手指引"},
[12] = {id = 12, info = 10,FBSDKCustomEventType = 4,event = "Levels achieved",data = "角色等级10"},
[13] = {id = 13, info = 20,FBSDKCustomEventType = 4,event = "Lv. 20",data = "角色等级20" },
[14] = {id = 14, info = 40,FBSDKCustomEventType = 4,event = "Lv. 40",data = "角色等级40"},
[15] = {id = 15, info = 80,FBSDKCustomEventType = 4,event = "Lv. 80",data = "角色等级80" },
[16] = {id = 16, info = 100,FBSDKCustomEventType = 4,event = "Lv. 100",data = "角色等级100" },
[17] = {id = 17, info = 0,FBSDKCustomEventType = 5,event = "Monthly card",data = "首次购买普通月卡" },
[18] = {id = 18, info = 0,FBSDKCustomEventType = 6,event = "Supreme card",data = "首次购买豪华月卡" },
[19] = {id = 19, info = 0,FBSDKCustomEventType = 7,event = "First topup",data = "完成首次充值" },
}
function this.SetisFirstLogVal(isDayFirst)
if isDayFirst == 0 then--今天第一次登陆
LogGreen("埋点上报数据 "..CalculateSecondsNowTo_N_OClock(24).." "..GetTimeStamp().." "..PlayerManager.userCreateTime)
local cur24Times = CalculateSecondsNowTo_N_OClock(24) + 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)
local index = 0
for i = 1, #FBSDKCustomEvents do
local curFBSDKCustomEvents = FBSDKCustomEvents[i]
-- LogGreen("埋点上报数据1 "..curFBSDKCustomEvents.event.." "..curFBSDKCustomEvents.data.." "..CustomType.." "..info)
if CustomType == curFBSDKCustomEvents.FBSDKCustomEventType and info == curFBSDKCustomEvents.info then
-- LogGreen("埋点上报数据2 "..curFBSDKCustomEvents.id)
index = curFBSDKCustomEvents.id
break
end
end
if index > 0 then
LogGreen("埋点上报数据 成功 "..FBSDKCustomEvents[index].event.." "..FBSDKCustomEvents[index].data)
this.SendCustomEvent(FBSDKCustomEvents[index].event,FBSDKCustomEvents[index].data)
end
end
-- 打点事件
function this.SendCustomEvent(event, data)
if IsSDKLogin then
SDKMgr:CustomEvent(event,data)
end
end
return CustomEventManager