miduo_client/Assets/ManagedResources/~Lua/Modules/FightLevel/View/FightLevelInfoPopup_MainLev...

104 lines
3.5 KiB
Lua
Raw Normal View History

2021-05-07 14:44:50 +08:00
----- 新副本主关卡奖励弹窗 -----
local this = {}
--传入父脚本模块
local parent
--传入特效层级
local sortingOrder=0
local fun
--item容器
local itemList = {}
local rewardData = {}
2021-05-07 20:24:41 +08:00
local fightLevelId = 0
2021-05-07 14:44:50 +08:00
function this:InitComponent(gameObject)
this.titleText=Util.GetGameObject(gameObject,"TitleText"):GetComponent("Text")
2021-05-07 20:24:41 +08:00
this.tipText=Util.GetGameObject(gameObject,"tipText"):GetComponent("Text")
2021-05-07 14:44:50 +08:00
this.backBtn=Util.GetGameObject(gameObject,"BackBtn")
2021-05-07 20:24:41 +08:00
this.rewardPre = Util.GetGameObject(gameObject, "rewardPre")
this.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, Util.GetGameObject(gameObject, "Root").transform,
this.rewardPre, nil, Vector2.New(832.8, 983.5), 1, 1, Vector2.New(0,0))
this.ScrollView.moveTween.MomentumAmount = 1
this.ScrollView.moveTween.Strength = 1
this.NoviceItemList={}--存储itemview 重复利用
2021-05-07 14:44:50 +08:00
end
function this:BindEvent()
Util.AddClick(this.backBtn, function()
parent:ClosePanel()
end)
end
function this:AddListener()
end
function this:RemoveListener()
end
function this:OnShow(_parent,...)
parent=_parent
sortingOrder = _parent.sortingOrder
--不定参中包含的不定参 _args[1]为面板类型 _args[2]之后(包括)为打开面板后传入的不定参
local args = {...}
2021-05-07 20:24:41 +08:00
fightLevelId = args[1]
2021-05-07 14:44:50 +08:00
--组数据
rewardData = {}
2021-05-07 20:24:41 +08:00
this.ScrollView:SetData(rewardData, function (index, go)
this.SingleDataShow(go,rewardData[index])
end, true,true)
2021-05-07 14:44:50 +08:00
end
2021-05-07 20:24:41 +08:00
function this.SingleMissionDatasDataShow(_go,_rewardData)
local rewardData = _rewardData
local missionConfigData = dailyTasksConfig[rewardData.missionId]
local reward = {}
local titleText = Util.GetGameObject(_go, "titleImage/titleText"):GetComponent("Text")
titleText.text =string.format(GetLanguageStrById(missionConfigData.Desc),missionConfigData.Values[2][1])
local noStarImage = Util.GetGameObject(_go, "noStarImage")
local getStarImage = Util.GetGameObject(_go, "getStarImage")
noStarImage:SetActive(false)
noStarImage:SetActive(false)
local itemGroup = Util.GetGameObject(_go, "content")
--滚动条复用重设itemview
if not this.NoviceItemList[_go] then
this.NoviceItemList[_go] = {}
end
for i = 1, #reward do
if not this.NoviceItemList[_go][i] then
this.NoviceItemList[_go][i] = SubUIManager.Open(SubUIConfig.ItemView, itemGroup.transform)
2021-05-07 14:44:50 +08:00
end
2021-05-07 20:24:41 +08:00
this.NoviceItemList[_go][i].gameObject:SetActive(false)
2021-05-07 14:44:50 +08:00
end
2021-05-07 20:24:41 +08:00
for i = 1, #reward do
this.NoviceItemList[_go][i]:OnOpen(false, reward[i].reward, 0.9,false,false,false,sortingOrder)
this.NoviceItemList[_go][i].gameObject:SetActive(true)
2021-05-07 14:44:50 +08:00
end
2021-05-07 20:24:41 +08:00
local noButton = Util.GetGameObject(_go.gameObject, "noButton")
local okButton = Util.GetGameObject(_go.gameObject, "okButton")
local state=missionData.state--0:未完成 1完成未领取 2已达成已领取
noButton:SetActive(state == SingleDailyMissionState.Finish)
okButton:SetActive(state == SingleDailyMissionState.NoFinish)
end
2021-05-07 14:44:50 +08:00
function this.OnSortingOrderChange()
2021-05-07 20:24:41 +08:00
for i, v in pairs(this.NoviceItemList) do
for j = 1, #this.NoviceItemList[i] do
if this.NoviceItemList[i][j] and this.NoviceItemList[i][j].gameObject then
this.NoviceItemList[i][j]:SetEffectLayer(sortingOrder)
end
end
end
2021-05-07 14:44:50 +08:00
sortingOrder = self.sortingOrder
end
function this:OnClose()
if fun then
fun()
fun = nil
end
end
function this:OnDestroy()
end
return this