2021-04-20 13:58:00 +08:00
|
|
|
|
PatFaceManager = {};
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local this = PatFaceManager
|
|
|
|
|
this.isFirstLog = 0--0当天第一次登陆
|
|
|
|
|
this.isLogin = false
|
2020-10-19 20:15:28 +08:00
|
|
|
|
local fightLevelConfig = ConfigManager.GetConfig(ConfigName.MainLevelConfig)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
function this.Initialize()
|
|
|
|
|
Game.GlobalEvent:AddEvent(GameEvent.PatFace.PatFaceSend, this.OnAddPatFaceData)
|
|
|
|
|
end
|
|
|
|
|
function this.SetisFirstLogVal(isDayFirst,setPatFaceFinishTabs)
|
|
|
|
|
this.isFirstLog = isDayFirst
|
|
|
|
|
--Log(" this.isFirstLog ".. this.isFirstLog)
|
|
|
|
|
if this.isFirstLog == 0 then--是否是今天的第一次登陆
|
|
|
|
|
for i, v in ConfigPairs(ConfigManager.GetConfig(ConfigName.LoginPosterConfig)) do
|
|
|
|
|
if v.ShowType == 1 then--一天一清
|
|
|
|
|
if RedPointManager.PlayerPrefsGetStr(v.Id.."PatFace") ~= "0" then
|
|
|
|
|
RedPointManager.PlayerPrefsDeleteStr(v.Id.."PatFace")
|
|
|
|
|
end
|
|
|
|
|
elseif v.ShowType == 4 then--公会战 巅峰战 结束清 默认一天一轮回
|
|
|
|
|
if RedPointManager.PlayerPrefsGetStr(v.Id.."PatFace") ~= "0" then
|
|
|
|
|
RedPointManager.PlayerPrefsDeleteStr(v.Id.."PatFace")
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
if setPatFaceFinishTabs and #setPatFaceFinishTabs > 0 then
|
|
|
|
|
for i = 1, #setPatFaceFinishTabs do
|
2020-10-13 19:12:07 +08:00
|
|
|
|
if setPatFaceFinishTabs[i].Type == 8 then--升级限时礼包特殊处理
|
|
|
|
|
if RedPointManager.PlayerPrefsGetStr(setPatFaceFinishTabs[i].Id..PlayerManager.level.."PatFace") == "0" then
|
|
|
|
|
RedPointManager.PlayerPrefsSetStr(setPatFaceFinishTabs[i].Id..PlayerManager.level.."PatFace","1")
|
|
|
|
|
end
|
|
|
|
|
elseif setPatFaceFinishTabs[i].Type == 9 then
|
2020-10-19 21:54:01 +08:00
|
|
|
|
if RedPointManager.PlayerPrefsGetStr(setPatFaceFinishTabs[i].Id..(MonsterCampManager.monsterWave-1).."MonsterWavePatFace") == "0" then
|
|
|
|
|
RedPointManager.PlayerPrefsSetStr(setPatFaceFinishTabs[i].Id..(MonsterCampManager.monsterWave-1).."MonsterWavePatFace","1")
|
2020-10-13 19:12:07 +08:00
|
|
|
|
end
|
|
|
|
|
elseif setPatFaceFinishTabs[i].Type == 10 then
|
2020-10-19 21:54:01 +08:00
|
|
|
|
if RedPointManager.PlayerPrefsGetStr(setPatFaceFinishTabs[i].Id..PlayerManager.level.."MainLevelPatFace") == "0" then
|
|
|
|
|
RedPointManager.PlayerPrefsSetStr(setPatFaceFinishTabs[i].Id..PlayerManager.level.."MainLevelPatFace","1")
|
2020-10-13 19:12:07 +08:00
|
|
|
|
end
|
2021-03-13 15:09:34 +08:00
|
|
|
|
elseif setPatFaceFinishTabs[i].Type == 11 then
|
|
|
|
|
if RedPointManager.PlayerPrefsGetStr(setPatFaceFinishTabs[i].Id..PlayerManager.level.."TimeLimitSkin") == "0" then
|
|
|
|
|
RedPointManager.PlayerPrefsSetStr(setPatFaceFinishTabs[i].Id..PlayerManager.level.."TimeLimitSkin","1")
|
|
|
|
|
end
|
2020-10-13 19:12:07 +08:00
|
|
|
|
else
|
2020-06-18 20:39:29 +08:00
|
|
|
|
if setPatFaceFinishTabs[i].ShowType ~= 2 then--触发就拍不用赋值
|
|
|
|
|
if RedPointManager.PlayerPrefsGetStr(setPatFaceFinishTabs[i].Id.."PatFace") == "0" then
|
|
|
|
|
RedPointManager.PlayerPrefsSetStr(setPatFaceFinishTabs[i].Id.."PatFace","1")
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
--3 类型就拍一次
|
|
|
|
|
end
|
2021-04-26 13:44:31 +08:00
|
|
|
|
--前端检测拍脸
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local patFaceAllData = {}
|
2021-04-26 13:44:31 +08:00
|
|
|
|
function this.GetFrontPatFaceAllDataTabs()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if this.isLogin then return end
|
|
|
|
|
patFaceAllData = {}
|
|
|
|
|
for i, v in ConfigPairs(ConfigManager.GetConfig(ConfigName.LoginPosterConfig)) do
|
|
|
|
|
this.PatFaceSpecialMonitorOpenRules(v,patFaceAllData,1)
|
|
|
|
|
end
|
|
|
|
|
if patFaceAllData then
|
|
|
|
|
table.sort(patFaceAllData, function(a,b) return a.Order < b.Order end)
|
|
|
|
|
end
|
|
|
|
|
return patFaceAllData
|
|
|
|
|
end
|
2021-04-26 13:44:31 +08:00
|
|
|
|
--检测所有拍脸
|
|
|
|
|
function this.GetPatFaceAllDataTabs()
|
2021-04-26 20:35:54 +08:00
|
|
|
|
local curAllDatas = {}
|
2021-04-26 13:44:31 +08:00
|
|
|
|
local backData = this.GetBackPatFaceDaqta()
|
2021-04-26 20:35:54 +08:00
|
|
|
|
-- LogGreen("backData "..#backData)
|
2021-04-26 13:44:31 +08:00
|
|
|
|
local FrontData = this.GetFrontPatFaceAllDataTabs()
|
2021-04-26 20:35:54 +08:00
|
|
|
|
-- LogGreen("FrontData "..#FrontData)
|
|
|
|
|
if backData and #backData > 0 then
|
|
|
|
|
for i = 1, #backData do
|
|
|
|
|
table.insert(curAllDatas,backData[i])
|
|
|
|
|
end
|
|
|
|
|
end
|
2021-04-26 13:44:31 +08:00
|
|
|
|
if FrontData and #FrontData > 0 then
|
|
|
|
|
for i = 1, #FrontData do
|
2021-04-26 20:35:54 +08:00
|
|
|
|
table.insert(curAllDatas,FrontData[i])
|
2021-04-26 13:44:31 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
2021-04-26 20:35:54 +08:00
|
|
|
|
-- LogGreen("curAllDatas "..#curAllDatas)
|
|
|
|
|
return curAllDatas
|
2021-04-26 13:44:31 +08:00
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
function this.PatFaceSpecialMonitorOpenRules(v,patFaceAllData,type,starUpGiftNum)
|
|
|
|
|
--1等级 2关卡 3特劝等级 4功能开启时 5活动开启时 6公会战状态 7条件触发(事件)
|
|
|
|
|
if v.OpenRules[1] == 1 then
|
|
|
|
|
if PlayerManager.level >= v.OpenRules[2] and PlayerManager.level <= v.CloseRules[2] then
|
|
|
|
|
this.PatFaceSpecialMonitor(v,patFaceAllData,type,starUpGiftNum)
|
|
|
|
|
end
|
|
|
|
|
elseif v.OpenRules[1] == 2 then
|
|
|
|
|
local isPass1=FightPointPassManager.IsFightPointPass(v.OpenRules[2])
|
|
|
|
|
local isPass2=FightPointPassManager.IsFightPointPass(v.CloseRules[2])
|
|
|
|
|
if isPass1 and isPass2 == false then
|
|
|
|
|
this.PatFaceSpecialMonitor(v,patFaceAllData,type,starUpGiftNum)
|
|
|
|
|
end
|
|
|
|
|
elseif v.OpenRules[1] == 3 then
|
|
|
|
|
local vipLv = VipManager.GetVipLevel()
|
|
|
|
|
if vipLv >= v.OpenRules[2] and vipLv <= v.CloseRules[2] then
|
|
|
|
|
this.PatFaceSpecialMonitor(v,patFaceAllData,type,starUpGiftNum)
|
|
|
|
|
end
|
|
|
|
|
elseif v.OpenRules[1] == 4 then
|
|
|
|
|
local isOpen = ActTimeCtrlManager.SingleFuncState(v.OpenRules[2])
|
|
|
|
|
if isOpen then
|
|
|
|
|
this.PatFaceSpecialMonitor(v,patFaceAllData,type,starUpGiftNum)
|
|
|
|
|
end
|
|
|
|
|
elseif v.OpenRules[1] == 5 then
|
|
|
|
|
local activityId = ActivityGiftManager.IsActivityTypeOpen(v.OpenRules[2])
|
|
|
|
|
if activityId and activityId==42 then
|
|
|
|
|
this.PatFaceSpecialMonitor(v,patFaceAllData,type,starUpGiftNum)
|
|
|
|
|
elseif activityId and activityId==v.Values then
|
|
|
|
|
this.PatFaceSpecialMonitor(v,patFaceAllData,type,starUpGiftNum)
|
|
|
|
|
end
|
|
|
|
|
elseif v.OpenRules[1] == 6 then
|
|
|
|
|
--工会
|
|
|
|
|
this.PatFaceSpecialMonitor(v,patFaceAllData,type,starUpGiftNum)
|
|
|
|
|
elseif v.OpenRules[1] == 7 then
|
|
|
|
|
--巅峰战
|
|
|
|
|
this.PatFaceSpecialMonitor(v,patFaceAllData,type,starUpGiftNum)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
function this.PatFaceSpecialMonitor(v,patFaceAllData,type,starUpGiftNum)
|
|
|
|
|
if v.Type == 1 then--十连抽特殊处理
|
|
|
|
|
if RedPointManager.PlayerPrefsGetStr(v.Id.."PatFace") == "0" and RecruitManager.isTenRecruit == 0 then
|
|
|
|
|
table.insert(patFaceAllData,v)
|
|
|
|
|
end
|
|
|
|
|
elseif v.Type == 2 then--异妖直购特殊处理
|
|
|
|
|
local conFigData = ConfigManager.GetConfigData(ConfigName.RechargeCommodityConfig, v.ShopId)
|
|
|
|
|
if conFigData == nil then return end
|
|
|
|
|
local shopItemData = OperatingManager.GetGiftGoodsInfo(conFigData.Type,v.ShopId)
|
|
|
|
|
if RedPointManager.PlayerPrefsGetStr(v.Id.."PatFace") == "0" and shopItemData and shopItemData.buyTimes <= 0 then
|
|
|
|
|
table.insert(patFaceAllData,v)
|
|
|
|
|
end
|
|
|
|
|
elseif v.Type == 3 then--工会
|
|
|
|
|
local curGuildStage = GuildFightManager.GetCurFightStage()
|
|
|
|
|
if PlayerManager.familyId ~= 0 then
|
|
|
|
|
if v.OpenRules[2] == curGuildStage then---2 then
|
|
|
|
|
if RedPointManager.PlayerPrefsGetStr(v.Id.."PatFace") == "0" then
|
2021-01-09 14:20:06 +08:00
|
|
|
|
Log("#NAME?")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
table.insert(patFaceAllData,v)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
elseif v.Type == 5 then--星级成长礼特殊处理
|
|
|
|
|
if starUpGiftNum then
|
2020-12-24 13:52:28 +08:00
|
|
|
|
if starUpGiftNum == v.Star then
|
|
|
|
|
local pat = false
|
|
|
|
|
local configData = ConfigManager.GetAllConfigsDataByKey(ConfigName.RechargeCommodityConfig,"ShowType",8)
|
|
|
|
|
for i = 1, #configData do
|
|
|
|
|
local id = configData[i].Id
|
|
|
|
|
local giftInfo = OperatingManager.GetGiftGoodsInfo(5,id)
|
|
|
|
|
if giftInfo and giftInfo.dynamicBuyTimes == 1 then
|
|
|
|
|
pat = true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if pat and RedPointManager.PlayerPrefsGetStr(v.Id.."PatFace") == "0" then--商品未开启才会激活拍脸
|
2020-08-22 19:40:14 +08:00
|
|
|
|
table.insert(patFaceAllData,v)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
elseif v.Type == 6 then--巅峰战
|
|
|
|
|
local curState = ArenaTopMatchManager.GetBaseData().battleState
|
|
|
|
|
local battleStage = ArenaTopMatchManager.GetBaseData().battleStage
|
2021-05-28 10:33:53 +08:00
|
|
|
|
-- if battleStage and curState then
|
|
|
|
|
-- Log(" v.OpenRules[2] "..v.OpenRules[2].." curState "..curState.." type "..type.." battleStage "..battleStage.." v.Values "..v.Values)
|
|
|
|
|
-- else
|
|
|
|
|
-- Log(" v.OpenRules[2] "..v.OpenRules[2].." curState nil type "..type.." battleStage nil v.Values "..v.Values)
|
|
|
|
|
-- end
|
2020-12-31 22:59:34 +08:00
|
|
|
|
-- if v.OpenRules[2] == curState and type == 2 and battleStage >= v.Values then
|
2020-12-24 21:02:20 +08:00
|
|
|
|
--and type == 2
|
|
|
|
|
if (curState and curState >= v.OpenRules[2] and curState <= v.CloseRules[2]) and (battleStage and battleStage >= v.Values) then--v.Values 2 > 1
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if RedPointManager.PlayerPrefsGetStr(v.Id.."PatFace") == "0" then
|
|
|
|
|
table.insert(patFaceAllData,v)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
elseif v.Type == 7 then--东海寻仙
|
|
|
|
|
if FindFairyManager.GetActivityTime() > 0 then
|
2020-12-24 13:52:28 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if RedPointManager.PlayerPrefsGetStr(v.Id.."PatFace") == "0" then
|
|
|
|
|
table.insert(patFaceAllData,v)
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-06-18 20:39:29 +08:00
|
|
|
|
elseif v.Type == 8 then--升级限时礼包
|
|
|
|
|
local specialConfig = ConfigManager.GetConfigData(ConfigName.SpecialConfig,51).Value
|
|
|
|
|
local t = string.split(specialConfig,"#")
|
|
|
|
|
local q = false
|
|
|
|
|
for i = 0, 19 do
|
|
|
|
|
local level = tonumber(t[1])+i*tonumber(t[2])
|
|
|
|
|
if PlayerManager.level == level then
|
|
|
|
|
q =true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if q then
|
|
|
|
|
if RedPointManager.PlayerPrefsGetStr(v.Id..PlayerManager.level.."PatFace") == "0" then
|
|
|
|
|
table.insert(patFaceAllData,v)
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-10-13 13:51:11 +08:00
|
|
|
|
elseif v.Type == 9 then--心魔试炼限时礼包
|
2020-10-13 18:39:55 +08:00
|
|
|
|
local specialConfig = ConfigManager.GetConfigData(ConfigName.SpecialConfig,92).Value
|
2020-10-13 13:51:11 +08:00
|
|
|
|
local str = string.split(specialConfig,"|")
|
|
|
|
|
local nums = string.split(str[1],"#")
|
|
|
|
|
local canGet = false
|
2020-10-19 21:54:01 +08:00
|
|
|
|
local value = MonsterCampManager.monsterWave-1
|
|
|
|
|
if value == tonumber(nums[1]) or value == tonumber(nums[2]) or value == tonumber(nums[3]) then
|
2020-10-13 13:51:11 +08:00
|
|
|
|
canGet = true
|
2020-10-19 21:54:01 +08:00
|
|
|
|
else
|
|
|
|
|
if value > tonumber(nums[3]) and (value - tonumber(nums[3])) % tonumber(str[2]) == 0 then
|
|
|
|
|
canGet = true
|
|
|
|
|
end
|
2020-10-13 13:51:11 +08:00
|
|
|
|
end
|
2020-10-20 14:58:50 +08:00
|
|
|
|
-- LogYellow("MonsterCampManager.monsterWave"..MonsterCampManager.monsterWave-1)
|
2021-04-21 16:36:12 +08:00
|
|
|
|
-- --LogGreen("canGet:"..tostring(canGet))
|
2020-10-20 14:58:50 +08:00
|
|
|
|
-- LogRed("@@@@@@@@@@@@@@@@@@@@:"..RedPointManager.PlayerPrefsGetStr(v.Id..PlayerManager.level.."MonsterWavePatFace"))
|
2020-10-13 13:51:11 +08:00
|
|
|
|
if canGet then
|
2020-10-19 21:54:01 +08:00
|
|
|
|
if RedPointManager.PlayerPrefsGetStr(v.Id..(MonsterCampManager.monsterWave-1).."MonsterWavePatFace") == "0" then
|
2020-10-13 13:51:11 +08:00
|
|
|
|
table.insert(patFaceAllData,v)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
elseif v.Type == 10 then--主线关卡限时礼包
|
2020-10-13 18:39:55 +08:00
|
|
|
|
local specialConfig = ConfigManager.GetConfigData(ConfigName.SpecialConfig,93).Value
|
2020-10-13 13:51:11 +08:00
|
|
|
|
local num = tonumber(specialConfig)
|
|
|
|
|
local canGet = false
|
|
|
|
|
local value = fightLevelConfig[FightPointPassManager.lastPassFightId].SortId
|
|
|
|
|
if value%num == 0 then
|
|
|
|
|
canGet = true
|
|
|
|
|
end
|
|
|
|
|
if canGet then
|
2020-10-19 21:54:01 +08:00
|
|
|
|
if RedPointManager.PlayerPrefsGetStr(v.Id..PlayerManager.level.."MainLevelPatFace") == "0" then
|
2020-10-13 13:51:11 +08:00
|
|
|
|
table.insert(patFaceAllData,v)
|
|
|
|
|
end
|
|
|
|
|
end
|
2021-01-18 16:20:42 +08:00
|
|
|
|
elseif v.Type == 11 then--限时神装礼包
|
|
|
|
|
local specialConfig = ConfigManager.GetConfigData(ConfigName.SpecialConfig,106).Value
|
|
|
|
|
local num = tonumber(specialConfig)
|
|
|
|
|
local canGet = false
|
|
|
|
|
if PlayerManager.level == num then
|
|
|
|
|
canGet =true
|
|
|
|
|
end
|
|
|
|
|
if canGet then
|
2021-03-13 15:09:34 +08:00
|
|
|
|
if RedPointManager.PlayerPrefsGetStr(v.Id..PlayerManager.level.."TimeLimitSkin") == "0" then
|
2021-01-18 16:20:42 +08:00
|
|
|
|
table.insert(patFaceAllData,v)
|
|
|
|
|
end
|
|
|
|
|
end
|
2021-06-16 19:56:10 +08:00
|
|
|
|
elseif v.Type == 12 then--惊喜礼盒活动
|
|
|
|
|
local ActData = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.SurpriseBox)
|
2021-06-17 15:26:10 +08:00
|
|
|
|
if ActData and PlayerPrefs.GetInt(PlayerManager.uid.."SurpriseBoxPatFaceDay"..ActData.value) == 0 then
|
2021-06-16 19:56:10 +08:00
|
|
|
|
table.insert(patFaceAllData,v)
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
else
|
|
|
|
|
if RedPointManager.PlayerPrefsGetStr(v.Id.."PatFace") == "0" then
|
|
|
|
|
table.insert(patFaceAllData,v)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
function this.ShowBuyLaterDrop(msg)
|
|
|
|
|
UIManager.OpenPanel(UIName.RewardItemPopup, msg.drop, 1)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--秒转换成文字对应时间
|
|
|
|
|
function this.GetTimeStrBySeconds(_seconds)
|
|
|
|
|
return os.date("%Y.%m.%d", _seconds)
|
|
|
|
|
end
|
|
|
|
|
this.timer = Timer.New()
|
|
|
|
|
--刷新倒计时显示
|
2020-07-29 18:36:36 +08:00
|
|
|
|
function this.RemainTimeDown(_timeTextExpertgo,_timeTextExpert,timeDown,str)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if timeDown > 0 then
|
|
|
|
|
if _timeTextExpertgo then
|
|
|
|
|
_timeTextExpertgo:SetActive(true)
|
|
|
|
|
end
|
|
|
|
|
if _timeTextExpert then
|
2020-07-29 18:36:36 +08:00
|
|
|
|
if str then
|
|
|
|
|
_timeTextExpert.text = str..this.TimeStampToDateString(timeDown)
|
|
|
|
|
else
|
2021-03-02 16:53:12 +08:00
|
|
|
|
_timeTextExpert.text = Language[10023]..this.TimeStampToDateString(timeDown)
|
2020-07-29 18:36:36 +08:00
|
|
|
|
end
|
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
if this.timer then
|
|
|
|
|
this.timer:Stop()
|
|
|
|
|
this.timer = nil
|
|
|
|
|
end
|
|
|
|
|
this.timer = Timer.New(function()
|
2021-04-27 15:49:56 +08:00
|
|
|
|
if _timeTextExpert and tostring(_timeTextExpert) ~= "null" then
|
2020-07-29 18:36:36 +08:00
|
|
|
|
if str then
|
2021-04-27 15:49:56 +08:00
|
|
|
|
_timeTextExpert.text = str..this.TimeStampToDateString(timeDown)
|
2020-07-29 18:36:36 +08:00
|
|
|
|
else
|
2021-04-27 15:49:56 +08:00
|
|
|
|
_timeTextExpert.text = Language[10023]..this.TimeStampToDateString(timeDown)
|
2020-07-29 18:36:36 +08:00
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
if timeDown < 0 then
|
|
|
|
|
if _timeTextExpertgo then
|
|
|
|
|
_timeTextExpertgo:SetActive(false)
|
|
|
|
|
end
|
|
|
|
|
this.timer:Stop()
|
|
|
|
|
this.timer = nil
|
|
|
|
|
end
|
|
|
|
|
timeDown = timeDown - 1
|
|
|
|
|
end, 1, -1, true)
|
|
|
|
|
this.timer:Start()
|
|
|
|
|
else
|
|
|
|
|
if _timeTextExpertgo then
|
|
|
|
|
_timeTextExpertgo:SetActive(false)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.TimeStampToDateString(second)
|
|
|
|
|
local day = math.floor(second / (24 * 3600))
|
|
|
|
|
local minute = math.floor(second / 60) % 60
|
|
|
|
|
local sec = second % 60
|
|
|
|
|
local hour = math.floor(math.floor(second - day * 24 * 3600 - sec - minute * 60) / 3600)
|
2021-03-02 16:53:12 +08:00
|
|
|
|
return string.format(Language[10585],day, hour, minute, sec)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
function this.GetGuildFightTime()
|
|
|
|
|
local guildFightData = GuildFightManager.GetGuildFightData()
|
|
|
|
|
if guildFightData then
|
|
|
|
|
local startTime = guildFightData.startTime
|
|
|
|
|
local curTime = GetTimeStamp()
|
|
|
|
|
--Log("curTime - startTime "..curTime - startTime)
|
|
|
|
|
return (curTime - startTime) <= 3 * 60
|
|
|
|
|
else
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
--事件触发拍脸 (如五星成长礼)
|
|
|
|
|
function this.OnAddPatFaceData(faceConFigType, starUpGiftNum)
|
2021-04-26 13:44:31 +08:00
|
|
|
|
if faceConFigType == FacePanelType.GrowGift or faceConFigType == FacePanelType.UpgradePac or faceConFigType == FacePanelType.MonsterWave or faceConFigType == FacePanelType.MainLevel
|
|
|
|
|
or faceConFigType == FacePanelType.TimeLimitSkin then
|
2021-05-06 18:08:53 +08:00
|
|
|
|
LogYellow("此种拍脸已改为后端推送 faceConFigType: "..faceConFigType)
|
2021-04-26 13:44:31 +08:00
|
|
|
|
return
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if this.isLogin then return end--上来就弹新关卡界面 所以不弹
|
2020-12-24 13:52:28 +08:00
|
|
|
|
|
2020-11-16 15:24:09 +08:00
|
|
|
|
if MapManager.Mapping or UIManager.IsOpen(UIName.BattlePanel) then return end--在关卡里 副本里不弹
|
2020-05-09 13:31:21 +08:00
|
|
|
|
patFaceAllData = {}
|
|
|
|
|
local allTypeFaceConFig = ConfigManager.GetAllConfigsDataByKey(ConfigName.LoginPosterConfig,"Type",faceConFigType)
|
|
|
|
|
for i = 1, #allTypeFaceConFig do
|
|
|
|
|
this.PatFaceSpecialMonitorOpenRules(allTypeFaceConFig[i],patFaceAllData,2, starUpGiftNum)
|
|
|
|
|
end
|
|
|
|
|
if patFaceAllData and not GuideManager.IsFunctionGuideExist() then
|
2021-04-26 13:44:31 +08:00
|
|
|
|
this.OpenPatFacePanel(patFaceAllData)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
this.patFaceCallList = Stack.New()
|
2021-04-26 13:44:31 +08:00
|
|
|
|
function this.OpenPatFacePanel(_patFaceAllData)
|
2021-04-21 16:36:12 +08:00
|
|
|
|
--LogGreen("#patFaceAllData 事件 " .. #patFaceAllData)
|
2021-05-06 18:08:53 +08:00
|
|
|
|
if _patFaceAllData and #_patFaceAllData > 0 then
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.patFaceCallList:Clear()
|
|
|
|
|
this.patFaceCallList:Push(function()
|
|
|
|
|
--Log("结束了!!!")
|
2021-04-26 13:44:31 +08:00
|
|
|
|
this.DeleBackPatFaceDaqta()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.PatFace.PatFaceSendFinish)
|
2021-05-06 18:08:53 +08:00
|
|
|
|
AdventureManager.GetIsMaxTime()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end)
|
2021-04-26 13:44:31 +08:00
|
|
|
|
for i = #_patFaceAllData, 1, -1 do
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.patFaceCallList:Push(function()
|
2021-04-26 13:44:31 +08:00
|
|
|
|
PatFaceManager.SetisFirstLogVal(1, { _patFaceAllData[i] })
|
|
|
|
|
UIManager.OpenPanel(UIName.PatFacePanel, _patFaceAllData[i], function()
|
2021-06-10 16:10:12 +08:00
|
|
|
|
if this.time2 then
|
|
|
|
|
this.time2:Stop()
|
|
|
|
|
this.time2 = nil
|
|
|
|
|
end
|
|
|
|
|
this.time2 = Timer.New(function()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.patFaceCallList:Pop()()
|
2021-06-10 16:10:12 +08:00
|
|
|
|
this.time2 = nil
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end, 0.5)
|
2021-06-10 16:10:12 +08:00
|
|
|
|
this.time2:Start()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end)
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
this.patFaceCallList:Pop()()
|
|
|
|
|
else
|
|
|
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.PatFace.PatFaceSendFinish)
|
|
|
|
|
end
|
|
|
|
|
end
|
2021-04-26 13:44:31 +08:00
|
|
|
|
|
|
|
|
|
--后端礼包拍脸逻辑
|
|
|
|
|
this.backPatFaceAllData = {}
|
|
|
|
|
function this.SetPatFaceDaqta(PatFaceDatas)
|
|
|
|
|
if PatFaceDatas and PatFaceDatas.id and #PatFaceDatas.id > 0 then
|
|
|
|
|
for i = 1, #PatFaceDatas.id do
|
2021-06-17 18:17:38 +08:00
|
|
|
|
--LogYellow("后端推送礼包拍脸 礼包id "..PatFaceDatas.id[i])
|
2021-04-26 13:44:31 +08:00
|
|
|
|
local curRechargeCommodityConfig = ConfigManager.TryGetConfigData(ConfigName.RechargeCommodityConfig,PatFaceDatas.id[i])
|
|
|
|
|
if curRechargeCommodityConfig and curRechargeCommodityConfig.PosterUiId then
|
2021-06-17 18:17:38 +08:00
|
|
|
|
--LogYellow("后端推送礼包拍脸 拍脸ID "..curRechargeCommodityConfig.PosterUiId)
|
2021-06-18 15:17:10 +08:00
|
|
|
|
local config = ConfigManager.GetConfigData(ConfigName.LoginPosterConfig,curRechargeCommodityConfig.PosterUiId)
|
|
|
|
|
local isShow = true
|
|
|
|
|
for k,v in ipairs(this.backPatFaceAllData) do
|
|
|
|
|
if config.Type == v.Type then
|
|
|
|
|
isShow = false
|
|
|
|
|
break
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if isShow then
|
|
|
|
|
table.insert(this.backPatFaceAllData,config)
|
|
|
|
|
end
|
|
|
|
|
|
2021-04-26 13:44:31 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2021-06-17 18:17:38 +08:00
|
|
|
|
if this.backPatFaceAllData and this.GetcurCanPatFace() then
|
2021-04-26 13:44:31 +08:00
|
|
|
|
this.OpenPatFacePanel(this.backPatFaceAllData)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.GetBackPatFaceDaqta()
|
|
|
|
|
return this.backPatFaceAllData
|
|
|
|
|
end
|
|
|
|
|
function this.DeleBackPatFaceDaqta()
|
2021-06-17 18:17:38 +08:00
|
|
|
|
--LogYellow("后端推送礼包拍脸 清空 ")
|
2021-04-26 13:44:31 +08:00
|
|
|
|
this.backPatFaceAllData = {}
|
|
|
|
|
end
|
2021-05-06 18:08:53 +08:00
|
|
|
|
function this.GetcurCanPatFace()
|
|
|
|
|
if this.isLogin then return false end--登录界面不拍
|
2021-06-18 10:48:49 +08:00
|
|
|
|
if MapManager.Mapping or UIManager.IsOpen(UIName.BattlePanel) or UIManager.IsOpen(UIName.SurpriseBoxPanel) then return false end--在关卡里 副本里不拍
|
2021-05-06 18:08:53 +08:00
|
|
|
|
if GuideManager.IsFunctionGuideExist() or GuideManager.IsInMainGuide() then return false end--引导不拍
|
|
|
|
|
if UIManager.IsOpen(UIName.SingleRecruitPanel) or UIManager.IsOpen(UIName.TenRecruitPanel) or UIManager.IsOpen(UIName.RecruitPanel) then return false end--抽卡界面不拍
|
|
|
|
|
if UIManager.IsOpen(UIName.PatFacePanel) then return false end--正在拍脸
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
function this.RefreshPatface()
|
|
|
|
|
if this.GetcurCanPatFace() then
|
|
|
|
|
this.OpenPatFacePanel(this.GetPatFaceAllDataTabs())
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-06-23 18:36:24 +08:00
|
|
|
|
return this
|