----- 命格选择命石 ----- local this= {} --传入父脚本模块 local parent --传入特效层级 local sortingOrder=0 local args=nil local itemConfig=ConfigManager.GetConfig(ConfigName.ItemConfig) local equipConfig=ConfigManager.GetConfig(ConfigName.EquipConfig) local passiveSkillConfig=ConfigManager.GetConfig(ConfigName.PassiveSkillConfig) local heroConfig=ConfigManager.GetConfig(ConfigName.HeroConfig) local propertyconfig=ConfigManager.GetConfig(ConfigName.PropertyConfig) local soulId=0 local nextSoulId=0 local isCan=true local costIds={} local func=nil local heroId=nil function this:InitComponent(gameObject) self.spLoader = SpriteLoader.New() this.titleTxt=Util.GetGameObject(gameObject,"TitleText"):GetComponent("Text") this.titleTxt.text="神印升品" this.frame=Util.GetGameObject(gameObject,"curGem"):GetComponent("Image") this.icon=Util.GetGameObject(gameObject,"curGem/icon"):GetComponent("Image") this.quan=Util.GetGameObject(gameObject,"curGem/quan"):GetComponent("Image") this.lvTxt=Util.GetGameObject(gameObject,"curGem/lv"):GetComponent("Text") this.nameTxt1=Util.GetGameObject(gameObject,"Property/Text"):GetComponent("Text") this.infoTxt1=Util.GetGameObject(gameObject,"Property/proText"):GetComponent("Text") this.nameTxt2=Util.GetGameObject(gameObject,"Property2/Text"):GetComponent("Text") this.infoTxt2=Util.GetGameObject(gameObject,"Property2/proText"):GetComponent("Text") this.upBtn=Util.GetGameObject(gameObject,"BtnDo") this.itemPre=Util.GetGameObject(gameObject,"Cost/itemPre") this.costList={} for i = 1, 3 do table.insert(this.costList,Util.GetGameObject(gameObject,"Cost/Scroll/itemPre"..i)) end end function this:BindEvent() Util.AddClick(this.upBtn,function() if not isCan then PopupTipPanel.ShowTip("道具不足,无法升品") return end NetManager.UpGodSealRequest(soulId,nextSoulId,heroId,function(msg) -- SoundManager.PlaySound(SoundConfig.UI_Duanzao) SoundManager.PlaySound(SoundConfig.UI_Baoqi) PopupTipPanel.ShowTip("升品成功") parent:ClosePanel() --删除魂印 if heroId then if func then func() end else UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1,function() -- this.StartCompoundSoulPrint(curSelectSoulPrint, true) if func then func() end end) end end) end) end function this:AddListener() end function this:RemoveListener() end function this:OnShow(_parent,_args) parent=_parent soulId=_args[1] heroId=_args[3] func=_args[4] LogError("soulid ==============="..soulId) nextSoulId=equipConfig[soulId].Formula[1][1] LogError("nextsould id=="..nextSoulId) this.frame.sprite = self.spLoader:LoadSprite(GetQuantityImageByquality(equipConfig[soulId].Quality)) this.icon.sprite = self.spLoader:LoadSprite(GetResourcePath(itemConfig[soulId].ResourceID)) this.quan.sprite = self.spLoader:LoadSprite(SoulPrintSpriteByQuantity[equipConfig[soulId].Quality].circle) this.lvTxt.gameObject:SetActive(equipConfig[soulId].Star>0) this.lvTxt.text="+"..equipConfig[soulId].Star this.nameTxt1.text=GetStringByEquipQua(equipConfig[soulId].Quality, GetLanguageStrById(equipConfig[soulId].Name)) this.nameTxt2.text=GetStringByEquipQua(equipConfig[nextSoulId].Quality, GetLanguageStrById(equipConfig[nextSoulId].Name)) this.infoTxt1.text= this:GetGodPrintDes(soulId) this.infoTxt2.text= this:GetGodPrintDes(nextSoulId) local list=equipConfig[soulId].Resource isCan=true for i = 1, #this.costList do if i<=#list then this.costList[i]:SetActive(true) this.costList[i]:GetComponent("Image").sprite=self.spLoader:LoadSprite(GetQuantityImageByquality(itemConfig[list[i][1]].Quantity)) local btnObj=Util.GetGameObject(this.costList[i],"Obj") btnObj:GetComponent("Image").sprite=self.spLoader:LoadSprite(GetResourcePath(itemConfig[list[i][1]].ResourceID)) local quan=Util.GetGameObject(this.costList[i],"quan"):GetComponent("Image") quan.gameObject:SetActive(itemConfig[list[i][1]].ItemBaseType==6) quan.sprite=self.spLoader:LoadSprite(SoulPrintSpriteByQuantity[itemConfig[list[i][1]].Quantity].circle) local numTxt=Util.GetGameObject(this.costList[i],"num"):GetComponent("Text") local bagNum=BagManager.GetItemCountById(list[i][1]) --去除自身 and if soulId==list[i][1] and (heroId==nil or heroId=="") then bagNum=bagNum-1 end if i==1 then table.insert(costIds,list[i][1]) end if bagNum < list[i][2] then isCan=false numTxt.text=string.format("%s/%s",PrintWanNum(bagNum),list[i][2]) else numTxt.text=string.format("%s/%s",PrintWanNum(bagNum),list[i][2]) end Util.AddClick(btnObj,function() UIManager.OpenPanel(UIName.RewardItemSingleShowPopup,itemConfig[list[i][1]].Id,nil) end) else this.costList[i]:SetActive(false) end end --end end function this:Refresh(Id) end function this:GetGodPrintDes(id) if equipConfig[id] then --魂印效果 local txt = "" if equipConfig[id].PassiveSkill and tonumber(equipConfig[id].PassiveSkill)~=nil then --LogError("equipConfig[id].PassiveSkill[1]=="..equipConfig[id].PassiveSkill[1]) local str1 = GetLanguageStrById(passiveSkillConfig[equipConfig[id].PassiveSkill[1]].Desc) if str1 then txt=str1 end else if equipConfig[id].Property then for index, value in ipairs(equipConfig[id].Property) do --propertyconfig if index > 1 then txt = txt .. "," end if propertyconfig[value[1]].Style==1 then txt=txt..GetLanguageStrById(propertyconfig[value[1]].Info).."+"..value[2] elseif propertyconfig[value[1]].Style==2 then txt=txt..GetLanguageStrById(propertyconfig[value[1]].Info).."+"..math.floor((value[2]/100)).."%" end end end end return txt end end function this:SetCost(bool) end function this:SingleDataShow(go,data,index,bool) end function this:OnClose() args=nil end function this:OnDestroy() self.spLoader:Destroy() end return this