require("Base/BasePanel") local IncarnationForcePanel = Inherit(BasePanel) local this=IncarnationForcePanel local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig) function IncarnationForcePanel:InitComponent() self.spLoader = SpriteLoader.New() self.mask = Util.GetGameObject(self.gameObject,"Mask") self.backBtn = Util.GetGameObject(self.gameObject,"Frame/backBtn") self.helpBtn = Util.GetGameObject(self.gameObject,"Frame/helpBtn") self.grid = Util.GetGameObject(self.gameObject,"Frame/Grid") self.textPre = Util.GetGameObject(self.grid,"TextPre") self.textPre:SetActive(false) self.Tips = Util.GetGameObject(self.gameObject,"Frame/Tips"):GetComponent("Text") self.title = Util.GetGameObject(self.gameObject,"Frame/Bg/title/Text"):GetComponent("Text") self.Slide = Util.GetGameObject(self.gameObject,"Frame/Slide") self.level = Util.GetGameObject(self.Slide,"level"):GetComponent("Text") self.power = Util.GetGameObject(self.Slide,"powerBtn/value"):GetComponent("Text") self.value = Util.GetGameObject(self.Slide,"Text"):GetComponent("Text") self.fill = Util.GetGameObject(self.Slide,"fill") self.upGradeBtn = Util.GetGameObject(self.Slide,"Button") self.btnText = Util.GetGameObject(self.upGradeBtn,"Text"):GetComponent("Text") self.btnRed = Util.GetGameObject(self.upGradeBtn,"RedPoint") self.textPreList = {} end function IncarnationForcePanel:BindEvent() --帮助按钮 Util.AddOnceClick(self.helpBtn, function() UIManager.OpenPanel(UIName.GeneralInfoPopup, GENERALINFO_TYPE.Cultivation) end) Util.AddOnceClick(self.mask, function() self:ClosePanel() end) Util.AddOnceClick(self.backBtn, function() self:ClosePanel() end) Util.AddOnceClick(self.upGradeBtn, function() if this.configData.Level>=50 then PopupTipPanel.ShowTip("等级已达上限") return end local curHaveItemNum=BagManager.GetItemCountById(this.configData.ExpCost[1]) local curCostItemNum=this.configData.ExpCost[2] if curHaveItemNum curCostItemNum then self.fill:GetComponent("RectTransform").sizeDelta = Vector3.New(445,26,0) this.btnRed.gameObject:SetActive(true) else local size = curHaveItemNum/curCostItemNum self.fill:GetComponent("RectTransform").sizeDelta = Vector3.New(445*size,26,0) end self.btnText.text = "升 级" else self.value.text = string.format("") self.fill:GetComponent("RectTransform").sizeDelta = Vector3.New(445,26,0) self.btnText.text = "已达上限" self.btnText.fontSize=35 end end --设置单个数据 function IncarnationForcePanel:SetSingleData(_go,data,_index) local proName = Util.GetGameObject(_go,"PropertyName"):GetComponent("Text") local Calculate = Util.GetGameObject(_go,"Calculate"):GetComponent("Text") if IncarnationManager.incarnationForceLv == 0 then proName.text = string.format("%s:+0%%",propertyConfig[data[1]].Info) else proName.text = string.format("%s:+%s%%",propertyConfig[data[1]].Info,data[2]/100) end if this.nextConfigData then local addProp=this.nextConfigData.PropList[_index][2]-data[2] Calculate.text=string.format("(+%s%%)",addProp/100) Calculate.gameObject:SetActive(true) else Calculate.gameObject:SetActive(false) end end function IncarnationForcePanel:OnClose() Game.GlobalEvent:DispatchEvent(GameEvent.CommonEvent.RefreshIncarnationPanelUp) end function IncarnationForcePanel:OnDestroy() self.spLoader:Destroy() self.textPreList = {} end return IncarnationForcePanel