2021-04-21 13:12:04 +08:00
|
|
|
|
require("Base/BasePanel")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
BagResolveAnCompoundPanel = Inherit(BasePanel)
|
|
|
|
|
local this=BagResolveAnCompoundPanel
|
|
|
|
|
--分解
|
|
|
|
|
local openLayoutType=1--1 layout1 2 layout3 分解 还是 合成
|
|
|
|
|
local itemResolveType=1--分解物品类型 1 道具 2 装备
|
|
|
|
|
local itemList={}
|
2021-04-09 12:26:35 +08:00
|
|
|
|
local resolveStrList={Language[10175],Language[10176],Language[10177],Language[10176],Language[10178],Language[10179],Language[10180],Language[10181]}
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local resolveBtnList={}--0 是全部
|
|
|
|
|
local resolveBooleList={false,false,false,false,false,false,false,false}
|
|
|
|
|
local curSelectQuantityList={}--当前选择后的稀有度 选项 {0=true,1=false ...} 稀有度是依次减小的
|
|
|
|
|
local curResolveAllItemList={}--最终向后段发送的分解list
|
|
|
|
|
local isShowTishi=false
|
2021-01-21 11:10:29 +08:00
|
|
|
|
local endHeroNum = 0
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--碎片合成
|
|
|
|
|
local itemData
|
|
|
|
|
local compoundNum=0
|
|
|
|
|
local compoundMaxNum=0
|
|
|
|
|
|
|
|
|
|
--装备单个分解
|
|
|
|
|
local equipData
|
|
|
|
|
|
|
|
|
|
local callBackFun
|
2020-07-11 16:21:15 +08:00
|
|
|
|
|
|
|
|
|
local count
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--初始化组件(用于子类重写)
|
|
|
|
|
function BagResolveAnCompoundPanel:InitComponent()
|
2021-04-21 13:12:04 +08:00
|
|
|
|
this.spLoader = SpriteLoader.New()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
|
|
|
|
this.nameText=Util.GetGameObject(self.gameObject, "bg/nameText"):GetComponent("Text")
|
|
|
|
|
this.layout1=Util.GetGameObject(self.gameObject, "bg/layout1")
|
|
|
|
|
this.layout2=Util.GetGameObject(self.gameObject, "bg/layout2")
|
|
|
|
|
this.layout3=Util.GetGameObject(self.gameObject, "bg/layout3")
|
|
|
|
|
--分解道具
|
|
|
|
|
this.btnBack=Util.GetGameObject(self.gameObject, "bg/btnBack")
|
|
|
|
|
this.btnesolve=Util.GetGameObject(self.gameObject, "bg/layout1/btnSure")
|
|
|
|
|
this.btnSure=Util.GetGameObject(self.gameObject, "bg/layout2/btnSure")
|
|
|
|
|
for i = 1, 8 do
|
|
|
|
|
resolveBtnList[i]=Util.GetGameObject(self.gameObject, "bg/layout1/btns/btn ("..i..")")
|
|
|
|
|
Util.GetGameObject(resolveBtnList[i], "Text"):GetComponent("Text").text=resolveStrList[i]
|
|
|
|
|
end
|
|
|
|
|
this.layout2Text=Util.GetGameObject(self.gameObject, "bg/layout2/Text"):GetComponent("Text")
|
|
|
|
|
--碎片合成
|
|
|
|
|
this.frame=Util.GetGameObject(self.gameObject, "bg/layout3/frame"):GetComponent("Image")
|
2020-09-25 23:09:48 +08:00
|
|
|
|
this.chipFrame=Util.GetGameObject(self.gameObject, "bg/layout3/chipFrame")
|
|
|
|
|
this.propertyIma =Util.GetGameObject(self.gameObject, "bg/layout3/property")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.icon=Util.GetGameObject(self.gameObject, "bg/layout3/icon"):GetComponent("Image")
|
|
|
|
|
this.Slider=Util.GetGameObject(self.gameObject, "bg/layout3/Slider")--:GetComponent("Slider")
|
2020-12-28 16:40:32 +08:00
|
|
|
|
this.numText=Util.GetGameObject(self.gameObject, "bg/layout3/Slider/numText1"):GetComponent("Text")
|
|
|
|
|
this.numText1=Util.GetGameObject(self.gameObject, "bg/layout3/Slider/numText"):GetComponent("Text")
|
2020-12-30 10:34:06 +08:00
|
|
|
|
this.numText1.gameObject:SetActive(true)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.resolveName=Util.GetGameObject(self.gameObject, "bg/layout3/name"):GetComponent("Text")
|
|
|
|
|
this.addBtn=Util.GetGameObject(self.gameObject, "bg/layout3/addBtn")
|
|
|
|
|
this.jianBtn=Util.GetGameObject(self.gameObject, "bg/layout3/jianBtn")
|
|
|
|
|
this.btnCompound=Util.GetGameObject(self.gameObject, "bg/layout3/btnCompound")
|
|
|
|
|
this.btnCompoundText=Util.GetGameObject(self.gameObject,"bg/layout3/btnCompound/Text"):GetComponent("Text")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--绑定事件(用于子类重写)
|
|
|
|
|
function BagResolveAnCompoundPanel:BindEvent()
|
|
|
|
|
|
|
|
|
|
Util.AddClick(this.btnBack, function()
|
|
|
|
|
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
|
|
|
|
|
self:ClosePanel()
|
|
|
|
|
end)
|
|
|
|
|
for i = 0, 7 do
|
|
|
|
|
Util.AddClick(resolveBtnList[i+1], function()
|
|
|
|
|
this.OnShowLayout1Single(resolveBtnList[i+1],i)
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
Util.AddClick(this.btnesolve, function()
|
|
|
|
|
this.SendBackResolveRe()
|
|
|
|
|
end)
|
|
|
|
|
Util.AddClick(this.btnSure, function()
|
|
|
|
|
if openLayoutType==1 then
|
|
|
|
|
if #curResolveAllItemList>0 then
|
|
|
|
|
local type
|
|
|
|
|
if itemResolveType==1 then
|
|
|
|
|
type=2
|
|
|
|
|
else
|
|
|
|
|
type=1
|
|
|
|
|
end
|
|
|
|
|
NetManager.UseAndPriceItemRequest(type,curResolveAllItemList,function (drop)
|
|
|
|
|
this.SendBackResolveReCallBack(drop)
|
|
|
|
|
end)
|
|
|
|
|
else
|
2021-04-09 12:26:35 +08:00
|
|
|
|
PopupTipPanel.ShowTip(Language[10182])
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
elseif openLayoutType==2 then
|
2021-11-09 10:22:16 +08:00
|
|
|
|
UIManager.ClosePanel(UIName.RewardEquipSingleShowPopup2)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if equipData then
|
|
|
|
|
curResolveAllItemList={}
|
2020-07-10 18:29:38 +08:00
|
|
|
|
local equip = {}
|
|
|
|
|
equip.itemId = equipData.id
|
2020-07-11 16:21:15 +08:00
|
|
|
|
if not count then
|
|
|
|
|
equip.itemNum = 1
|
|
|
|
|
else
|
|
|
|
|
equip.itemNum = count
|
|
|
|
|
end
|
2020-07-10 18:29:38 +08:00
|
|
|
|
table.insert(curResolveAllItemList,equip)
|
2020-07-07 16:35:57 +08:00
|
|
|
|
local type=1
|
2020-05-09 13:31:21 +08:00
|
|
|
|
NetManager.UseAndPriceItemRequest(type,curResolveAllItemList,function (drop)
|
|
|
|
|
this.SendBackResolveReCallBack(drop)
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
Util.AddSlider(this.Slider, function(go, value)
|
|
|
|
|
this.ShowCompoundNumData(value)
|
|
|
|
|
end)
|
|
|
|
|
Util.AddClick(this.addBtn, function()
|
2022-09-20 17:04:48 +08:00
|
|
|
|
if itemData.itemConfig.ItemType == ItemType.Box
|
2022-09-23 15:50:28 +08:00
|
|
|
|
or itemData.itemConfig.ItemType == ItemType.GMzck
|
|
|
|
|
or itemData.itemConfig.ItemType == ItemType.GMBigZck
|
2022-11-01 10:09:17 +08:00
|
|
|
|
or itemData.itemConfig.ItemType == ItemType.GMzcq
|
|
|
|
|
or itemData.itemConfig.ItemType == ItemType.GMxck
|
|
|
|
|
or itemData.itemConfig.ItemType == ItemType.GMxjk
|
|
|
|
|
or itemData.itemConfig.ItemType == ItemType.GMxsZcq then--宝箱
|
2021-05-08 11:03:46 +08:00
|
|
|
|
if compoundNum<compoundMaxNum then
|
|
|
|
|
compoundNum=compoundNum+1
|
|
|
|
|
this.ShowCompoundNumData(compoundNum)
|
|
|
|
|
end
|
|
|
|
|
else
|
2021-11-22 16:38:24 +08:00
|
|
|
|
if compoundNum > 0 then
|
2021-07-28 09:58:41 +08:00
|
|
|
|
if compoundNum<compoundMaxNum then
|
|
|
|
|
compoundNum=compoundNum+1
|
|
|
|
|
this.ShowCompoundNumData(compoundNum)
|
|
|
|
|
end
|
|
|
|
|
else
|
2021-11-22 16:38:24 +08:00
|
|
|
|
PopupTipPanel.ShowTip("已达上限")
|
2021-07-28 09:58:41 +08:00
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
Util.AddClick(this.jianBtn, function()
|
|
|
|
|
if compoundNum>=2 then
|
|
|
|
|
compoundNum=compoundNum-1
|
|
|
|
|
this.ShowCompoundNumData(compoundNum)
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
Util.AddClick(this.btnCompound, function()
|
2021-11-18 16:03:34 +08:00
|
|
|
|
if itemData.itemConfig.ItemType==ItemType.HeroDebris
|
2022-08-10 14:50:27 +08:00
|
|
|
|
or itemData.itemConfig.ItemType==ItemType.ZuoQiChip
|
2022-08-16 16:36:09 +08:00
|
|
|
|
or itemData.itemConfig.ItemType==ItemType.likeabilityItemChip
|
2022-09-20 17:04:48 +08:00
|
|
|
|
or itemData.itemConfig.ItemType==ItemType.EquipChip
|
|
|
|
|
or itemData.itemConfig.ItemType==ItemType.CommonChip then--碎片
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if compoundNum>0 then
|
|
|
|
|
local item={}
|
|
|
|
|
item.itemId=itemData.id
|
|
|
|
|
item.itemNum=compoundNum*itemData.itemConfig.UsePerCount
|
2021-05-08 11:03:46 +08:00
|
|
|
|
-- Log("sssssssssssssss "..item.itemId.." "..item.itemNum)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
NetManager.HeroComposeRequest(item,function (drop)
|
|
|
|
|
this.SendBackCompoundReCallBack(drop)
|
|
|
|
|
end)
|
|
|
|
|
else
|
2021-10-16 15:12:54 +08:00
|
|
|
|
PopupTipPanel.ShowTip(Language[10183])
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
2022-09-20 17:04:48 +08:00
|
|
|
|
elseif itemData.itemConfig.ItemType==ItemType.Box
|
|
|
|
|
or itemData.itemConfig.ItemType == ItemType.GMzck
|
2022-09-23 15:50:28 +08:00
|
|
|
|
or itemData.itemConfig.ItemType == ItemType.GMBigZck
|
2022-11-01 10:09:17 +08:00
|
|
|
|
or itemData.itemConfig.ItemType == ItemType.GMzcq
|
|
|
|
|
or itemData.itemConfig.ItemType == ItemType.GMxck
|
|
|
|
|
or itemData.itemConfig.ItemType == ItemType.GMxjk
|
|
|
|
|
or itemData.itemConfig.ItemType == ItemType.GMxsZcq then
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if compoundNum>0 then
|
|
|
|
|
local item={}
|
|
|
|
|
local itemList = {}
|
|
|
|
|
item.itemId=itemData.id
|
2020-06-08 13:57:30 +08:00
|
|
|
|
item.itemNum=compoundNum--*itemData.itemConfig.UsePerCount
|
2020-05-09 13:31:21 +08:00
|
|
|
|
table.insert(itemList,item)
|
2021-05-08 11:03:46 +08:00
|
|
|
|
-- Log("sssssssssssssss "..item.itemId.." "..item.itemNum)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
NetManager.UseAndPriceItemRequest(0,itemList,function (drop)
|
2022-09-23 15:24:10 +08:00
|
|
|
|
if itemData.id==1342 then
|
|
|
|
|
PrivilegeManager.SetPrivilegeUsedTimes(PRIVILEGE_TYPE.GM_YI_YUAN_UP_TIME,compoundNum)
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.SendBackCompoundReCallBack(drop)
|
|
|
|
|
end)
|
|
|
|
|
else
|
2021-04-09 12:26:35 +08:00
|
|
|
|
PopupTipPanel.ShowTip(Language[10184])
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
2021-12-25 07:58:30 +08:00
|
|
|
|
elseif itemData.itemConfig.ItemType==ItemType.TimeIsGold then--挂机时长奖励
|
|
|
|
|
if compoundNum>0 then
|
|
|
|
|
local itemList = {itemData.id, compoundNum}
|
|
|
|
|
NetManager.UseAndPriceItemRequest(7,itemList,function (drop)
|
|
|
|
|
this.SendBackCompoundReCallBack(drop)
|
|
|
|
|
end)
|
|
|
|
|
else
|
|
|
|
|
PopupTipPanel.ShowTip(Language[10184])
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
else
|
|
|
|
|
if compoundNum >0 then
|
|
|
|
|
UIManager.ClosePanel(UIName.RewardItemSingleShowPopup)
|
|
|
|
|
curResolveAllItemList={}
|
|
|
|
|
local item={}
|
|
|
|
|
item.itemId=itemData.id
|
|
|
|
|
item.itemNum=compoundNum
|
|
|
|
|
table.insert(curResolveAllItemList,item)
|
|
|
|
|
local type
|
|
|
|
|
if itemData.itemConfig.ItemBaseType==ItemBaseType.Equip then
|
|
|
|
|
type=2
|
|
|
|
|
else
|
|
|
|
|
type=1
|
|
|
|
|
end
|
|
|
|
|
NetManager.UseAndPriceItemRequest(type,curResolveAllItemList,function (drop)
|
|
|
|
|
this.SendBackResolveReCallBack(drop)
|
|
|
|
|
end)
|
|
|
|
|
else
|
2021-04-09 12:26:35 +08:00
|
|
|
|
PopupTipPanel.ShowTip(Language[10185])
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2021-05-08 11:03:46 +08:00
|
|
|
|
end)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--添加事件监听(用于子类重写)
|
|
|
|
|
function BagResolveAnCompoundPanel:AddListener()
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--移除事件监听(用于子类重写)
|
|
|
|
|
function BagResolveAnCompoundPanel:RemoveListener()
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面打开时调用(用于子类重写)
|
|
|
|
|
function BagResolveAnCompoundPanel:OnOpen(...)
|
|
|
|
|
|
|
|
|
|
local data={...}
|
|
|
|
|
openLayoutType=data[1]
|
|
|
|
|
if openLayoutType==1 then--批量分解
|
|
|
|
|
itemResolveType=data[2]
|
|
|
|
|
itemList=data[3]
|
|
|
|
|
this.OnShowLayout1Data()
|
|
|
|
|
callBackFun = data[4]
|
|
|
|
|
if itemResolveType==4 then--特殊页签
|
|
|
|
|
resolveBtnList[2]:SetActive(true)
|
|
|
|
|
resolveBtnList[3]:SetActive(true)
|
|
|
|
|
else
|
|
|
|
|
resolveBtnList[2]:SetActive(false)
|
|
|
|
|
resolveBtnList[3]:SetActive(false)
|
|
|
|
|
end
|
|
|
|
|
elseif openLayoutType==2 then--
|
|
|
|
|
itemResolveType=data[2]
|
|
|
|
|
equipData=data[3]
|
|
|
|
|
callBackFun = data[4]
|
2020-07-11 16:21:15 +08:00
|
|
|
|
count = data[5]
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.OnShowLayout2Data()
|
|
|
|
|
elseif openLayoutType==3 then--碎片合成
|
|
|
|
|
itemData=data[2]
|
|
|
|
|
callBackFun = data[3]
|
|
|
|
|
Log("itemData "..itemData.id)
|
|
|
|
|
this.OnShowLayout3Data()
|
|
|
|
|
elseif openLayoutType==4 then--宝箱使用
|
2022-09-20 17:04:48 +08:00
|
|
|
|
LogError("222222222222")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
itemData=data[2]
|
|
|
|
|
callBackFun = data[3]
|
|
|
|
|
this.OnShowLayout3Data()
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
--初始化Layout1
|
|
|
|
|
function this.OnShowLayout1Data()
|
2021-04-09 12:26:35 +08:00
|
|
|
|
this.nameText.text=Language[10186]
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.layout1:SetActive(true)
|
|
|
|
|
this.layout2:SetActive(false)
|
|
|
|
|
this.layout3:SetActive(false)
|
|
|
|
|
curSelectQuantityList={}
|
|
|
|
|
resolveBooleList={false,false,false,false,false,false,false,false}
|
|
|
|
|
for i = 1, #resolveBooleList do
|
|
|
|
|
Util.GetGameObject(resolveBtnList[i], "Image"):SetActive(resolveBooleList[i])
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
--设置单个
|
|
|
|
|
function this.OnShowLayout1Single(_btnGo,_index)--_index 0-7
|
2021-05-08 11:03:46 +08:00
|
|
|
|
-- Log("_index ".._index)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if _index==0 then--选择全部
|
|
|
|
|
resolveBooleList[1] = not resolveBooleList[1]
|
|
|
|
|
resolveBooleList={resolveBooleList[1],false,false,false,false,false,false,false}
|
|
|
|
|
for i = 1, 8 do--按钮八个
|
|
|
|
|
Util.GetGameObject(resolveBtnList[i], "Image"):SetActive(resolveBooleList[i])
|
|
|
|
|
end
|
|
|
|
|
for i = 1, 7 do--稀有度就七个
|
|
|
|
|
curSelectQuantityList[i]=resolveBooleList[i+1]
|
|
|
|
|
end
|
|
|
|
|
else--选择其他
|
|
|
|
|
if resolveBooleList[1]==true then
|
|
|
|
|
resolveBooleList[1]=false
|
|
|
|
|
curSelectQuantityList[1]=false
|
|
|
|
|
Util.GetGameObject(resolveBtnList[1], "Image"):SetActive(resolveBooleList[1])
|
|
|
|
|
end
|
|
|
|
|
resolveBooleList[_index+1]=not resolveBooleList[_index+1]
|
|
|
|
|
curSelectQuantityList[9-(_index+1)]=resolveBooleList[_index+1]
|
|
|
|
|
Util.GetGameObject(_btnGo, "Image"):SetActive(resolveBooleList[_index+1])
|
|
|
|
|
end
|
|
|
|
|
for k,v in pairs(curSelectQuantityList) do
|
2021-05-08 11:03:46 +08:00
|
|
|
|
-- Log("curSelectQuantityList k v "..k..tostring(v))
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--初始化Layout2
|
|
|
|
|
function this.OnShowLayout2Data()
|
|
|
|
|
this.layout1:SetActive(false)
|
|
|
|
|
this.layout2:SetActive(true)
|
|
|
|
|
this.layout3:SetActive(false)
|
|
|
|
|
if openLayoutType==1 then--批量分解
|
2021-04-09 12:26:35 +08:00
|
|
|
|
this.nameText.text=Language[10187]
|
|
|
|
|
this.layout2Text.text=Language[10188]
|
2020-12-21 19:30:19 +08:00
|
|
|
|
elseif openLayoutType==2 then--单个装备分解
|
2021-04-09 12:26:35 +08:00
|
|
|
|
this.nameText.text=Language[11538]
|
|
|
|
|
this.layout2Text.text=Language[10190]..GetQuantityStrByquality(ConfigManager.GetConfigData(ConfigName.ItemConfig, equipData.id).Quantity)..Language[12122]
|
2020-12-21 19:30:19 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
--初始化Layout3
|
|
|
|
|
function this.OnShowLayout3Data()
|
|
|
|
|
this.layout1:SetActive(false)
|
|
|
|
|
this.layout2:SetActive(false)
|
|
|
|
|
this.layout3:SetActive(true)
|
2021-04-21 13:12:04 +08:00
|
|
|
|
this.frame.sprite=this.spLoader:LoadSprite(itemData.frame)
|
|
|
|
|
this.icon.sprite=this.spLoader:LoadSprite(itemData.icon)
|
2021-01-26 17:08:39 +08:00
|
|
|
|
this.resolveName.text=GetLanguageStrById(itemData.itemConfig.Name)
|
2020-09-25 23:09:48 +08:00
|
|
|
|
this.chipFrame:SetActive(false)
|
|
|
|
|
this.propertyIma:SetActive(false)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local gameSetting = ConfigManager.GetConfigData(ConfigName.GameSetting, 1)
|
2021-11-18 16:03:34 +08:00
|
|
|
|
if itemData.itemConfig.ItemType==ItemType.HeroDebris
|
2022-08-10 14:50:27 +08:00
|
|
|
|
or itemData.itemConfig.ItemType==ItemType.ZuoQiChip
|
|
|
|
|
or itemData.itemConfig.ItemType==ItemType.likeabilityItemChip
|
2022-08-16 16:36:09 +08:00
|
|
|
|
or itemData.itemConfig.ItemType==ItemType.EquipChip
|
2022-09-20 17:04:48 +08:00
|
|
|
|
or itemData.itemConfig.ItemType==ItemType.CommonChip
|
2022-08-10 14:50:27 +08:00
|
|
|
|
then--碎片
|
2020-09-25 23:09:48 +08:00
|
|
|
|
this.chipFrame:SetActive(true)
|
2021-04-21 13:12:04 +08:00
|
|
|
|
this.chipFrame:GetComponent("Image").sprite = this.spLoader:LoadSprite(GetHeroChipQuantityImageByquality(itemData.itemConfig.Quantity))
|
2020-09-25 23:09:48 +08:00
|
|
|
|
if itemData.itemConfig.PropertyName and itemData.itemConfig.PropertyName > 0 then
|
2020-12-22 19:55:39 +08:00
|
|
|
|
print(itemData.itemConfig.PropertyName,"~~~~~~S")
|
2020-09-25 23:09:48 +08:00
|
|
|
|
this.propertyIma:SetActive(true)
|
2021-04-21 13:12:04 +08:00
|
|
|
|
this.propertyIma:GetComponent("Image").sprite = this.spLoader:LoadSprite(GetJobSpriteStrByJobNum(itemData.itemConfig.PropertyName))
|
2020-09-25 23:09:48 +08:00
|
|
|
|
else
|
|
|
|
|
this.propertyIma:SetActive(false)
|
|
|
|
|
end
|
2021-04-09 12:26:35 +08:00
|
|
|
|
this.nameText.text=Language[10192]
|
|
|
|
|
this.btnCompoundText.text=Language[10193]
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local maxCompoundValue = math.floor(itemData.num/itemData.itemConfig.UsePerCount)
|
2021-11-18 16:03:34 +08:00
|
|
|
|
--
|
2022-09-20 17:04:48 +08:00
|
|
|
|
if itemData.itemConfig.ItemType==ItemType.HeroDebris
|
|
|
|
|
or itemData.itemConfig.ItemType==ItemType.likeabilityItemChip
|
|
|
|
|
or itemData.itemConfig.ItemType==ItemType.EquipChip
|
|
|
|
|
or itemData.itemConfig.ItemType==ItemType.CommonChip
|
|
|
|
|
then -- 神将碎片
|
2021-11-18 16:03:34 +08:00
|
|
|
|
compoundMaxNum = math.min(maxCompoundValue, gameSetting.HeroCompoundLimit, gameSetting.HeroNumlimit-LengthOfTable(HeroManager.GetAllHeroDatas()))
|
|
|
|
|
elseif itemData.itemConfig.ItemType==ItemType.ZuoQiChip then -- 坐骑碎片
|
|
|
|
|
compoundMaxNum = math.min(maxCompoundValue, gameSetting.HeroCompoundLimit)
|
2021-04-27 15:28:18 +08:00
|
|
|
|
end
|
2021-11-18 16:03:34 +08:00
|
|
|
|
|
2022-09-20 17:04:48 +08:00
|
|
|
|
elseif itemData.itemConfig.ItemType==ItemType.Box
|
|
|
|
|
or itemData.itemConfig.ItemType == ItemType.GMzck
|
2022-09-23 15:50:28 +08:00
|
|
|
|
or itemData.itemConfig.ItemType == ItemType.GMBigZck
|
2022-11-01 10:09:17 +08:00
|
|
|
|
or itemData.itemConfig.ItemType == ItemType.GMzcq
|
|
|
|
|
or itemData.itemConfig.ItemType == ItemType.GMxck
|
|
|
|
|
or itemData.itemConfig.ItemType == ItemType.GMxjk
|
|
|
|
|
or itemData.itemConfig.ItemType == ItemType.GMxsZcq
|
|
|
|
|
then--宝箱
|
2021-04-09 12:26:35 +08:00
|
|
|
|
this.nameText.text=Language[10194]
|
|
|
|
|
this.btnCompoundText.text=Language[10195]
|
2020-06-08 13:57:30 +08:00
|
|
|
|
local maxCompoundValue = itemData.num-- math.floor(itemData.num/itemData.itemConfig.UsePerCount)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
compoundMaxNum=maxCompoundValue > gameSetting.OpenBoxLimits and gameSetting.OpenBoxLimits or maxCompoundValue
|
2021-12-26 11:21:17 +08:00
|
|
|
|
elseif itemData.itemConfig.ItemType==ItemType.TimeIsGold then--挂机产出
|
|
|
|
|
this.nameText.text=Language[10195]
|
|
|
|
|
this.btnCompoundText.text=Language[10195]
|
|
|
|
|
compoundMaxNum=itemData.num
|
2020-05-09 13:31:21 +08:00
|
|
|
|
else
|
|
|
|
|
itemResolveType=itemData.itemConfig.ItemBaseType
|
2021-04-09 12:26:35 +08:00
|
|
|
|
this.nameText.text=Language[10196]
|
|
|
|
|
this.btnCompoundText.text=Language[10197]
|
2020-05-09 13:31:21 +08:00
|
|
|
|
compoundMaxNum=itemData.num
|
|
|
|
|
end
|
2021-05-08 11:03:46 +08:00
|
|
|
|
compoundNum=1
|
|
|
|
|
compoundNum= compoundNum>=compoundMaxNum and compoundMaxNum or compoundNum
|
|
|
|
|
if compoundMaxNum > 0 then
|
|
|
|
|
this.Slider:GetComponent("Slider").value=1
|
2021-11-22 16:38:24 +08:00
|
|
|
|
this.Slider:GetComponent("Slider").minValue=1
|
2021-05-08 11:03:46 +08:00
|
|
|
|
else
|
|
|
|
|
this.Slider:GetComponent("Slider").value=0
|
|
|
|
|
this.Slider:GetComponent("Slider").minValue=0
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
2021-05-08 11:03:46 +08:00
|
|
|
|
this.Slider:GetComponent("Slider").maxValue=compoundMaxNum
|
|
|
|
|
--this.ShowCompoundNumData(compoundNum)
|
|
|
|
|
this.ShowCompoundNumData(compoundMaxNum)
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--道具 和 装备分解 发送请求
|
|
|
|
|
function this.SendBackResolveRe()
|
|
|
|
|
isShowTishi=false
|
|
|
|
|
curResolveAllItemList={}
|
2021-05-08 11:03:46 +08:00
|
|
|
|
-- Log("itemResolveType "..itemResolveType)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if itemResolveType==ItemBaseType.Equip then--装备
|
|
|
|
|
for i = 1, #itemList do
|
|
|
|
|
if resolveBooleList[1]==true and itemList[i].itemConfig.IfResolve==1 then
|
|
|
|
|
if itemList[i].equipConfig.Quality>=4 then
|
|
|
|
|
isShowTishi=true
|
|
|
|
|
end
|
|
|
|
|
table.insert(curResolveAllItemList,itemList[i].did)
|
|
|
|
|
else
|
2021-05-08 11:03:46 +08:00
|
|
|
|
-- Log("itemList[i].equipConfig.Quality "..itemList[i].equipConfig.Quality)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if curSelectQuantityList[itemList[i].equipConfig.Quality]==true and itemList[i].itemConfig.IfResolve==1 then
|
2021-05-08 11:03:46 +08:00
|
|
|
|
-- Log("itemList[i].did "..itemList[i].did)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if itemList[i].equipConfig.Quality>=4 then
|
|
|
|
|
isShowTishi=true
|
|
|
|
|
end
|
|
|
|
|
table.insert(curResolveAllItemList,itemList[i].did)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else--道具
|
|
|
|
|
for i = 1, #itemList do
|
|
|
|
|
if resolveBooleList[1]==true and itemList[i].itemConfig.IfResolve==1 then
|
|
|
|
|
if itemList[i].itemConfig.Quantity>=4 then
|
|
|
|
|
isShowTishi=true
|
|
|
|
|
end
|
|
|
|
|
local item={}
|
|
|
|
|
item.itemId=itemList[i].id
|
|
|
|
|
item.itemNum=itemList[i].num
|
|
|
|
|
item.endingTime=itemList[i].endingTime
|
|
|
|
|
table.insert(curResolveAllItemList,item)
|
|
|
|
|
else
|
|
|
|
|
if curSelectQuantityList[itemList[i].itemConfig.Quantity]==true and itemList[i].itemConfig.IfResolve==1 then
|
|
|
|
|
if itemList[i].itemConfig.Quantity>=4 then
|
|
|
|
|
isShowTishi=true
|
|
|
|
|
end
|
|
|
|
|
local item={}
|
|
|
|
|
item.itemId=itemList[i].id
|
|
|
|
|
item.itemNum=itemList[i].num
|
|
|
|
|
item.endingTime=itemList[i].endingTime
|
|
|
|
|
table.insert(curResolveAllItemList,item)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
Log(#curResolveAllItemList)
|
|
|
|
|
--for i = 1, #curResolveAllItemList do
|
|
|
|
|
-- Log(" wwwwwwwwwwww "..curResolveAllItemList[i].itemId)
|
|
|
|
|
--end
|
|
|
|
|
if isShowTishi then
|
|
|
|
|
this.OnShowLayout2Data()
|
|
|
|
|
else
|
|
|
|
|
if #curResolveAllItemList>0 then
|
|
|
|
|
local type
|
|
|
|
|
if itemResolveType==ItemBaseType.Equip then
|
|
|
|
|
type=2
|
|
|
|
|
else
|
|
|
|
|
type=1
|
|
|
|
|
end
|
|
|
|
|
NetManager.UseAndPriceItemRequest(type,curResolveAllItemList,function (drop)
|
|
|
|
|
this.SendBackResolveReCallBack(drop)
|
|
|
|
|
end)
|
|
|
|
|
else
|
2021-04-09 12:26:35 +08:00
|
|
|
|
PopupTipPanel.ShowTip(Language[10182])
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
--道具 和 装备分解 发送请求后 回调
|
|
|
|
|
function this.SendBackResolveReCallBack(drop)
|
|
|
|
|
this:ClosePanel()
|
|
|
|
|
local isShowReward=false
|
|
|
|
|
if drop.itemlist~=nil and #drop.itemlist>0 then
|
|
|
|
|
for i = 1, #drop.itemlist do
|
|
|
|
|
if drop.itemlist[i].itemNum>0 then
|
|
|
|
|
isShowReward=true
|
|
|
|
|
break
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if isShowReward then
|
|
|
|
|
UIManager.OpenPanel(UIName.RewardItemPopup,drop,1,function ()
|
|
|
|
|
BagManager.OnShowTipDropNumZero(drop)
|
|
|
|
|
if callBackFun then
|
|
|
|
|
callBackFun()
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
else
|
2020-07-11 16:21:15 +08:00
|
|
|
|
BagManager.OnShowTipDropNumZero(drop)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
2020-07-11 16:21:15 +08:00
|
|
|
|
if callBackFun then
|
|
|
|
|
callBackFun()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
function this.SendBackCompoundReCallBack(drop)
|
|
|
|
|
this:ClosePanel()
|
2022-08-10 14:50:27 +08:00
|
|
|
|
LogError("#drop=="..#drop)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
UIManager.OpenPanel(UIName.RewardItemPopup,drop,1,function ()
|
|
|
|
|
--UIManager.OpenPanel(UIName.BagPanel)
|
|
|
|
|
if callBackFun then
|
|
|
|
|
callBackFun()
|
|
|
|
|
end
|
2020-07-29 00:11:36 +08:00
|
|
|
|
end,nil,nil,nil,true)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--改为后端刷新了
|
|
|
|
|
--BagManager.UpdateItemsNum(itemData.id,compoundNum*itemData.itemConfig.UsePerCount)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.ShowCompoundNumData(value)
|
2021-05-08 11:03:46 +08:00
|
|
|
|
-- Log("当前slider值 "..value)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
compoundNum=value
|
|
|
|
|
this.Slider:GetComponent("Slider").value=value
|
2020-12-30 10:34:06 +08:00
|
|
|
|
this.numText1.text = value
|
2021-11-18 16:03:34 +08:00
|
|
|
|
if itemData.itemConfig.ItemType==ItemType.HeroDebris
|
2022-08-10 14:50:27 +08:00
|
|
|
|
or itemData.itemConfig.ItemType==ItemType.ZuoQiChip
|
2022-08-16 16:36:09 +08:00
|
|
|
|
or itemData.itemConfig.ItemType==ItemType.likeabilityItemChip
|
2022-09-20 17:04:48 +08:00
|
|
|
|
or itemData.itemConfig.ItemType==ItemType.EquipChip
|
|
|
|
|
or itemData.itemConfig.ItemType==ItemType.CommonChip
|
|
|
|
|
then--碎片
|
2021-04-09 12:26:35 +08:00
|
|
|
|
this.numText.text= Language[10198]..value*itemData.itemConfig.UsePerCount..Language[10199]..value..Language[10200].. string.gsub(GetLanguageStrById(itemData.itemConfig.Name),Language[10201],"")
|
2022-09-20 17:04:48 +08:00
|
|
|
|
elseif itemData.itemConfig.ItemType==ItemType.Box
|
|
|
|
|
or itemData.itemConfig.ItemType == ItemType.GMzck
|
2022-09-23 15:50:28 +08:00
|
|
|
|
or itemData.itemConfig.ItemType == ItemType.GMBigZck
|
2022-11-01 10:09:17 +08:00
|
|
|
|
or itemData.itemConfig.ItemType == ItemType.GMzcq
|
|
|
|
|
or itemData.itemConfig.ItemType == ItemType.GMxck
|
|
|
|
|
or itemData.itemConfig.ItemType == ItemType.GMxjk
|
|
|
|
|
or itemData.itemConfig.ItemType == ItemType.GMxsZcq then
|
2021-04-09 12:26:35 +08:00
|
|
|
|
this.numText.text= Language[10202]..value..Language[10200]..GetLanguageStrById(itemData.itemConfig.Name).."。"
|
2021-12-25 07:58:30 +08:00
|
|
|
|
elseif itemData.itemConfig.ItemType==ItemType.TimeIsGold then--挂机奖励
|
|
|
|
|
this.numText.text= Language[10202]..value..Language[10200]..GetLanguageStrById(itemData.itemConfig.Name).."。"
|
2020-05-09 13:31:21 +08:00
|
|
|
|
else
|
2021-04-09 12:26:35 +08:00
|
|
|
|
this.numText.text= Language[10196]..value..Language[10200]..GetLanguageStrById(itemData.itemConfig.Name).."。"
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
--界面关闭时调用(用于子类重写)
|
|
|
|
|
function BagResolveAnCompoundPanel:OnClose()
|
|
|
|
|
|
|
|
|
|
if callBackFun then
|
|
|
|
|
callBackFun()
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面销毁时调用(用于子类重写)
|
|
|
|
|
function BagResolveAnCompoundPanel:OnDestroy()
|
2021-04-21 13:12:04 +08:00
|
|
|
|
this.spLoader:Destroy()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
2020-06-23 18:36:24 +08:00
|
|
|
|
return BagResolveAnCompoundPanel
|