67 lines
2.1 KiB
Lua
67 lines
2.1 KiB
Lua
|
----- 寻宝迷踪奖励预览弹窗 -----
|
||
|
local this = {}
|
||
|
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
|
||
|
local heroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig)
|
||
|
local specialConfig = ConfigManager.GetConfig(ConfigName.SpecialConfig)
|
||
|
|
||
|
function this:InitComponent(gameObject)
|
||
|
self.spLoader = SpriteLoader.New()
|
||
|
|
||
|
self.scroll = Util.GetGameObject(gameObject,"Grid")
|
||
|
self.itemPre = Util.GetGameObject(gameObject,"itemPre")
|
||
|
self.timeText = Util.GetGameObject(gameObject,"Content/Text"):GetComponent("Text")
|
||
|
-- 设置循环滚动,万一内容不停地加
|
||
|
local rootHight = self.scroll.transform.rect.height
|
||
|
local width = self.scroll.transform.rect.width
|
||
|
self.scrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, self.scroll.transform,
|
||
|
self.itemPre, nil, Vector2.New(width, rootHight), 1, 5, Vector2.New(20, 45))
|
||
|
self.scrollView.moveTween.MomentumAmount = 1
|
||
|
self.scrollView.moveTween.Strength = 2
|
||
|
|
||
|
self.itemList = {}
|
||
|
end
|
||
|
|
||
|
function this:BindEvent()
|
||
|
end
|
||
|
|
||
|
function this:AddListener()
|
||
|
end
|
||
|
|
||
|
function this:RemoveListener()
|
||
|
end
|
||
|
|
||
|
function this:OnShow(_parent,...)
|
||
|
self.parent=_parent
|
||
|
self.sortingOrder = _parent.sortingOrder
|
||
|
local args = {...}
|
||
|
self.actData = args[1]
|
||
|
self.timeText.text = string.format("概率有效期:%s ~ %s",os.date("%Y-%m-%d", self.actData.startTime),os.date("%Y-%m-%d", self.actData.endTime))
|
||
|
this:Refresh(true,true)
|
||
|
end
|
||
|
|
||
|
function this:Refresh(isTop,isAni)
|
||
|
local dataList = self.actData.FreelyData
|
||
|
self.scrollView:SetData(dataList, function (index, item)
|
||
|
this:ShowSingleItem(item, dataList[index],index)
|
||
|
end,not isTop,not isAni)
|
||
|
end
|
||
|
|
||
|
function this:ShowSingleItem(go,data,index)
|
||
|
go:SetActive(true)
|
||
|
local rate = Util.GetGameObject(go,"rate"):GetComponent("Text")
|
||
|
rate.text = data.WeightShow
|
||
|
if not self.itemList[index] then
|
||
|
self.itemList[index] = SubUIManager.Open(SubUIConfig.ItemView, go.transform)
|
||
|
end
|
||
|
self.itemList[index]:OnOpen(false,data.Reward,1,true,false,false,self.sortingOrder)
|
||
|
|
||
|
end
|
||
|
|
||
|
function this:OnClose()
|
||
|
end
|
||
|
|
||
|
function this:OnDestroy()
|
||
|
self.spLoader:Destroy()
|
||
|
end
|
||
|
|
||
|
return this
|