PGRData/Script/matrix/xcommon/XAnalyticsEvent.lua

35 lines
914 B
Lua

--==============================--
-- 通用数据收集事件
--==============================--
XAnalyticsEvent = XAnalyticsEvent or {}
local OnRoleCreate = function()
if XUserManager.IsUseSdk() then
XHeroSdkManager.CreateNewRole()
end
end
local OnLogin = function()
if XUserManager.IsUseSdk() then
XHeroSdkManager.EnterGame()
end
CS.BuglyAgent.SetUserId(tostring(XPlayer.Id))
end
local OnLevelUp = function()
if XUserManager.IsUseSdk() then
XHeroSdkManager.RoleLevelUp()
end
end
local OnLogout = function()
end
function XAnalyticsEvent.Init()
XEventManager.AddEventListener(XEventId.EVENT_NEW_PLAYER, OnRoleCreate)
XEventManager.AddEventListener(XEventId.EVENT_LOGIN_SUCCESS, OnLogin)
XEventManager.AddEventListener(XEventId.EVENT_PLAYER_LEVEL_CHANGE, OnLevelUp)
XEventManager.AddEventListener(XEventId.EVENT_USER_LOGOUT, OnLogout)
end