108 lines
3.4 KiB
Lua
108 lines
3.4 KiB
Lua
require("Base/BasePanel")
|
|
PowerCenterLinkWinPanel = Inherit(BasePanel)
|
|
local this = PowerCenterLinkWinPanel
|
|
local PowerCenterConfig = ConfigManager.GetConfig(ConfigName.PowerCenterConfig)
|
|
local cur, func = {}, nil
|
|
local item, equips = nil, {}
|
|
--初始化组件(用于子类重写)
|
|
function PowerCenterLinkWinPanel:InitComponent()
|
|
this.Mask = Util.GetGameObject(this.gameObject, "mask")
|
|
this.btnSure = Util.GetGameObject(this.gameObject, "btnSure")
|
|
this.pos = Util.GetGameObject(this.gameObject, "pos")
|
|
this.pros = {}
|
|
for i = 1, 5 do
|
|
local pro = Util.GetGameObject(this.gameObject, "pros/pro"..i)
|
|
this.pros[i] = {
|
|
cur = Util.GetGameObject(pro, "cur"):GetComponent("Text"),
|
|
new = Util.GetGameObject(pro, "new"):GetComponent("Text"),
|
|
}
|
|
end
|
|
this.equipGrid = {}
|
|
for i = 1, 4 do
|
|
this.equipGrid[i] = Util.GetGameObject(this.gameObject, "equip/equip"..i)
|
|
end
|
|
end
|
|
|
|
--绑定事件(用于子类重写)
|
|
function PowerCenterLinkWinPanel:BindEvent()
|
|
Util.AddClick(this.btnSure,function()
|
|
this:ClosePanel()
|
|
if func then
|
|
func()
|
|
end
|
|
end)
|
|
Util.AddClick(this.Mask, function()
|
|
this:ClosePanel()
|
|
if func then
|
|
func()
|
|
end
|
|
end)
|
|
end
|
|
|
|
--添加事件监听(用于子类重写)
|
|
function PowerCenterLinkWinPanel:AddListener()
|
|
end
|
|
|
|
--移除事件监听(用于子类重写)
|
|
function PowerCenterLinkWinPanel:RemoveListener()
|
|
end
|
|
|
|
--界面打开时调用(用于子类重写)
|
|
function PowerCenterLinkWinPanel:OnOpen(_cur, _func)
|
|
cur, func = _cur, _func
|
|
this.SetInfo()
|
|
end
|
|
|
|
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
|
|
function PowerCenterLinkWinPanel:OnShow()
|
|
end
|
|
|
|
--界面关闭时调用(用于子类重写)
|
|
function PowerCenterLinkWinPanel:OnClose()
|
|
end
|
|
|
|
--界面销毁时调用(用于子类重写)
|
|
function PowerCenterLinkWinPanel:OnDestroy()
|
|
cur, func = {}, nil
|
|
item, equips = nil, {}
|
|
end
|
|
|
|
function this.SetInfo()
|
|
local new = HeroManager.GetSingleHeroData(cur.dynamicId)
|
|
if not item then
|
|
item = SubUIManager.Open(SubUIConfig.ItemView, this.pos.transform)
|
|
end
|
|
item:OnOpen(false, {new.id, 0}, 1)
|
|
item:SetCorner(6, true, {lv = new.lv, star = new.star})
|
|
item:ClickEnable(false)
|
|
|
|
for i = 1, #new.equipIdList do
|
|
if not equips[i] then
|
|
equips[i] = SubUIManager.Open(SubUIConfig.ItemView, this.equipGrid[i].transform)
|
|
end
|
|
local data = EquipManager.GetSingleEquipData(new.equipIdList[i])
|
|
equips[i]:OnOpen(false, {data.itemConfig.Id, 0}, 0.75)
|
|
end
|
|
local allAddProVal = HeroManager.CalculateHeroAllProValList(1, cur.dynamicId, false)
|
|
for i = 1, #this.pros do
|
|
if i == 1 then
|
|
this.pros[i].cur.text = cur.lv
|
|
this.pros[i].new.text = new.lv
|
|
elseif i == 2 then
|
|
this.pros[i].cur.text = cur.hp
|
|
this.pros[i].new.text = allAddProVal[HeroProType.Hp]
|
|
elseif i == 3 then
|
|
this.pros[i].cur.text = cur.attack
|
|
this.pros[i].new.text = allAddProVal[HeroProType.Attack]
|
|
elseif i == 4 then
|
|
this.pros[i].cur.text = cur.pDef
|
|
this.pros[i].new.text = allAddProVal[HeroProType.PhysicalDefence]
|
|
elseif i == 5 then
|
|
this.pros[i].cur.text = cur.speed
|
|
this.pros[i].new.text = allAddProVal[HeroProType.Speed]
|
|
end
|
|
|
|
end
|
|
end
|
|
|
|
return PowerCenterLinkWinPanel |