【十五日登陆】修改提交

(cherry picked from commit 8e0177d3ed)
dev_chengFeng
ZhangBiao 2021-04-12 15:02:49 +08:00
parent 034ed82f0f
commit 276e0129fe
4 changed files with 1690 additions and 38 deletions

View File

@ -62,13 +62,4 @@ function this.CheckRedPoint()
return false
end
function this.CheckActOpen()
this.InitRewardData()
if Data and Data.ActState == 0 then
return true
else
return false
end
end
return FifteenDayGiftManager

View File

@ -45,7 +45,23 @@ function FifteenDayGift:BindEvent()
PopupTipPanel.ShowTip(Language[12285])
return
end
NetManager.GetActivityRewardRequest(-1,Data.activityId,function (drop)
FifteenDayGift:Request()
end)
BindRedPointObject(RedPointType.FifteenDayGift_1,self.redPoint)
end
function FifteenDayGift:Request(missionId,obj)
local id = missionId and missionId or -1
NetManager.GetActivityRewardRequest(id,Data.activityId,function (drop)
if obj then -- 单个领取
local thread=coroutine.start(function()
obj[1].transform:DORotate(Vector3.New(0, 90, 0), 0.3)
coroutine.wait(0.3)
obj[1]:SetActive(false)
obj[2].transform:DORotate(Vector3.New(0, 0, 0), 0.3)
coroutine.wait(1)
end)
else--全部领取
for i = 1, #frontList do
local thread=coroutine.start(function()
frontList[i].transform:DORotate(Vector3.New(0, 90, 0), 0.3)
@ -55,33 +71,31 @@ function FifteenDayGift:BindEvent()
coroutine.wait(1)
end)
end
--奖励界面
local func = function (drop)
UIManager.OpenPanel(UIName.RewardItemPopup, drop, 1,function()
FifteenDayGift:Refresh()
CheckRedPointStatus(RedPointType.FifteenDayGift_1)
end)
end
Timer.New(function ()
--检测奖励是否为灵兽
if drop.pokemon and #drop.pokemon >= 1 then
local thread=coroutine.start(function()
self.effect2:SetActive(true)
coroutine.wait(3)
UIManager.OpenPanel(UIName.PokemonSingleResultPanel,nil,drop,nil,nil,function ()
self.effect2:SetActive(false)
func(drop)
end)
end
--奖励界面
local func = function (drop)
UIManager.OpenPanel(UIName.RewardItemPopup, drop, 1,function()
FifteenDayGift:Refresh()
CheckRedPointStatus(RedPointType.FifteenDayGift_1)
end)
end
Timer.New(function ()
--检测奖励是否为灵兽
if drop.pokemon and #drop.pokemon >= 1 then
local thread=coroutine.start(function()
self.effect2:SetActive(true)
coroutine.wait(3)
UIManager.OpenPanel(UIName.PokemonSingleResultPanel,nil,drop,nil,nil,function ()
self.effect2:SetActive(false)
func(drop)
end)
else
func(drop)
end
end,0.5):Start()
end)
end)
else
func(drop)
end
end,0.5):Start()
end)
BindRedPointObject(RedPointType.FifteenDayGift_1,self.redPoint)
end
--添加事件监听(用于子类重写)
@ -137,7 +151,9 @@ function FifteenDayGift:SetSingleReward(sData,go,index)
local num = Util.GetGameObject(front,"num"):GetComponent("Text")
local back = Util.GetGameObject(go,"back")
local red = Util.GetGameObject(front,"red")
local mask = Util.GetGameObject(front,"mask")--单个奖励领取按钮
red:SetActive(false)
mask:SetActive(false)
local curTime = GetTimeStamp()
--弄一个ItemView提供点击方法
@ -152,12 +168,13 @@ function FifteenDayGift:SetSingleReward(sData,go,index)
front:GetComponent("RectTransform").rotation = sData.State == 0 and angle[1] or angle[2]
back:GetComponent("RectTransform").rotation = sData.State == 1 and angle[1] or angle[2]
--判断哪些可领取,插入表
-- LogPurple("sData.Progress:"..tostring(sData.Progress).." sData.State:"..tostring(sData.State))
-- LogPurple("sData.missionId:"..tostring(sData.missionId).." sData.Progress:"..tostring(sData.Progress).." sData.State:"..tostring(sData.State))
if sData.Progress <= curTime and sData.State == 0 then
-- LogPink("index:"..tostring(index))
table.insert(frontList,front)
table.insert(backList,back)
red:SetActive(true)
mask:SetActive(true)
end
--如果已领取、可领取、不可领取显示第几天;下一领取显示时间
if sData.Progress > curTime and sData.Progress - 86400 <= curTime then
@ -187,6 +204,9 @@ function FifteenDayGift:SetSingleReward(sData,go,index)
Util.AddOnceClick(icon.gameObject,function ()
ItemViewList[index]:OnBtnCkickEvent(sData.Reward[1])
end)
Util.AddOnceClick(mask,function ()
FifteenDayGift:Request(sData.missionId,{front,back})
end)
end
--界面关闭时调用(用于子类重写)

View File

@ -1335,8 +1335,14 @@ function this.RefreshEightGiftPreview()
this.sgBtn:SetActive(false)
end
--十五日
this.fgBtn:SetActive(FifteenDayGiftManager.CheckActOpen())
this.rpFifteenDayEffect:SetActive(FifteenDayGiftManager.CheckActOpen())
if ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.FifteenDayGift) then
this.fgBtn:SetActive(true)
this.rpFifteenDayEffect:SetActive(true)
FifteenDayGiftManager.InitRewardData()
else
this.fgBtn:SetActive(false)
this.rpFifteenDayEffect:SetActive(false)
end
end
-- 七日登陆奖励预览