miduo_client/Assets/ManagedResources/~Lua/Modules/Guild/Skill/HeroPotencyInfoPopup.lua

114 lines
3.5 KiB
Lua
Raw Normal View History

2023-10-16 15:12:47 +08:00
require("Base/BasePanel")
HeroPotencyInfoPopup = Inherit(BasePanel)
local this = HeroPotencyInfoPopup
--长按升级状态
local _isReqLvUp=false
local oldPower = 0
local newPower = 0
local oldPropMap={}
local barWidth=700
local dynamicId=""
local type=0
local config=nil
local curIndex=0
local data
local preList={}
local curTabIndex=0
local parPanel=nil
local isCan=true
local lv=0
local giftLv=0
--初始化组件用于子类重写FourQuadrantPopup
function this:InitComponent()
this.spLoader = SpriteLoader.New()
this.mask = Util.GetGameObject(self.gameObject, "mask")
this.backBtn = Util.GetGameObject(self.gameObject, "bg/btnBack")
this.titleText = Util.GetGameObject(self.gameObject, "bg/titleText"):GetComponent("Text")
this.limitHint = Util.GetGameObject(self.gameObject, "bg/limitHint"):GetComponent("Text")
this.griftLv = Util.GetGameObject(self.gameObject, "bg/giftLv"):GetComponent("Text")
this.lvTxt = Util.GetGameObject(self.gameObject, "bg/lvTxt"):GetComponent("Text")
this.upBtn = Util.GetGameObject(self.gameObject, "bg/upBtn")
this.upStarBtn = Util.GetGameObject(self.gameObject, "bg/oneKeyBtn")
this.proUpInfo=Util.GetGameObject(self.gameObject, "bg/proUpInfo"):GetComponent("Text")
this.propWinCloseBtn = Util.GetGameObject(self.gameObject, "upStarPropWin/closeBtn")
this.professionIcon = Util.GetGameObject(self.gameObject, "bg/professionIcon"):GetComponent("Image")
this.jianTou = Util.GetGameObject(self.gameObject, "bg/jiantou")
end
--绑定事件(用于子类重写)
function this:BindEvent()
Util.AddClick(this.backBtn, function()
self:ClosePanel()
end)
Util.AddClick(this.mask, function()
self:ClosePanel()
end)
end
--添加事件监听(用于子类重写)
function this:AddListener()
end
--移除事件监听(用于子类重写)
function this:RemoveListener()
end
--界面打开时调用(用于子类重写)
function this:OnOpen(_type,_lv,_giftLv)
type=_type
lv=_lv
giftLv=_giftLv
this.SwitchView(_type)
end
--切换视图
function this.SwitchView(index)
curTabIndex=index
--ConfigManager.getcon
config=ConfigManager.TryGetConfigDataByKey(ConfigName.PotentialNewConfig,"Type",type)
this.professionIcon.sprite=this.spLoader:LoadSprite(config.Icon)
local curLv=lv+giftLv
local lvEquipConfig= ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.PotentialNew,"Type",type,"Level",lv)
local curEquipConfig= ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.PotentialNew,"Type",type,"Level",curLv)
local nextEquipConfig= ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.PotentialNew,"Type",type,"Level",curLv+1)
this.limitHint.text=lv..""
this.griftLv.text="+"..giftLv
if nextEquipConfig then
this.lvTxt.gameObject:SetActive(true)
this.jianTou:SetActive(true)
this.proUpInfo.text=PoTencyTypeName[index].."基础属性提升"..curEquipConfig.Attribute/100 .."%"
this.lvTxt.text=nextEquipConfig.Attribute/100 .."%"
else
this.lvTxt.gameObject:SetActive(false)
this.jianTou:SetActive(false)
this.proUpInfo.text=PoTencyTypeName[index].."基础属性提升"..curEquipConfig.Attribute/100 .."%"
end
this.titleText.text=config.Name
end
--界面关闭时调用(用于子类重写)
function this:OnClose()
if parPanel then
parPanel.RefreshWindowData()
end
end
function this:OnDestroy()
this.spLoader:Destroy()
preList={}
end
return HeroPotencyInfoPopup