2023-03-30 13:16:11 +08:00
|
|
|
|
require("Base/BasePanel")
|
|
|
|
|
GodWeaponInfoPanel = Inherit(BasePanel)
|
|
|
|
|
local this = GodWeaponInfoPanel
|
|
|
|
|
local godwData
|
|
|
|
|
--初始化组件(用于子类重写)
|
|
|
|
|
function this:InitComponent()
|
|
|
|
|
this.btnBack = Util.GetGameObject(self.gameObject, "btnBack")
|
|
|
|
|
this.spLoader = SpriteLoader.New()
|
|
|
|
|
this.icon= Util.GetGameObject(self.gameObject, "iconBg/icon"):GetComponent("Image")
|
|
|
|
|
this.nameText=Util.GetGameObject(self.gameObject, "nameInfo/nameText"):GetComponent("Text")
|
2023-03-30 16:27:13 +08:00
|
|
|
|
this.starGrid= Util.GetGameObject(self.gameObject, "starGrid/starGrid")
|
2023-03-30 13:16:11 +08:00
|
|
|
|
this.propGrid=Util.GetGameObject(self.gameObject, "infoLayout/propertyInfo/grid")
|
|
|
|
|
this.upStarBtn=Util.GetGameObject(self.gameObject,"infoLayout/propertyInfo/upStarBtn")
|
|
|
|
|
this.upLvBtn=Util.GetGameObject(self.gameObject,"infoLayout/propertyInfo/upLvBtn")
|
|
|
|
|
this.skillGrid=Util.GetGameObject(self.gameObject,"infoLayout/skill/scroll/grid")
|
2023-03-31 17:52:12 +08:00
|
|
|
|
this.unloadBtn = Util.GetGameObject(self.gameObject, "infoLayout/unloadBtn")
|
|
|
|
|
this.changeBtn = Util.GetGameObject(self.gameObject, "infoLayout/changeBtn")
|
2023-04-04 14:54:14 +08:00
|
|
|
|
this.upLvBtnRedPoint = Util.GetGameObject(this.upLvBtn, "redPoint")
|
|
|
|
|
this.upStarBtnRedPoint = Util.GetGameObject(this.upStarBtn, "redPoint")
|
2023-03-30 13:16:11 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--绑定事件(用于子类重写)
|
|
|
|
|
function this:BindEvent()
|
|
|
|
|
Util.AddClick(this.btnBack, function()
|
|
|
|
|
self:ClosePanel()
|
|
|
|
|
end)
|
2023-04-04 14:54:14 +08:00
|
|
|
|
Util.AddClick(this.upLvBtn, function()
|
2023-03-30 13:16:11 +08:00
|
|
|
|
UIManager.OpenPanel(UIName.GodWeaponUpPanel,1,godwData)
|
|
|
|
|
end)
|
2023-04-04 14:54:14 +08:00
|
|
|
|
Util.AddClick(this.upStarBtn, function()
|
2023-03-30 13:16:11 +08:00
|
|
|
|
UIManager.OpenPanel(UIName.GodWeaponUpPanel,2,godwData)
|
|
|
|
|
end)
|
2023-04-04 14:54:14 +08:00
|
|
|
|
|
2023-03-31 17:52:12 +08:00
|
|
|
|
Util.AddClick(this.unloadBtn, function()
|
2023-04-04 11:59:36 +08:00
|
|
|
|
local oldWarPower = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL)
|
2023-03-31 17:52:12 +08:00
|
|
|
|
NetManager.RequestMagicSoldierLocation(godwData.Did,0,function()
|
|
|
|
|
PopupTipPanel.ShowTip("下阵成功")
|
|
|
|
|
this.unloadBtn.gameObject:SetActive(false)
|
|
|
|
|
this.changeBtn.gameObject:SetActive(false)
|
|
|
|
|
GodWeaponManager.SetWeaponUpZhen(godwData.Did,0)
|
2023-04-04 11:59:36 +08:00
|
|
|
|
local newWarPower = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL)
|
|
|
|
|
--飘战力
|
|
|
|
|
PokemonManager.PiaoWarPowerChange(oldWarPower,newWarPower)
|
2023-03-31 17:52:12 +08:00
|
|
|
|
end)
|
|
|
|
|
end)
|
|
|
|
|
Util.AddClick(this.changeBtn, function()
|
|
|
|
|
UIManager.OpenPanel(UIName.GodWeaponListPanel,1,godwData,godwData.point)
|
|
|
|
|
end)
|
2023-03-30 13:16:11 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--添加事件监听(用于子类重写)
|
|
|
|
|
function this:AddListener()
|
2023-03-31 18:20:38 +08:00
|
|
|
|
Game.GlobalEvent:AddEvent(GameEvent.GodWeapon.RefreshGodWeaponInfoPanel, this.UpdateWin)
|
2023-03-30 13:16:11 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--移除事件监听(用于子类重写)
|
|
|
|
|
function this:RemoveListener()
|
2023-03-31 18:20:38 +08:00
|
|
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.GodWeapon.RefreshGodWeaponInfoPanel, this.UpdateWin)
|
2023-03-30 13:16:11 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面打开时调用(用于子类重写)
|
|
|
|
|
function this:OnOpen(_data)
|
2023-04-03 11:18:04 +08:00
|
|
|
|
this.unloadBtn.gameObject:SetActive(true)
|
|
|
|
|
this.changeBtn.gameObject:SetActive(true)
|
2023-03-31 18:20:38 +08:00
|
|
|
|
this.UpdateWin(_data)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.UpdateWin(_data)
|
2023-03-30 13:16:11 +08:00
|
|
|
|
godwData=_data
|
2023-04-04 14:54:14 +08:00
|
|
|
|
local upLvRed = GodWeaponManager.CheckUpLvRedPoint(godwData)
|
|
|
|
|
this.upLvBtnRedPoint:SetActive(upLvRed)
|
|
|
|
|
local upStarRed = GodWeaponManager.CheckUpStarRedPoint(godwData)
|
|
|
|
|
this.upStarBtnRedPoint:SetActive(upStarRed)
|
2023-03-30 13:16:11 +08:00
|
|
|
|
this.icon.sprite = this.spLoader:LoadSprite(GetResourcePath(_data.config.Icon))
|
|
|
|
|
this.nameText.text=_data.config.Name
|
2023-03-30 16:27:13 +08:00
|
|
|
|
local starSize = Vector2.New(65,65)
|
2023-03-31 18:20:38 +08:00
|
|
|
|
PokemonManager.SetHeroStars(this.spLoader, this.starGrid,_data.star,1,starSize)
|
2023-03-30 13:16:11 +08:00
|
|
|
|
local allPropDic=GodWeaponManager.GetSinglePokemonAddProData(_data.Did,_data.star)
|
|
|
|
|
local propInfoList={}
|
|
|
|
|
propInfoList[1]={}
|
|
|
|
|
propInfoList[1].name="等级"
|
|
|
|
|
propInfoList[1].val=_data.lv
|
|
|
|
|
local index=2
|
|
|
|
|
for key, value in pairs(allPropDic) do
|
|
|
|
|
propInfoList[index]={}
|
|
|
|
|
local propConfig=ConfigManager.GetConfigData(ConfigName.PropertyConfig,key)
|
|
|
|
|
propInfoList[index].name=propConfig.Info
|
|
|
|
|
propInfoList[index].val=value
|
|
|
|
|
index=index+1
|
|
|
|
|
end
|
|
|
|
|
for i = 1, this.propGrid.transform.childCount do
|
|
|
|
|
local propText=this.propGrid.transform:GetChild(i-1).gameObject
|
|
|
|
|
if i>#propInfoList then
|
|
|
|
|
propText:SetActive(false)
|
|
|
|
|
else
|
|
|
|
|
propText:SetActive(true)
|
|
|
|
|
propText:GetComponent("Text").text=propInfoList[i].name
|
|
|
|
|
Util.GetGameObject(propText,"val"):GetComponent("Text").text=propInfoList[i].val
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local skillInfo=GodWeaponManager.GetSingleGodWeaponSkillDes(_data.Did)
|
|
|
|
|
for i = 1,this.skillGrid.transform.childCount do
|
|
|
|
|
local skillObj=this.skillGrid.transform:GetChild(i-1).gameObject
|
|
|
|
|
if i>#skillInfo then
|
|
|
|
|
skillObj:SetActive(false)
|
|
|
|
|
else
|
|
|
|
|
Util.GetGameObject(skillObj,"titleBg/title"):GetComponent("Text").text=skillInfo[i].title
|
|
|
|
|
Util.GetGameObject(skillObj,"des"):GetComponent("Text").text=skillInfo[i].des
|
|
|
|
|
skillObj:SetActive(true)
|
2023-03-30 16:27:13 +08:00
|
|
|
|
local allSkillData=ConfigManager.GetAllConfigsDataByDoubleKey(ConfigName.ShenBingSkill,"SkillPanDuan",skillInfo[i].skillPanDuan,"SpiritAnimalMatch",_data.id)
|
2023-03-30 13:16:11 +08:00
|
|
|
|
local helpBtn=Util.GetGameObject(skillObj,"titleBg/helpBtn")
|
|
|
|
|
Util.AddOnceClick(helpBtn, function()
|
2023-03-30 16:27:13 +08:00
|
|
|
|
UIManager.OpenPanel(UIName.GodWeaponSkillInfoPopup,skillInfo[i].title,allSkillData)
|
2023-03-30 13:16:11 +08:00
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
LayoutRebuilder.ForceRebuildLayoutImmediate(this.skillGrid.transform)
|
|
|
|
|
end
|
|
|
|
|
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
|
|
|
|
|
function this:OnShow()
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this:OnSortingOrderChange()
|
|
|
|
|
this.sortingOrder = self.sortingOrder
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--界面关闭时调用(用于子类重写)
|
|
|
|
|
function this:OnClose()
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面销毁时调用(用于子类重写)
|
|
|
|
|
function this:OnDestroy()
|
|
|
|
|
this.spLoader:Destroy()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return this
|