require("Base/BasePanel") RoleEquipTreasureChangePopup = Inherit(BasePanel) local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig) local spcialConfig = ConfigManager.GetConfig(ConfigName.SpecialConfig) local this=RoleEquipTreasureChangePopup local type--1 穿装备 2 卸装备 3 替换装备 local curHeroData local curEquipData local nextEquipData local openThisPanel local equipIdList local equipDataList local position local curMainpropertyList={} local nextMainPropertyList={} local curPropertyList={} local nextPropertyList={} --初始化组件(用于子类重写) function RoleEquipTreasureChangePopup:InitComponent() this.btnBack= Util.GetGameObject(self.transform, "btnBack") this.bg1= Util.GetGameObject(self.transform, "GameObject/bg1") this.desc1= Util.GetGameObject(self.transform, "GameObject/bg1/equipInfo/Text"):GetComponent("Text") this.currEquipProImg=Util.GetGameObject(self.transform, "GameObject/bg1/equipInfo/proImg"):GetComponent("Image") this.curEquipName=Util.GetGameObject(self.transform, "GameObject/bg1/equipInfo/name/text"):GetComponent("Text") this.curEquipFrame=Util.GetGameObject(self.transform, "GameObject/bg1/equipInfo/frame"):GetComponent("Image") this.curEquipIcon=Util.GetGameObject(self.transform, "GameObject/bg1/equipInfo/icon"):GetComponent("Image") this.curEquipTypeText=Util.GetGameObject(self.transform, "GameObject/bg1/equipInfo/equipTypeText"):GetComponent("Text") this.curEquipLvText=Util.GetGameObject(self.transform, "GameObject/bg1/equipInfo/lvTxt"):GetComponent("Text") this.curEquipRefineLvTxt=Util.GetGameObject(self.transform, "GameObject/bg1/equipInfo/starTxt"):GetComponent("Text") this.curRefinePropertyTxt=Util.GetGameObject(self.transform, "GameObject/bg1/mainPro/Text2") this.curEquipBtns=Util.GetGameObject(self.transform, "GameObject/bg1/btns") this.curEquipBtnStrong=Util.GetGameObject(self.transform, "GameObject/bg1/btns/btnStrong") this.curEquipBtnRefine=Util.GetGameObject(self.transform, "GameObject/bg1/btns/btnRefine") this.curEquipBtnRemove=Util.GetGameObject(self.transform, "GameObject/bg1/btns/btnRemove") this.curEquipBtnAdd=Util.GetGameObject(self.transform, "GameObject/bg1/btns/btnAdd") this.curEquipBtnChange=Util.GetGameObject(self.transform, "GameObject/bg1/btns/btnChange") this.qualityText=Util.GetGameObject(self.transform, "GameObject/bg1/equipInfo/qualityText"):GetComponent("Text") this.powerNum1=Util.GetGameObject(self.transform, "GameObject/bg1/equipInfo/powerNum"):GetComponent("Text") this.powerUPorDown1=Util.GetGameObject(self.transform, "GameObject/bg1/equipInfo/powerUPorDown") this.propertyPre=Util.GetGameObject(self.transform, "GameObject/bg1/PropertyTxt") this.curEquipSign=Util.GetGameObject(self.transform, "GameObject/bg1/Text") this.curMainPropertyGrid=Util.GetGameObject(self.transform, "GameObject/bg1/mainPro/grid") this.nextMainPropertyGrid=Util.GetGameObject(self.transform, "GameObject/bg2/mainPro/grid") this.propertyPre:SetActive(false) this.curPropertyGrid=Util.GetGameObject(self.transform, "GameObject/bg1/grid") this.bg2= Util.GetGameObject(self.transform, "GameObject/bg2") this.nextPropertyGrid=Util.GetGameObject(self.transform, "GameObject/bg2/grid") this.nextRefinePropertyTxt=Util.GetGameObject(self.transform, "GameObject/bg2/mainPro/Text2") this.desc2= Util.GetGameObject(self.transform, "GameObject/bg2/equipInfo/Text"):GetComponent("Text") this.nextEquipName=Util.GetGameObject(self.transform, "GameObject/bg2/equipInfo/name/text"):GetComponent("Text") this.nextEquipFrame=Util.GetGameObject(self.transform, "GameObject/bg2/equipInfo/frame"):GetComponent("Image") this.nextEquipIcon=Util.GetGameObject(self.transform, "GameObject/bg2/equipInfo/icon"):GetComponent("Image") this.nextEquipTypeText=Util.GetGameObject(self.transform, "GameObject/bg2/equipInfo/equipTypeText"):GetComponent("Text") this.nextEquipLvText=Util.GetGameObject(self.transform, "GameObject/bg2/equipInfo/lvTxt"):GetComponent("Text") this.nextEquipBtns=Util.GetGameObject(self.transform, "GameObject/bg2/btns") this.nextEquipBtns:SetActive(false) this.nextEquipProImg=Util.GetGameObject(self.transform, "GameObject/bg2/equipInfo/proImg"):GetComponent("Image") this.nextEquipBtnStrong=Util.GetGameObject(self.transform, "GameObject/bg2/btns/btnStrong") this.nextEquipBtnRefine=Util.GetGameObject(self.transform, "GameObject/bg2/btns/btnRefine") this.nextEquipBtnRemove=Util.GetGameObject(self.transform, "GameObject/bg2/btns/btnRemove") this.nextEquipBtnAdd=Util.GetGameObject(self.transform, "GameObject/bg2/btns/btnAdd") this.nextEquipBtnChange=Util.GetGameObject(self.transform, "GameObject/bg2/btns/btnChange") this.qualityText2=Util.GetGameObject(self.transform, "GameObject/bg2/equipInfo/qualityText"):GetComponent("Text") this.GameObject=Util.GetGameObject(self.transform, "GameObject") this.powerNum2=Util.GetGameObject(self.transform, "GameObject/bg2/equipInfo/powerNum"):GetComponent("Text") this.powerUPorDown2=Util.GetGameObject(self.transform, "GameObject/bg2/equipInfo/powerUPorDown") this.nextEquipRefineLvTxt=Util.GetGameObject(self.transform, "GameObject/bg2/equipInfo/starTxt"):GetComponent("Text") end --绑定事件(用于子类重写) function RoleEquipTreasureChangePopup:BindEvent() Util.AddClick(this.btnBack, function() PlaySoundWithoutClick(SoundConfig.Sound_UICancel) self:ClosePanel() end) Util.AddClick(this.curEquipBtnRemove, function() equipIdList={} equipDataList={} table.insert(equipIdList,curEquipData.idDyn) table.insert(equipDataList,curEquipData) NetManager.EquipUnLoadOptRequest(curHeroData.dynamicId,equipIdList ,2,function () self:ClosePanel() openThisPanel.UpdateEquipPosHeroData(2,type,equipDataList) end) end) Util.AddClick(this.curEquipBtnAdd, function() local config=spcialConfig[40] if config then local limits = string.split(config.Value, "|") if limits then local heroConfig=ConfigManager.GetConfigData(ConfigName.HeroConfig,curHeroData.id) local lvs=string.split(limits[1],"#") local stars=string.split(limits[2],"#") local lv=tonumber(lvs[2]) if PlayerManager.levelnextPower) then this.powerUPorDown1:SetActive(true) this.powerUPorDown1:GetComponent("Image").sprite=Util.LoadSprite(PowerChangeIconDef[1]) elseif(curPowercurPower then this.powerUPorDown2:SetActive(true) this.powerUPorDown2:GetComponent("Image").sprite=Util.LoadSprite(PowerChangeIconDef[1]) elseif nextPower=index then _preList[i]:SetActive(false) end end end --界面关闭时调用(用于子类重写) function RoleEquipTreasureChangePopup:OnClose() end --界面销毁时调用(用于子类重写) function RoleEquipTreasureChangePopup:OnDestroy() type=0--1 穿装备 2 卸装备 3 替换装备 curHeroData=nil curEquipData=nil nextEquipData=nil openThisPanel=nil equipIdList=nil equipDataList=nil position=0 curMainpropertyList={} nextMainPropertyList={} curPropertyList={} nextPropertyList={} end return RoleEquipTreasureChangePopup