2021-09-08 17:32:48 +08:00
|
|
|
local QiJieTreasure = {}
|
2021-09-08 16:26:40 +08:00
|
|
|
--传入父脚本模块
|
|
|
|
local parent
|
|
|
|
--传入特效层级
|
|
|
|
local sortingOrder=0
|
|
|
|
|
|
|
|
--初始化组件(用于子类重写)
|
2021-09-08 17:32:48 +08:00
|
|
|
function QiJieTreasure:InitComponent(gameObject)
|
|
|
|
self.GameObject = Util.GetGameObject(gameObject,"Scroll")
|
|
|
|
self.itemPre = Util.GetGameObject(gameObject, "Pre")
|
|
|
|
|
|
|
|
local rootHight = self.GameObject.transform.rect.height
|
|
|
|
local width = self.GameObject.transform.rect.width
|
|
|
|
self.ScrollView = SubUIManager.Open(SubUIConfig.ScrollFitterView, self.GameObject.transform,
|
|
|
|
self.itemPre, Vector2.New(width, rootHight), 1, 0)
|
|
|
|
self.ScrollView.moveTween.MomentumAmount = 1
|
|
|
|
self.ScrollView.moveTween.Strength = 2
|
|
|
|
self.ScrollView.elastic = false
|
2021-09-08 16:26:40 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
--绑定事件(用于子类重写)
|
2021-09-08 17:32:48 +08:00
|
|
|
function QiJieTreasure:BindEvent()
|
2021-09-08 16:26:40 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
--添加事件监听(用于子类重写)
|
2021-09-08 17:32:48 +08:00
|
|
|
function QiJieTreasure:AddListener()
|
2021-09-08 16:26:40 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
--移除事件监听(用于子类重写)
|
2021-09-08 17:32:48 +08:00
|
|
|
function QiJieTreasure:RemoveListener()
|
2021-09-08 16:26:40 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
--界面打开时调用(用于子类重写)
|
2021-09-08 17:32:48 +08:00
|
|
|
function QiJieTreasure:OnShow(_parent,...)
|
2021-09-08 16:26:40 +08:00
|
|
|
parent=_parent
|
|
|
|
sortingOrder = _parent.sortingOrder
|
2021-09-08 17:32:48 +08:00
|
|
|
self.dataList = QiJieShiLianManager.FormatTreasureData()
|
|
|
|
for i = 1, #self.dataList do
|
|
|
|
for j = 1, #self.dataList[i] do
|
|
|
|
LogGreen("名字:"..self.dataList[i][j].Name)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
self.ScrollView:SetData(self.dataList, function(index, go)
|
|
|
|
self:SetSingleData(index,go,self.dataList[index])
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
|
|
|
|
function QiJieTreasure:SetSingleData(index,_go,_data)
|
|
|
|
for i = 1, 4 do
|
|
|
|
local obj = Util.GetGameObject(_go,"Pre ("..i..")")
|
|
|
|
if _data[i] then
|
|
|
|
obj:SetActive(true)
|
|
|
|
else
|
|
|
|
obj:SetActive(false)
|
|
|
|
end
|
|
|
|
end
|
2021-09-08 16:26:40 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
--界面关闭时调用(用于子类重写)
|
2021-09-08 17:32:48 +08:00
|
|
|
function QiJieTreasure:OnClose()
|
2021-09-08 16:26:40 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
--界面销毁时调用(用于子类重写)
|
2021-09-08 17:32:48 +08:00
|
|
|
function QiJieTreasure:OnDestroy()
|
2021-09-08 16:26:40 +08:00
|
|
|
end
|
|
|
|
|
2021-09-08 17:32:48 +08:00
|
|
|
return QiJieTreasure
|