2022-04-22 18:23:01 +08:00
|
|
|
|
----- 命格选择命石 -----
|
|
|
|
|
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")
|
2022-04-24 14:20:11 +08:00
|
|
|
|
this.titleTxt.text="神印升品"
|
2022-04-22 18:23:01 +08:00
|
|
|
|
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.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()
|
|
|
|
|
--删除魂印
|
2023-01-24 20:29:23 +08:00
|
|
|
|
if heroId then
|
2022-04-22 18:23:01 +08:00
|
|
|
|
if func then
|
2023-01-24 20:29:23 +08:00
|
|
|
|
func()
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1,function()
|
|
|
|
|
-- this.StartCompoundSoulPrint(curSelectSoulPrint, true)
|
|
|
|
|
if func then
|
|
|
|
|
func()
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
2022-04-22 18:23:01 +08:00
|
|
|
|
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.nameTxt1.text=GetStringByEquipQua(equipConfig[soulId].Quality, GetLanguageStrById(equipConfig[soulId].Name))
|
|
|
|
|
this.nameTxt2.text=GetStringByEquipQua(equipConfig[nextSoulId].Quality, GetLanguageStrById(equipConfig[soulId+1].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))
|
2022-04-24 14:20:11 +08:00
|
|
|
|
local btnObj=Util.GetGameObject(this.costList[i],"Obj")
|
|
|
|
|
btnObj:GetComponent("Image").sprite=self.spLoader:LoadSprite(GetResourcePath(itemConfig[list[i][1]].ResourceID))
|
2022-04-22 18:23:01 +08:00
|
|
|
|
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])
|
2022-05-05 11:52:48 +08:00
|
|
|
|
--去除自身 and
|
|
|
|
|
if soulId==list[i][1] and (heroId==nil or heroId=="") then
|
|
|
|
|
bagNum=bagNum-1
|
|
|
|
|
end
|
2022-04-22 18:23:01 +08:00
|
|
|
|
if i==1 then
|
|
|
|
|
table.insert(costIds,list[i][1])
|
|
|
|
|
end
|
2022-05-05 11:52:48 +08:00
|
|
|
|
|
2022-04-22 18:23:01 +08:00
|
|
|
|
if bagNum < list[i][2] then
|
|
|
|
|
isCan=false
|
2022-04-26 16:09:21 +08:00
|
|
|
|
numTxt.text=string.format("<color=#FF0000FF>%s/%s</color>",PrintWanNum(bagNum),list[i][2])
|
2022-04-22 18:23:01 +08:00
|
|
|
|
else
|
2022-04-26 16:09:21 +08:00
|
|
|
|
numTxt.text=string.format("<color=#FFFFFFFF>%s/%s</color>",PrintWanNum(bagNum),list[i][2])
|
2022-04-22 18:23:01 +08:00
|
|
|
|
end
|
2022-04-24 14:20:11 +08:00
|
|
|
|
Util.AddClick(btnObj,function()
|
|
|
|
|
UIManager.OpenPanel(UIName.RewardItemSingleShowPopup,itemConfig[list[i][1]].Id,nil)
|
|
|
|
|
end)
|
2022-04-22 18:23:01 +08:00
|
|
|
|
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 = ""
|
|
|
|
|
|
2023-01-24 20:29:23 +08:00
|
|
|
|
if equipConfig[id].PassiveSkill and tonumber(equipConfig[id].PassiveSkill)~=nil then
|
|
|
|
|
--LogError("equipConfig[id].PassiveSkill[1]=="..equipConfig[id].PassiveSkill[1])
|
2022-04-22 18:23:01 +08:00
|
|
|
|
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
|