miduo_client/Assets/ManagedResources/~Lua/Modules/GeneralPanel/View/GeneralBigPopup_GodPrintUp.lua

162 lines
6.0 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

----- 命格选择命石 -----
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.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()
LogError("--11111111111111")
--删除魂印
UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1,function()
-- this.StartCompoundSoulPrint(curSelectSoulPrint, true)
LogError("22222222")
if func then
func()
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.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))
Util.GetGameObject(this.costList[i],"Obj"):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])
if i==1 then
table.insert(costIds,list[i][1])
end
if bagNum < list[i][2] then
isCan=false
numTxt.text=string.format("<color=#FF0000FF>%s/%s</color>",bagNum,list[i][2])
else
numTxt.text=string.format("<color=#FFFFFFFF>%s/%s</color>",bagNum,list[i][2])
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 then
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