优化一下性能
This commit is contained in:
parent
ed400f1b75
commit
a2ca40f00c
@ -445,7 +445,8 @@ function BIReport:postAdEvent()
|
|||||||
end
|
end
|
||||||
CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_AdRewardAD", json.encode({}))
|
CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_AdRewardAD", json.encode({}))
|
||||||
CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_AdRewardAD", json.encode({}))
|
CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_AdRewardAD", json.encode({}))
|
||||||
local afPostAdCount = {
|
if not self.afPostAdCount then
|
||||||
|
self.afPostAdCount = {
|
||||||
[2] = true,
|
[2] = true,
|
||||||
[3] = true,
|
[3] = true,
|
||||||
[5] = true,
|
[5] = true,
|
||||||
@ -454,19 +455,24 @@ function BIReport:postAdEvent()
|
|||||||
[40] = true,
|
[40] = true,
|
||||||
[80] = true,
|
[80] = true,
|
||||||
}
|
}
|
||||||
if afPostAdCount[adCount] then
|
end
|
||||||
|
|
||||||
|
if self.afPostAdCount[adCount] then
|
||||||
local args = {}
|
local args = {}
|
||||||
CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_AdRewardAD_" .. adCount, json.encode(args))
|
CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_AdRewardAD_" .. adCount, json.encode(args))
|
||||||
end
|
end
|
||||||
|
|
||||||
local fbPostAdCount = {
|
if not self.fbPostAdCount then
|
||||||
|
self.fbPostAdCount = {
|
||||||
[2] = true,
|
[2] = true,
|
||||||
[3] = true,
|
[3] = true,
|
||||||
[5] = true,
|
[5] = true,
|
||||||
[10] = true,
|
[10] = true,
|
||||||
[20] = true,
|
[20] = true,
|
||||||
}
|
}
|
||||||
if fbPostAdCount[adCount] then
|
end
|
||||||
|
|
||||||
|
if self.fbPostAdCount[adCount] then
|
||||||
local args = {}
|
local args = {}
|
||||||
CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_AdRewardAD_" .. adCount, json.encode(args))
|
CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_AdRewardAD_" .. adCount, json.encode(args))
|
||||||
end
|
end
|
||||||
@ -487,7 +493,8 @@ function BIReport:postChapterEvent(chapter)
|
|||||||
end
|
end
|
||||||
CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_Level", json.encode({}))
|
CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_Level", json.encode({}))
|
||||||
CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_Level", json.encode({}))
|
CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_Level", json.encode({}))
|
||||||
local postChapter = {
|
if not self.afPostChapter then
|
||||||
|
self.afPostChapter = {
|
||||||
[1] = true,
|
[1] = true,
|
||||||
[2] = true,
|
[2] = true,
|
||||||
[3] = true,
|
[3] = true,
|
||||||
@ -512,12 +519,14 @@ function BIReport:postChapterEvent(chapter)
|
|||||||
[40] = true,
|
[40] = true,
|
||||||
[50] = true,
|
[50] = true,
|
||||||
}
|
}
|
||||||
if postChapter[chapter] then
|
end
|
||||||
|
if self.afPostChapter[chapter] then
|
||||||
local args = {}
|
local args = {}
|
||||||
CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_Chapter_" .. chapter, json.encode(args))
|
CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_Chapter_" .. chapter, json.encode(args))
|
||||||
end
|
end
|
||||||
|
|
||||||
local fbPostChapter = {
|
if not self.fbPostChapter then
|
||||||
|
self.fbPostChapter = {
|
||||||
[1] = true,
|
[1] = true,
|
||||||
[2] = true,
|
[2] = true,
|
||||||
[3] = true,
|
[3] = true,
|
||||||
@ -534,8 +543,9 @@ function BIReport:postChapterEvent(chapter)
|
|||||||
[40] = true,
|
[40] = true,
|
||||||
[50] = true,
|
[50] = true,
|
||||||
}
|
}
|
||||||
|
end
|
||||||
|
|
||||||
if fbPostChapter[chapter] then
|
if self.fbPostChapter[chapter] then
|
||||||
local args = {}
|
local args = {}
|
||||||
CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_Chapter_" .. chapter, json.encode(args))
|
CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_Chapter_" .. chapter, json.encode(args))
|
||||||
end
|
end
|
||||||
@ -551,7 +561,8 @@ function BIReport:postFirstGetHero(num)
|
|||||||
if CS.BF.BFMain.IsShenhe or CS.BF.BFMain.IsWhite then
|
if CS.BF.BFMain.IsShenhe or CS.BF.BFMain.IsWhite then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local postHeroNum = {
|
if not self.postHeroNum then
|
||||||
|
self.postHeroNum = {
|
||||||
[4] = true,
|
[4] = true,
|
||||||
[6] = true,
|
[6] = true,
|
||||||
[8] = true,
|
[8] = true,
|
||||||
@ -562,7 +573,9 @@ function BIReport:postFirstGetHero(num)
|
|||||||
[18] = true,
|
[18] = true,
|
||||||
[20] = true,
|
[20] = true,
|
||||||
}
|
}
|
||||||
if not postHeroNum[num] then
|
end
|
||||||
|
|
||||||
|
if not self.postHeroNum[num] then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local args = {}
|
local args = {}
|
||||||
@ -582,15 +595,18 @@ function BIReport:postHeroLev(beforeLv, lv)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local allHeroes = DataManager.HeroData:getAllHeroes()
|
local allHeroes = DataManager.HeroData:getAllHeroes()
|
||||||
local postHeroLevel = {
|
if not self.postHeroLevel then
|
||||||
|
self.postHeroLevel = {
|
||||||
[3] = true,
|
[3] = true,
|
||||||
[5] = true,
|
[5] = true,
|
||||||
[7] = true,
|
[7] = true,
|
||||||
[9] = true
|
[9] = true
|
||||||
}
|
}
|
||||||
|
end
|
||||||
|
|
||||||
local temp = {}
|
local temp = {}
|
||||||
for heroid, heroEntity in pairs(allHeroes) do
|
for heroid, heroEntity in pairs(allHeroes) do
|
||||||
for heroLv, _ in pairs(postHeroLevel) do
|
for heroLv, _ in pairs(self.postHeroLevel) do
|
||||||
if heroEntity:getLv() >= heroLv then
|
if heroEntity:getLv() >= heroLv then
|
||||||
temp[heroLv] = (temp[heroLv] or 0) + 1
|
temp[heroLv] = (temp[heroLv] or 0) + 1
|
||||||
end
|
end
|
||||||
@ -618,7 +634,8 @@ function BIReport:postLvEvent(beforeLv, nowLv)
|
|||||||
if not nowLv then
|
if not nowLv then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local postLV = {
|
if not self.postLV then
|
||||||
|
self.postLV = {
|
||||||
[1] = true,
|
[1] = true,
|
||||||
[2] = true,
|
[2] = true,
|
||||||
[3] = true,
|
[3] = true,
|
||||||
@ -633,10 +650,12 @@ function BIReport:postLvEvent(beforeLv, nowLv)
|
|||||||
[70] = true,
|
[70] = true,
|
||||||
[80] = true,
|
[80] = true,
|
||||||
}
|
}
|
||||||
|
end
|
||||||
|
|
||||||
-- CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_grade", json.encode({}))
|
-- CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_grade", json.encode({}))
|
||||||
-- CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_grade", json.encode({}))
|
-- CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_grade", json.encode({}))
|
||||||
local reportLv
|
local reportLv
|
||||||
for lv, _ in pairs(postLV) do
|
for lv, _ in pairs(self.postLV) do
|
||||||
if beforeLv < lv and nowLv >= lv then
|
if beforeLv < lv and nowLv >= lv then
|
||||||
reportLv = lv
|
reportLv = lv
|
||||||
break
|
break
|
||||||
@ -660,7 +679,8 @@ function BIReport:postFirstRechargeEvent(id)
|
|||||||
if CS.BF.BFMain.IsShenhe or CS.BF.BFMain.IsWhite then
|
if CS.BF.BFMain.IsShenhe or CS.BF.BFMain.IsWhite then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local postRechargeID = {
|
if not self.postRechargeID then
|
||||||
|
self.postRechargeID = {
|
||||||
[1] = false, -- 0.99
|
[1] = false, -- 0.99
|
||||||
[2] = false, -- 1.99
|
[2] = false, -- 1.99
|
||||||
[3] = true, -- 2.99
|
[3] = true, -- 2.99
|
||||||
@ -681,7 +701,9 @@ function BIReport:postFirstRechargeEvent(id)
|
|||||||
[18] = false, -- 99.99
|
[18] = false, -- 99.99
|
||||||
[19] = false, -- 199.99
|
[19] = false, -- 199.99
|
||||||
}
|
}
|
||||||
if not postRechargeID[id] then
|
end
|
||||||
|
|
||||||
|
if not self.postRechargeID[id] then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local cfg = ConfigManager:getConfig("recharge")[id]
|
local cfg = ConfigManager:getConfig("recharge")[id]
|
||||||
@ -706,13 +728,16 @@ function BIReport:post24GradeFailEvent(chapterId)
|
|||||||
if not DataManager:getIsInCreate24Hour() then
|
if not DataManager:getIsInCreate24Hour() then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local postChapterId = {
|
if not self.postChapterId then
|
||||||
|
self.postChapterId = {
|
||||||
[1] = true,
|
[1] = true,
|
||||||
[2] = true,
|
[2] = true,
|
||||||
[3] = true,
|
[3] = true,
|
||||||
[4] = true,
|
[4] = true,
|
||||||
}
|
}
|
||||||
if not postChapterId[chapterId] then
|
end
|
||||||
|
|
||||||
|
if not self.postChapterId[chapterId] then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local args = {}
|
local args = {}
|
||||||
@ -737,17 +762,20 @@ function BIReport:post24HeroLevel(heroId)
|
|||||||
if not heroEntity or heroEntity:getLv() > 2 then
|
if not heroEntity or heroEntity:getLv() > 2 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local postHeroId = {
|
if not self.postHeroId then
|
||||||
|
self.postHeroId = {
|
||||||
[22001] = "24_blade_levelup",
|
[22001] = "24_blade_levelup",
|
||||||
[32001] = "24_onion_levelup",
|
[32001] = "24_onion_levelup",
|
||||||
[42001] = "24_iceheart_levelup",
|
[42001] = "24_iceheart_levelup",
|
||||||
}
|
}
|
||||||
if not postHeroId[heroId] then
|
end
|
||||||
|
|
||||||
|
if not self.postHeroId[heroId] then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local args = {}
|
local args = {}
|
||||||
CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_" .. postHeroId[heroId], json.encode(args))
|
CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_" .. self.postHeroId[heroId], json.encode(args))
|
||||||
CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_" .. postHeroId[heroId], json.encode(args))
|
CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_" .. self.postHeroId[heroId], json.encode(args))
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 上报24小时内开宝箱
|
-- 上报24小时内开宝箱
|
||||||
@ -763,10 +791,13 @@ function BIReport:post24OpenBox(count)
|
|||||||
if not DataManager:getIsInCreate24Hour() then
|
if not DataManager:getIsInCreate24Hour() then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local postCount = {
|
if not self.postBoxCount then
|
||||||
|
self.postBoxCount = {
|
||||||
[3] = true
|
[3] = true
|
||||||
}
|
}
|
||||||
if not postCount[count] then
|
end
|
||||||
|
|
||||||
|
if not self.postBoxCount[count] then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user