miduo_client/Assets/ManagedResources/~Lua/Modules/GeneralPanel/View2/GeneralInfoPopup_PracticeLe...

75 lines
2.3 KiB
Lua

local this = {}
--传入父脚本模块
local parent
--传入特效层级
local sortingOrder=0
local XiuXianSkillConfig = ConfigManager.GetConfig(ConfigName.XiuXianSkillConfig)
--初始化组件(用于子类重写)
function this:InitComponent(gameObject)
this.skillName = Util.GetGameObject(gameObject, "Title/Text"):GetComponent("Text")
-- this.state=Util.GetGameObject(gameObject,"State"):GetComponent("Image")
this.addList = Util.GetGameObject(gameObject, "AddList")
this.TextPre = Util.GetGameObject(this.addList, "TextPre")
this.addTextList = {}
end
--绑定事件(用于子类重写)
function this:BindEvent()
end
--添加事件监听(用于子类重写)
function this:AddListener()
end
--移除事件监听(用于子类重写)
function this:RemoveListener()
end
--界面打开时调用(用于子类重写)
function this:OnShow(_parent,...)
parent=_parent
sortingOrder = _parent.sortingOrder
local _args = {...}
local data = _args[1]
this.skillName.text = data.RealmName
if not this.addTextList then
this.addTextList = {}
end
for k,v in ipairs(this.addTextList) do
v.gameObject:SetActive(false)
end
for i = 1, #data.TotalPros do
local adddata = data.TotalPros[i]
if not this.addTextList[i] then
this.addTextList[i] = newObject(this.TextPre)
this.addTextList[i].transform:SetParent(this.addList.transform)
this.addTextList[i].transform.localScale = Vector3.one
this.addTextList[i].transform.localPosition = Vector3.zero
end
this.addTextList[i]:SetActive(true)
local str = PracticeManager.GetSingleAddition(adddata)
this.addTextList[i]:GetComponent("Text").text = str
if data.State == 1 then
this.addTextList[i]:GetComponent("Text").text = string.format("<color=#29FF00>%s</color>",str)
end
end
-- 背景透明
parent.backBtn:GetComponent("Image").color = Color.New(0, 0, 0, 0)
end
--界面关闭时调用(用于子类重写)
function this:OnClose()
-- 还原透明度
if parent then
parent.backBtn:GetComponent("Image").color = Color.New(0, 0, 0, 200)
end
end
--界面销毁时调用(用于子类重写)
function this:OnDestroy()
this.addTextList = {}
end
return this