local this = {} --传入父脚本模块 local parent --传入特效层级 local sortingOrder=0 local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig) --初始化组件(用于子类重写) function this:InitComponent(gameObject) this.spLoader = SpriteLoader.New() 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, self.itemPre, nil, Vector2.New(width, rootHight), 1, 1, Vector2.New(0, 20)) self.ScrollView.moveTween.MomentumAmount = 1 self.ScrollView.moveTween.Strength = 2 self.ScrollView.elastic = false self.itemList = {} 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() local data = self:GetData() self.ScrollView:SetData(data, function (index, go) self:SingleDataShow(go, data[index],index) end, true, true) 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 Util.GetGameObject(_go,"baseAttri/TextPre ("..i..")"):GetComponent("Text").text = string.format("基础%s %s",color,propertyConfig[_data.ProRank[i][1]].Info,_data.ProRank[i][2]) Util.GetGameObject(_go,"proAttri/TextPre ("..i..")"):GetComponent("Text").text = string.format("每级%s %s",color,propertyConfig[_data.ProLevel[i][1]].Info,_data.ProLevel[i][2]) end end --界面关闭时调用(用于子类重写) function this:OnClose() end --界面销毁时调用(用于子类重写) function this:OnDestroy() this.spLoader:Destroy() self.itemList = {} end return this