2021-10-20 18:35:30 +08:00
|
|
|
local this = {}
|
|
|
|
--传入父脚本模块
|
|
|
|
local parent
|
|
|
|
--传入特效层级
|
|
|
|
local sortingOrder=0
|
2021-10-21 10:58:09 +08:00
|
|
|
local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)
|
2021-10-20 18:35:30 +08:00
|
|
|
|
|
|
|
--初始化组件(用于子类重写)
|
|
|
|
function this:InitComponent(gameObject)
|
|
|
|
this.spLoader = SpriteLoader.New()
|
2021-10-21 10:58:09 +08:00
|
|
|
self.itemPre = Util.GetGameObject(gameObject, "ItemPre")
|
|
|
|
self.scrollItem = Util.GetGameObject(gameObject, "Scroll")
|
|
|
|
local rootHight = self.scrollItem.transform.rect.height
|
|
|
|
local width = self.scrollItem.transform.rect.width
|
|
|
|
self.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, self.scrollItem.transform,
|
2021-10-21 11:14:24 +08:00
|
|
|
self.itemPre, nil, Vector2.New(width, rootHight), 1, 1, Vector2.New(0, 20))
|
2021-10-21 10:58:09 +08:00
|
|
|
self.ScrollView.moveTween.MomentumAmount = 1
|
|
|
|
self.ScrollView.moveTween.Strength = 2
|
|
|
|
self.ScrollView.elastic = false
|
|
|
|
self.itemList = {}
|
2021-10-20 18:35:30 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
--绑定事件(用于子类重写)
|
|
|
|
function this:BindEvent()
|
|
|
|
end
|
|
|
|
|
|
|
|
--添加事件监听(用于子类重写)
|
|
|
|
function this:AddListener()
|
|
|
|
end
|
|
|
|
|
|
|
|
--移除事件监听(用于子类重写)
|
|
|
|
function this:RemoveListener()
|
|
|
|
end
|
|
|
|
|
|
|
|
--界面打开时调用(用于子类重写)
|
|
|
|
function this:OnShow(_parent,...)
|
|
|
|
parent=_parent
|
|
|
|
sortingOrder = _parent.sortingOrder
|
|
|
|
local _args = {...}
|
|
|
|
self:Refresh()
|
|
|
|
end
|
|
|
|
|
|
|
|
function this:Refresh()
|
2021-10-21 10:58:09 +08:00
|
|
|
local data = self:GetData()
|
|
|
|
self.ScrollView:SetData(data, function (index, go)
|
|
|
|
self:SingleDataShow(go, data[index],index)
|
2022-01-10 15:05:35 +08:00
|
|
|
end, true, true)
|
2021-10-21 10:58:09 +08:00
|
|
|
self.ScrollView:SetIndex(PracticeManager.PracticeBigLevel)
|
|
|
|
end
|
|
|
|
|
|
|
|
function this:GetData()
|
|
|
|
local data = {}
|
|
|
|
for _, configInfo in ConfigPairs(ConfigManager.GetConfig(ConfigName.XiuXianConfig)) do
|
|
|
|
if configInfo.RealmLevel == 0 then
|
|
|
|
table.insert(data, configInfo)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return data
|
|
|
|
end
|
|
|
|
|
|
|
|
function this:SingleDataShow(_go,_data,_index)
|
|
|
|
Util.GetGameObject(_go,"Title/Text"):GetComponent("Text").text = string.format("%s期",_data.RealmName)
|
|
|
|
local color = PracticeManager.PracticeBigLevel == _data.RealmId and "00ff00" or "AEBEB6"
|
|
|
|
for i = 1, 4 do
|
2021-10-21 11:14:24 +08:00
|
|
|
Util.GetGameObject(_go,"baseAttri/TextPre ("..i..")"):GetComponent("Text").text = string.format("<color=#%s>基础%s %s</color>",color,propertyConfig[_data.ProRank[i][1]].Info,_data.ProRank[i][2])
|
|
|
|
Util.GetGameObject(_go,"proAttri/TextPre ("..i..")"):GetComponent("Text").text = string.format("<color=#%s>每级%s %s</color>",color,propertyConfig[_data.ProLevel[i][1]].Info,_data.ProLevel[i][2])
|
2021-10-21 10:58:09 +08:00
|
|
|
end
|
2021-10-20 18:35:30 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
--界面关闭时调用(用于子类重写)
|
|
|
|
function this:OnClose()
|
|
|
|
end
|
|
|
|
|
|
|
|
--界面销毁时调用(用于子类重写)
|
|
|
|
function this:OnDestroy()
|
|
|
|
this.spLoader:Destroy()
|
2021-10-21 10:58:09 +08:00
|
|
|
self.itemList = {}
|
2021-10-20 18:35:30 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
return this
|