104 lines
3.5 KiB
Lua
104 lines
3.5 KiB
Lua
----- 新副本主关卡奖励弹窗 -----
|
||
local this = {}
|
||
--传入父脚本模块
|
||
local parent
|
||
--传入特效层级
|
||
local sortingOrder=0
|
||
local fun
|
||
--item容器
|
||
local itemList = {}
|
||
local rewardData = {}
|
||
local fightLevelId = 0
|
||
function this:InitComponent(gameObject)
|
||
this.titleText=Util.GetGameObject(gameObject,"TitleText"):GetComponent("Text")
|
||
this.tipText=Util.GetGameObject(gameObject,"tipText"):GetComponent("Text")
|
||
this.backBtn=Util.GetGameObject(gameObject,"BackBtn")
|
||
|
||
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 重复利用
|
||
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 = {...}
|
||
fightLevelId = args[1]
|
||
|
||
--组数据
|
||
rewardData = {}
|
||
this.ScrollView:SetData(rewardData, function (index, go)
|
||
this.SingleDataShow(go,rewardData[index])
|
||
end, true,true)
|
||
end
|
||
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)
|
||
end
|
||
this.NoviceItemList[_go][i].gameObject:SetActive(false)
|
||
end
|
||
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)
|
||
end
|
||
|
||
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
|
||
function this.OnSortingOrderChange()
|
||
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
|
||
sortingOrder = self.sortingOrder
|
||
end
|
||
|
||
function this:OnClose()
|
||
if fun then
|
||
fun()
|
||
fun = nil
|
||
end
|
||
end
|
||
|
||
function this:OnDestroy()
|
||
end
|
||
|
||
return this |