miduo_client/Assets/ManagedResources/~Lua/Modules/RoleInfo/SpecailTrainingInfoPopup.lua

139 lines
5.2 KiB
Lua

require("Base/BasePanel")
SpecailTrainingInfoPopup = Inherit(BasePanel)
----- 修行境界预览弹窗 -----
-- SpecailTrainingInfoPopup = {}
--传入父脚本模块
local parent
local _HeroTraining
local Training = ConfigManager.GetConfig(ConfigName.Train)
function SpecailTrainingInfoPopup:InitComponent()
self.titleText = Util.GetGameObject(self.gameObject,"Panel/Title"):GetComponent("Text")
self.itemPre = Util.GetGameObject(self.gameObject,"Panel/Pre")
self.GameObject = Util.GetGameObject(self.gameObject,"Panel/Scroll")
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.preList = {}
self.textList = {}
end
function SpecailTrainingInfoPopup:BindEvent()
end
function SpecailTrainingInfoPopup:AddListener()
end
function SpecailTrainingInfoPopup:RemoveListener()
end
function SpecailTrainingInfoPopup:OnShow(_args)
_HeroTraining = _args
--不定参中包含的不定参 _args[1]为面板类型 _args[2]之后(包括)为打开面板后传入的不定参
self.titleText.text = "特训"
--self.previewData = PracticeManager.GetPreViewData()
local showList={}
local tData=ConfigManager.TryGetAllConfigsDataByKey(ConfigName.Train,"Id",_HeroTraining.HeroId)
if tData then
for k,v in ipairs(tData) do
if not showList[v.Id] then
showList[v.Id]=v
end
end
end
self.ScrollView:SetData(self.previewData, function(index, go)
self:SetSingleData(index,go,showList)
end)
ForceRebuildLayout(self.GameObject.transform)
-- self.ScrollView:SetIndex(PracticeManager.PracticeBigLevel)
end
function SpecailTrainingInfoPopup:SetSingleData(index,_go,_data)
-- local title = Util.GetGameObject(_go,"title/Text"):GetComponent("Text")
-- local specialText = Util.GetGameObject(_go,"SpecialText"):GetComponent("Text")
-- local textPre = Util.GetGameObject(_go,"Content/Text")
-- local content = Util.GetGameObject(_go,"Content")
-- local star = Util.GetGameObject(_go,"title/Star"):GetComponent("Text")
-- local starImg = Util.GetGameObject(_go,"title/Image")
-- if not self.textList[_go] then
-- self.textList[_go] = {}
-- end
-- local singleTextList = self.textList[_go]
-- for k,v in ipairs(singleTextList) do
-- v.gameObject:SetActive(false)
-- end
-- --进行排序
-- local templist = {}
-- for key, value in pairs(_data.AddList) do
-- local sData = {}
-- sData.id = key
-- sData.value = value
-- table.insert(templist,sData)
-- end
-- table.sort(templist,function (a,b)
-- return a.id < b.id
-- end)
-- --显示文字
-- for i = 1, #templist do
-- if not singleTextList[i] then
-- singleTextList[i] = newObject(textPre)
-- singleTextList[i].transform:SetParent(content.transform)
-- singleTextList[i].transform.localScale = Vector3.one
-- singleTextList[i].transform.localPosition = Vector3.zero
-- end
-- local Text = singleTextList[i]:GetComponent("Text")
-- local num = Util.GetGameObject(singleTextList[i],"num"):GetComponent("Text")
-- local string,string2 = PracticeManager.GetPreviewSingleText(templist[i].id,templist[i].value)
-- singleTextList[i]:SetActive(true)
-- Text.text = string
-- num.text = string2
-- if _data.IsActive == 2 then
-- Text.text = string.format("<color=#00ff00>%s</color>",string)
-- num.text = string.format("<color=#00ff00>%s</color>",string2)
-- elseif _data.IsActive == 1 and not XiuXianConfig[PracticeManager.PracticeLevel].LevelUpCost then
-- Text.text = string.format("<color=#00ff00>%s</color>",string)
-- num.text = string.format("<color=#00ff00>%s</color>",string2)
-- end
-- end
-- if _data.RealmDesc then
-- specialText.gameObject:SetActive(true)
-- specialText.text = _data.RealmDesc
-- if _data.IsActive == 1 or _data.IsActive == 2 then
-- specialText.text = string.format("<color=#00ff00>%s</color>",_data.RealmDesc)
-- end
-- else
-- specialText.gameObject:SetActive(false)
-- end
-- title.text = string.format("%s期",_data.RealmName)
-- if _data.NeedStarNum ~= 0 then
-- star.gameObject:SetActive(true)
-- starImg.gameObject:SetActive(true)
-- if _data.NeedStarNum > PracticeManager.StarNum then
-- star.text = string.format("<color=red>需要%s</color>",_data.NeedStarNum)
-- else
-- star.text = string.format("<color=#00ff00>需要%s</color>",_data.NeedStarNum)
-- end
-- else
-- star.gameObject:SetActive(false)
-- starImg.gameObject:SetActive(false)
-- end
-- ForceRebuildLayout(_go.transform)
-- _go:SetActive(true)
end
function SpecailTrainingInfoPopup:OnClose()
end
function SpecailTrainingInfoPopup:OnDestroy()
self.textList = {}
end
return SpecailTrainingInfoPopup