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") this.starGrid= Util.GetGameObject(self.gameObject, "starGrid/starGrid") 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") this.unloadBtn = Util.GetGameObject(self.gameObject, "infoLayout/unloadBtn") this.changeBtn = Util.GetGameObject(self.gameObject, "infoLayout/changeBtn") this.upLvBtnRedPoint = Util.GetGameObject(this.upLvBtn, "redPoint") this.upStarBtnRedPoint = Util.GetGameObject(this.upStarBtn, "redPoint") end --绑定事件(用于子类重写) function this:BindEvent() Util.AddClick(this.btnBack, function() self:ClosePanel() end) Util.AddClick(this.upLvBtn, function() UIManager.OpenPanel(UIName.GodWeaponUpPanel,1,godwData) end) Util.AddClick(this.upStarBtn, function() UIManager.OpenPanel(UIName.GodWeaponUpPanel,2,godwData) end) Util.AddClick(this.unloadBtn, function() local oldWarPower = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL) NetManager.RequestMagicSoldierLocation(godwData.Did,0,function() PopupTipPanel.ShowTip("下阵成功") this.unloadBtn.gameObject:SetActive(false) this.changeBtn.gameObject:SetActive(false) GodWeaponManager.SetWeaponUpZhen(godwData.Did,0) local newWarPower = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL) --飘战力 PokemonManager.PiaoWarPowerChange(oldWarPower,newWarPower) end) end) Util.AddClick(this.changeBtn, function() UIManager.OpenPanel(UIName.GodWeaponListPanel,1,godwData,godwData.point) end) end --添加事件监听(用于子类重写) function this:AddListener() Game.GlobalEvent:AddEvent(GameEvent.GodWeapon.RefreshGodWeaponInfoPanel, this.UpdateWin) end --移除事件监听(用于子类重写) function this:RemoveListener() Game.GlobalEvent:RemoveEvent(GameEvent.GodWeapon.RefreshGodWeaponInfoPanel, this.UpdateWin) end --界面打开时调用(用于子类重写) function this:OnOpen(_data) this.unloadBtn.gameObject:SetActive(true) this.changeBtn.gameObject:SetActive(true) this.UpdateWin(_data) end function this.UpdateWin(_data) godwData=_data local upLvRed = GodWeaponManager.CheckUpLvRedPoint(godwData) this.upLvBtnRedPoint:SetActive(upLvRed) local upStarRed = GodWeaponManager.CheckUpStarRedPoint(godwData) this.upStarBtnRedPoint:SetActive(upStarRed) this.icon.sprite = this.spLoader:LoadSprite(GetResourcePath(_data.config.Icon)) this.nameText.text=_data.config.Name local starSize = Vector2.New(65,65) PokemonManager.SetHeroStars(this.spLoader, this.starGrid,_data.star,1,starSize) 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) local allSkillData=ConfigManager.GetAllConfigsDataByDoubleKey(ConfigName.ShenBingSkill,"SkillPanDuan",skillInfo[i].skillPanDuan,"SpiritAnimalMatch",_data.id) local helpBtn=Util.GetGameObject(skillObj,"titleBg/helpBtn") Util.AddOnceClick(helpBtn, function() UIManager.OpenPanel(UIName.GodWeaponSkillInfoPopup,skillInfo[i].title,allSkillData) 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