2021-04-21 13:12:04 +08:00
|
|
|
|
require("Base/BasePanel")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
HeroAndEquipResolvePanel = Inherit(BasePanel)
|
|
|
|
|
local this=HeroAndEquipResolvePanel
|
|
|
|
|
local heroEndBtns={}--英雄筛选所有按钮
|
|
|
|
|
local equipEndBtns={}--装备筛选所有按钮
|
|
|
|
|
local soulPrintEndBtns={}--魂印筛选所有按钮
|
|
|
|
|
local equipTreasureEndBtns={}--法宝筛选所有按钮
|
|
|
|
|
local tarHero={}--展示英雄数据list
|
|
|
|
|
local tarEquip={}--展示装备数据list
|
|
|
|
|
local equipTreasureData={}--展示法宝数据list
|
|
|
|
|
local soulPrintData={}--展示魂印数据list
|
|
|
|
|
local tabType=0--大页签 1 英雄 2 装备
|
|
|
|
|
local tabSortType=0--筛选页签
|
|
|
|
|
local selectHeroData={}--选择的英雄list did = data
|
|
|
|
|
local selectEquipData={}--选择的装备list
|
|
|
|
|
local selectEquipTreasureData={}--选择的法宝list
|
|
|
|
|
local chooseIdList={}--选择的魂印list
|
2020-06-30 18:59:44 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local curSelectBtn--当前选择的底部筛选btn
|
|
|
|
|
local isSha=false--筛选按钮状态
|
|
|
|
|
local itemMaxList={}--分解获得的物品是否超过上限 物品list
|
|
|
|
|
local rewardGroup=ConfigManager.GetConfig(ConfigName.RewardGroup)
|
|
|
|
|
local itemConfig=ConfigManager.GetConfig(ConfigName.ItemConfig)
|
|
|
|
|
local showList = {}
|
|
|
|
|
local endSelectEquipData = {}
|
|
|
|
|
local _PanelType = {
|
|
|
|
|
[1] = PanelType.HeartFireStone,
|
|
|
|
|
[2] = PanelType.IronResource,
|
2020-06-28 17:52:29 +08:00
|
|
|
|
[3] = PanelType.requiem,
|
2020-05-09 13:31:21 +08:00
|
|
|
|
[4] = PanelType.StarSoul,
|
|
|
|
|
}
|
2020-07-01 10:54:39 +08:00
|
|
|
|
|
|
|
|
|
local list={}
|
|
|
|
|
local orginLayer2=0
|
|
|
|
|
local orginLayer=0
|
2021-07-29 15:01:58 +08:00
|
|
|
|
local isPlayanim,isTop = true,true
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--初始化组件(用于子类重写)
|
|
|
|
|
function HeroAndEquipResolvePanel:InitComponent()
|
2021-04-21 13:12:04 +08:00
|
|
|
|
this.spLoader = SpriteLoader.New()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
|
|
|
|
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform, { showType = UpViewOpenType.ShowLeft })
|
|
|
|
|
this.BtnBack = Util.GetGameObject(self.transform, "rightUp/btnBack")
|
|
|
|
|
this.Scrollbar1 = Util.GetGameObject(self.transform, "heroObject/Scrollbar"):GetComponent("Scrollbar")
|
|
|
|
|
this.Scrollbar2 = Util.GetGameObject(self.transform, "equipObject/Scrollbar"):GetComponent("Scrollbar")
|
|
|
|
|
this.Scrollbar3 = Util.GetGameObject(self.transform, "soulPrintObject/Scrollbar"):GetComponent("Scrollbar")
|
|
|
|
|
this.selectHeroBtn = Util.GetGameObject(self.transform, "endTabs/btnHeroGrid/selectBtn")
|
|
|
|
|
this.selectEndBtn = Util.GetGameObject(self.transform, "endTabs/selectBtn")
|
|
|
|
|
for i = 1, 6 do
|
|
|
|
|
heroEndBtns[i]=Util.GetGameObject(self.transform, "endTabs/btnHeroGrid/btnHeroGrid/Btn"..i)
|
|
|
|
|
Util.AddClick( heroEndBtns[i], function()
|
|
|
|
|
if tabSortType == i then
|
|
|
|
|
this.SortTypeClick(0,heroEndBtns[i])--全部
|
|
|
|
|
else
|
|
|
|
|
this.SortTypeClick(i,heroEndBtns[i])
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end
|
2020-06-28 17:52:29 +08:00
|
|
|
|
for i = 1, 7 do
|
2020-05-09 13:31:21 +08:00
|
|
|
|
equipEndBtns[i]=Util.GetGameObject(self.transform, "endTabs/btnEquipGrid/btnEquipGrid/Btn ("..i..")")
|
2020-06-30 18:59:44 +08:00
|
|
|
|
Util.AddClick(equipEndBtns[i], function()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if tabSortType == i then
|
|
|
|
|
this.SortTypeClick(0,equipEndBtns[i])--全部
|
|
|
|
|
else
|
|
|
|
|
this.SortTypeClick(i,equipEndBtns[i])
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
for i=1,4 do
|
|
|
|
|
soulPrintEndBtns[i]=Util.GetGameObject(self.transform, "endTabs/btnSoulPrintGrid/btnSoulPrintGrid/Btn"..i)
|
2020-06-30 18:59:44 +08:00
|
|
|
|
Util.AddClick( soulPrintEndBtns[i], function()
|
|
|
|
|
if tabSortType == i+3 then
|
2021-09-24 10:17:25 +08:00
|
|
|
|
isTop = true
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.SortTypeClick(0,equipEndBtns[i])--全部
|
|
|
|
|
else
|
2020-06-30 18:59:44 +08:00
|
|
|
|
tabSortType = i+3
|
2021-09-24 10:17:25 +08:00
|
|
|
|
isTop = true
|
2020-06-30 18:59:44 +08:00
|
|
|
|
this.SortTypeClick(tabSortType,soulPrintEndBtns[i])
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
for i=1,5 do
|
|
|
|
|
equipTreasureEndBtns[i]=Util.GetGameObject(self.transform, "endTabs/btnEquiptreasureGrid/btnEquiptreasureGrid/Btn"..i)
|
|
|
|
|
Util.AddClick( equipTreasureEndBtns[i], function()
|
|
|
|
|
if tabSortType == i then
|
|
|
|
|
this.SortTypeClick(0,equipTreasureEndBtns[i])--全部
|
|
|
|
|
else
|
|
|
|
|
this.SortTypeClick(i,equipTreasureEndBtns[i])
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
this.shaBtn = Util.GetGameObject(self.transform, "endGo/shaBtn")
|
|
|
|
|
this.quickBtn = Util.GetGameObject(self.transform, "endGo/quickBtn")
|
|
|
|
|
this.resolveBtn = Util.GetGameObject(self.transform, "endGo/resolveBtn")
|
|
|
|
|
this.shopBtn = Util.GetGameObject(self.transform, "endGo/shopBtn")
|
|
|
|
|
this.selectText = Util.GetGameObject(self.transform, "endGo/selectText"):GetComponent("Text")
|
|
|
|
|
this.itemRewardPre = Util.GetGameObject(self.transform, "rewardGrid/itemRewardPre")
|
|
|
|
|
this.rewardGridGo = Util.GetGameObject(self.transform, "rewardGrid")
|
|
|
|
|
this.rewardGrid = Util.GetGameObject(self.transform, "rewardGrid/rewardGrid")
|
|
|
|
|
this.rewardGridText = Util.GetGameObject(self.transform, "rewardGrid/Text")
|
|
|
|
|
this.soulPrintScroll=Util.GetGameObject(self.gameObject, "scroll")
|
|
|
|
|
--英雄
|
|
|
|
|
this.cardPre = Util.GetGameObject(self.gameObject, "heroObject/card")
|
|
|
|
|
--this.grid = Util.GetGameObject(self.gameObject, "scroll/grid")
|
|
|
|
|
local v21 = Util.GetGameObject(self.gameObject, "heroObject"):GetComponent("RectTransform").rect
|
|
|
|
|
this.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, Util.GetGameObject(self.transform, "heroObject").transform,
|
|
|
|
|
this.cardPre, this.Scrollbar1, Vector2.New(-v21.x*2, -v21.y*2), 1, 5, Vector2.New(19.32,15))
|
|
|
|
|
this.ScrollView.moveTween.MomentumAmount = 1
|
|
|
|
|
this.ScrollView.moveTween.Strength = 1
|
|
|
|
|
--装备
|
|
|
|
|
this.equipPre = Util.GetGameObject(self.gameObject, "equipObject/equipPre")
|
|
|
|
|
this.soulPrintPre=Util.GetGameObject(self.gameObject, "soulPrintObject/item")
|
|
|
|
|
|
|
|
|
|
local v22 = Util.GetGameObject(self.gameObject, "equipObject"):GetComponent("RectTransform").rect
|
|
|
|
|
this.ScrollView2 = SubUIManager.Open(SubUIConfig.ScrollCycleView, Util.GetGameObject(self.transform, "equipObject").transform,
|
|
|
|
|
this.equipPre, this.Scrollbar2, Vector2.New(-v22.x*2, -v22.y*2), 1, 5, Vector2.New(40, 30))
|
|
|
|
|
this.ScrollView2.moveTween.MomentumAmount = 1
|
|
|
|
|
this.ScrollView2.moveTween.Strength = 1
|
2021-07-29 15:31:09 +08:00
|
|
|
|
local v23 = this.soulPrintScroll:GetComponent("RectTransform").rect
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.ScrollView3 = SubUIManager.Open(SubUIConfig.ScrollCycleView, this.soulPrintScroll.transform,
|
2021-07-29 15:21:44 +08:00
|
|
|
|
this.soulPrintPre, this.Scrollbar3, Vector2.New(v23.width, v23.height), 1, 5, Vector2.New(40, 50))
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.ScrollView3.moveTween.MomentumAmount = 1
|
|
|
|
|
this.ScrollView3.moveTween.Strength = 1
|
|
|
|
|
--隐藏显示用
|
|
|
|
|
this.heroObject=Util.GetGameObject(self.gameObject, "heroObject")
|
|
|
|
|
this.equipObject=Util.GetGameObject(self.gameObject, "equipObject")
|
|
|
|
|
this.soulPrintObject=Util.GetGameObject(self.gameObject, "soulPrintObject")
|
|
|
|
|
this.btnHeroGrid=Util.GetGameObject(self.gameObject, "endTabs/btnHeroGrid")
|
|
|
|
|
this.btnEquipGrid=Util.GetGameObject(self.gameObject, "endTabs/btnEquipGrid")
|
|
|
|
|
this.btnSoulPrintGrid=Util.GetGameObject(self.gameObject, "endTabs/btnSoulPrintGrid")
|
|
|
|
|
this.btnEquiptreasureGrid=Util.GetGameObject(self.gameObject, "endTabs/btnEquiptreasureGrid")
|
|
|
|
|
|
|
|
|
|
this.endTabs = Util.GetGameObject(self.gameObject, "endTabs")
|
|
|
|
|
this.endTabs:SetActive(false)
|
|
|
|
|
--this.endTabsClose = Util.GetGameObject(self.gameObject, "endTabs/closeBtn")
|
2020-06-30 18:59:44 +08:00
|
|
|
|
|
|
|
|
|
this.noneImage= Util.GetGameObject(self.gameObject, "NoneImage")
|
|
|
|
|
chooseIdList={}
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--绑定事件(用于子类重写)
|
|
|
|
|
function HeroAndEquipResolvePanel:BindEvent()
|
|
|
|
|
|
|
|
|
|
Util.AddClick(this.BtnBack, function()
|
|
|
|
|
if isSha then
|
|
|
|
|
this.shaBtn:GetComponent("Button").enabled = false
|
|
|
|
|
isSha=not isSha
|
|
|
|
|
this.rewardGridGo.transform:DOAnchorPosY(-766, 0, false)
|
|
|
|
|
this.endTabs.transform:DOAnchorPosY(-38.64, 0, false):OnComplete(function()
|
|
|
|
|
this.shaBtn:GetComponent("Button").enabled = true
|
|
|
|
|
this.endTabs:SetActive(false)
|
|
|
|
|
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
|
|
|
|
|
self:ClosePanel()
|
|
|
|
|
end)
|
|
|
|
|
else
|
|
|
|
|
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
|
|
|
|
|
self:ClosePanel()
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
Util.AddClick(this.shaBtn, function()
|
|
|
|
|
isSha=not isSha
|
|
|
|
|
this.shaBtn:GetComponent("Button").enabled = false
|
|
|
|
|
--this.endTabsClose:GetComponent("Button").enabled = false
|
|
|
|
|
if isSha then
|
|
|
|
|
this.endTabs:SetActive(true)
|
|
|
|
|
this.rewardGridGo.transform:DOAnchorPosY(-670, 0.5, false)
|
|
|
|
|
this.endTabs.transform:DOAnchorPosY(251.62, 0.5, false):OnComplete(function()
|
|
|
|
|
this.shaBtn:GetComponent("Button").enabled = true
|
|
|
|
|
--this.endTabsClose:GetComponent("Button").enabled = true
|
|
|
|
|
end)
|
|
|
|
|
else
|
|
|
|
|
this.rewardGridGo.transform:DOAnchorPosY(-766, 0.5, false)
|
|
|
|
|
this.endTabs.transform:DOAnchorPosY(-38.64, 0.5, false):OnComplete(function()
|
|
|
|
|
this.shaBtn:GetComponent("Button").enabled = true
|
|
|
|
|
--this.endTabsClose:GetComponent("Button").enabled = true
|
|
|
|
|
this.endTabs:SetActive(false)
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
--Util.AddClick(this.endTabsClose, function()
|
|
|
|
|
-- this.rewardGridGo.transform:DOAnchorPosY(-766, 0.5, false)
|
|
|
|
|
-- isSha=false
|
|
|
|
|
-- this.shaBtn:GetComponent("Button").enabled = false
|
|
|
|
|
-- this.endTabsClose:GetComponent("Button").enabled = false
|
|
|
|
|
-- this.endTabs.transform:DOAnchorPosY(-38.64, 0.5, false):OnComplete(function()
|
|
|
|
|
-- this.shaBtn:GetComponent("Button").enabled = true
|
|
|
|
|
-- this.endTabsClose:GetComponent("Button").enabled = true
|
|
|
|
|
-- this.endTabs:SetActive(false)
|
|
|
|
|
-- end)
|
|
|
|
|
--end)
|
|
|
|
|
Util.AddClick(this.quickBtn, function()
|
|
|
|
|
this.QuickSelectListData()
|
|
|
|
|
end)
|
|
|
|
|
Util.AddClick(this.resolveBtn, function()
|
|
|
|
|
this.ResolveBtnClickEvent()
|
|
|
|
|
end)
|
|
|
|
|
Util.AddClick(this.shopBtn, function()
|
|
|
|
|
local isActive, errorTip = ShopManager.IsActive(SHOP_TYPE.SOUL_CONTRACT_SHOP)
|
|
|
|
|
if not isActive then
|
2021-03-02 16:53:12 +08:00
|
|
|
|
PopupTipPanel.ShowTip(errorTip or Language[10574])
|
2020-05-09 13:31:21 +08:00
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
UIManager.OpenPanel(UIName.MainShopPanel, SHOP_TYPE.SOUL_CONTRACT_SHOP)
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--添加事件监听(用于子类重写)
|
|
|
|
|
function HeroAndEquipResolvePanel:AddListener()
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--移除事件监听(用于子类重写)
|
|
|
|
|
function HeroAndEquipResolvePanel:RemoveListener()
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面打开时调用(用于子类重写)
|
|
|
|
|
function HeroAndEquipResolvePanel:OnOpen(_tabType)
|
|
|
|
|
tabType=_tabType
|
2021-07-29 15:01:58 +08:00
|
|
|
|
isPlayanim = true
|
|
|
|
|
isTop = true
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
function HeroAndEquipResolvePanel:OnShow()
|
|
|
|
|
tabSortType=0
|
|
|
|
|
this.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = _PanelType[tabType] })
|
|
|
|
|
this.GetTabTypeShoePanel(tabType)
|
2021-07-29 15:01:58 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
--隐藏 grid
|
|
|
|
|
function this.GetTabTypeShoePanel(_tabType)
|
|
|
|
|
this.heroObject:SetActive(false)
|
|
|
|
|
this.equipObject:SetActive(false)
|
|
|
|
|
this.btnHeroGrid:SetActive(false)
|
|
|
|
|
this.btnEquipGrid:SetActive(false)
|
|
|
|
|
this.btnSoulPrintGrid:SetActive(false)
|
|
|
|
|
this.btnEquiptreasureGrid:SetActive(false)
|
|
|
|
|
this.shopBtn:SetActive(false)
|
|
|
|
|
this.soulPrintScroll:SetActive(false)
|
|
|
|
|
this.soulPrintObject:SetActive(false)
|
|
|
|
|
if _tabType==1 then
|
|
|
|
|
this.heroObject:SetActive(true)
|
|
|
|
|
this.btnHeroGrid:SetActive(true)
|
|
|
|
|
this.shopBtn:SetActive(true)
|
|
|
|
|
this.SortTypeClick(tabSortType,heroEndBtns[1])
|
|
|
|
|
elseif _tabType==2 then
|
|
|
|
|
this.equipObject:SetActive(true)
|
|
|
|
|
this.btnEquipGrid:SetActive(true)
|
|
|
|
|
this.SortTypeClick(tabSortType,equipEndBtns[1])
|
|
|
|
|
elseif _tabType==3 then
|
|
|
|
|
this.equipObject:SetActive(true)
|
|
|
|
|
this.btnEquiptreasureGrid:SetActive(true)
|
|
|
|
|
this.SortTypeClick(tabSortType,equipTreasureEndBtns[1])
|
|
|
|
|
elseif _tabType==4 then
|
|
|
|
|
this.btnSoulPrintGrid:SetActive(true)
|
|
|
|
|
this.soulPrintScroll:SetActive(true)
|
|
|
|
|
this.soulPrintObject:SetActive(true)
|
|
|
|
|
this.SortTypeClick(tabSortType,soulPrintEndBtns[1])
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
--展示数据
|
|
|
|
|
function this.SortTypeClick(_sortType,_btn)
|
|
|
|
|
curSelectBtn=_btn
|
2020-06-30 18:59:44 +08:00
|
|
|
|
|
|
|
|
|
if _sortType and _sortType > 0 then
|
|
|
|
|
tabSortType = _sortType
|
|
|
|
|
else
|
|
|
|
|
tabSortType = 0
|
|
|
|
|
end
|
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.EndTabBtnSelect(_btn)
|
2020-07-06 20:35:39 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.CleanSelectList()
|
2020-07-16 10:49:01 +08:00
|
|
|
|
if tabType == 4 then
|
2020-07-01 10:54:39 +08:00
|
|
|
|
list={}
|
2020-06-30 18:59:44 +08:00
|
|
|
|
soulPrintData= BagManager.GetAllSoulPrintData(tabSortType)
|
2021-07-29 15:01:58 +08:00
|
|
|
|
table.sort(soulPrintData,function(a,b)
|
|
|
|
|
if a.quality == b.quality then
|
|
|
|
|
return a.id < b.id
|
|
|
|
|
else
|
|
|
|
|
return a.quality < b.quality
|
|
|
|
|
end
|
|
|
|
|
end)
|
2020-06-30 18:59:44 +08:00
|
|
|
|
this.soulPrintChooseType=tabSortType
|
|
|
|
|
if(not soulPrintData or #soulPrintData<1) then
|
|
|
|
|
this.noneImage:SetActive(true)
|
|
|
|
|
else
|
|
|
|
|
this.noneImage:SetActive(false)
|
|
|
|
|
end
|
2021-03-02 16:53:12 +08:00
|
|
|
|
this.selectText.text = Language[11728].."0/"..#soulPrintData
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.ScrollView3:SetData(soulPrintData, function (index, go)
|
2020-06-30 18:59:44 +08:00
|
|
|
|
this:SetSoulPrintData(go, soulPrintData[index],index)
|
2020-07-01 10:54:39 +08:00
|
|
|
|
table.insert(list,go)
|
2021-07-29 15:01:58 +08:00
|
|
|
|
end,not isTop,not isPlayanim)
|
|
|
|
|
if isPlayanim then
|
|
|
|
|
isPlayanim = false
|
|
|
|
|
end
|
|
|
|
|
if isTop then
|
|
|
|
|
isTop = false
|
|
|
|
|
end
|
2020-07-01 10:54:39 +08:00
|
|
|
|
--特效层级重设
|
2021-09-24 10:17:25 +08:00
|
|
|
|
for i=1,#list do
|
|
|
|
|
Util.AddParticleSortLayer(list[i], this.sortingOrder - orginLayer2)
|
|
|
|
|
end
|
|
|
|
|
orginLayer2 = this.sortingOrder
|
|
|
|
|
orginLayer = this.sortingOrder
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--设置魂印循环滚动数据
|
2020-06-30 18:59:44 +08:00
|
|
|
|
function this:SetSoulPrintData(_go, _itemData,index)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
_go.gameObject:SetActive(true)
|
|
|
|
|
local chooseBtn = Util.GetGameObject(_go.gameObject, "chooseBtn")
|
|
|
|
|
local quality = Util.GetGameObject(_go.gameObject, "quality"):GetComponent("Image")
|
2020-06-30 18:59:44 +08:00
|
|
|
|
local circle = Util.GetGameObject(_go.gameObject, "circle"):GetComponent("Image")
|
2021-07-29 15:21:44 +08:00
|
|
|
|
local icon = Util.GetGameObject(circle.gameObject, "icon"):GetComponent("Image")
|
2021-07-29 16:35:20 +08:00
|
|
|
|
local circleFrame = Util.GetGameObject(circle.gameObject, "circleFrame"):GetComponent("Image")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local name = Util.GetGameObject(_go.gameObject, "name"):GetComponent("Text")
|
|
|
|
|
local level = Util.GetGameObject(_go.gameObject, "level"):GetComponent("Text")
|
|
|
|
|
local chooseImage = Util.GetGameObject(_go.gameObject, "chooseImage")
|
2021-04-21 13:12:04 +08:00
|
|
|
|
quality.sprite = this.spLoader:LoadSprite(_itemData.frame)--GetQuantityImageByquality(_itemData.quality))
|
|
|
|
|
icon.sprite = this.spLoader:LoadSprite(_itemData.icon)
|
2021-07-29 16:35:20 +08:00
|
|
|
|
circle.sprite = this.spLoader:LoadSprite(SoulPrintSpriteByQuantity[_itemData.quality].circleBg2)
|
|
|
|
|
circleFrame.sprite = this.spLoader:LoadSprite(SoulPrintSpriteByQuantity[_itemData.quality].circle)
|
2021-03-07 17:00:15 +08:00
|
|
|
|
name.text = SubString2(GetLanguageStrById(_itemData.itemConfig.Name), 8)
|
2020-06-30 18:59:44 +08:00
|
|
|
|
level.gameObject:SetActive(false)
|
|
|
|
|
chooseImage:SetActive(_itemData.isSelect)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
Util.AddOnceClick(chooseBtn, function()
|
2020-06-30 18:59:44 +08:00
|
|
|
|
if (_itemData.isSelect) then
|
|
|
|
|
_itemData.isSelect = false
|
|
|
|
|
LogBlue("chooseIdList before:"..#chooseIdList)
|
|
|
|
|
for i=1,#chooseIdList do
|
|
|
|
|
if chooseIdList[i] == _itemData.id then
|
|
|
|
|
table.remove(chooseIdList,i)
|
|
|
|
|
break
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
soulPrintData[index].isSelect = false
|
|
|
|
|
LogBlue("chooseIdList after:"..#chooseIdList)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
else
|
2020-06-30 18:59:44 +08:00
|
|
|
|
_itemData.isSelect = true
|
|
|
|
|
table.insert(chooseIdList,_itemData.id)
|
|
|
|
|
soulPrintData[index].isSelect = true
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.UpdataPanelRewardAndSelectText()
|
2020-06-30 18:59:44 +08:00
|
|
|
|
chooseImage:SetActive(_itemData.isSelect)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end)
|
|
|
|
|
end
|
2020-07-06 20:35:39 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--上部页签排序
|
|
|
|
|
function this.UpTabBtnSelect(_index,_btn)
|
|
|
|
|
this.selectUpBtn.transform:SetParent(_btn.transform)
|
|
|
|
|
this.selectUpBtn.transform.localScale = Vector3.one
|
|
|
|
|
this.selectUpBtn.transform.localPosition=Vector3.zero
|
|
|
|
|
if _index == 1 then
|
|
|
|
|
this.selectUpBtnHeroImage:SetActive(true)
|
|
|
|
|
this.selectUpBtnEquipImage:SetActive(false)
|
|
|
|
|
elseif _index == 2 then
|
|
|
|
|
this.selectUpBtnHeroImage:SetActive(false)
|
|
|
|
|
this.selectUpBtnEquipImage:SetActive(true)
|
|
|
|
|
elseif _index == 3 then
|
|
|
|
|
this.selectUpBtnHeroImage:SetActive(false)
|
|
|
|
|
this.selectUpBtnEquipImage:SetActive(true)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
--下部页签排序
|
|
|
|
|
function this.EndTabBtnSelect(_btn)
|
|
|
|
|
if tabType == 1 then
|
|
|
|
|
this.selectEndBtn:SetActive(false)
|
|
|
|
|
this.selectHeroBtn:SetActive(tabSortType > 0)
|
|
|
|
|
this.selectHeroBtn.transform:SetParent(_btn.transform)
|
|
|
|
|
this.selectHeroBtn.transform.localScale = Vector3.one
|
|
|
|
|
this.selectHeroBtn.transform.localPosition=Vector3.zero
|
|
|
|
|
else
|
|
|
|
|
this.selectHeroBtn:SetActive(false)
|
|
|
|
|
this.selectEndBtn:SetActive(tabSortType > 0)
|
|
|
|
|
this.selectEndBtn.transform:SetParent(_btn.transform)
|
|
|
|
|
this.selectEndBtn.transform.localScale = Vector3.one
|
|
|
|
|
this.selectEndBtn.transform.localPosition=Vector3.zero
|
|
|
|
|
end
|
|
|
|
|
--Util.GetGameObject(this.selectEndBtn.transform, "Text"):GetComponent("Text").text = btnText
|
|
|
|
|
end
|
2020-07-16 10:49:01 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--计算奖励 和 已选择数量
|
|
|
|
|
function this.UpdataPanelRewardAndSelectText()
|
|
|
|
|
local allRewardData={}
|
2020-07-16 10:49:01 +08:00
|
|
|
|
if tabType == 4 then
|
2021-03-02 16:53:12 +08:00
|
|
|
|
this.selectText.text = Language[11728]..LengthOfTable(chooseIdList).."/"..#soulPrintData
|
2020-05-09 13:31:21 +08:00
|
|
|
|
for i, v in pairs(chooseIdList) do
|
2020-06-30 18:59:44 +08:00
|
|
|
|
local rewardGroupId = tonumber(itemConfig[v].ResolveReward)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if rewardGroup[rewardGroupId] then
|
|
|
|
|
local ShowItemlist = rewardGroup[rewardGroupId].ShowItem
|
|
|
|
|
if ShowItemlist and #ShowItemlist > 0 then
|
|
|
|
|
for i=1, #ShowItemlist do
|
|
|
|
|
local curReward={}
|
|
|
|
|
curReward.id=ShowItemlist[i][1]
|
|
|
|
|
curReward.num=ShowItemlist[i][2]
|
|
|
|
|
curReward.itemConfig=itemConfig[curReward.id]
|
|
|
|
|
if allRewardData[curReward.id]==nil then
|
|
|
|
|
allRewardData[curReward.id]=curReward
|
|
|
|
|
else
|
|
|
|
|
allRewardData[curReward.id].num=allRewardData[curReward.id].num+ curReward.num
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
itemMaxList={}
|
|
|
|
|
--实例化分解可得奖励
|
|
|
|
|
Util.ClearChild(this.rewardGrid.transform)
|
|
|
|
|
for i, v in pairs(allRewardData) do
|
|
|
|
|
local go=newObject(this.itemRewardPre)
|
|
|
|
|
go.transform:SetParent(this.rewardGrid.transform)
|
|
|
|
|
go.transform.localScale = Vector3.one
|
|
|
|
|
go.transform.localPosition=Vector3.zero
|
2021-04-21 13:12:04 +08:00
|
|
|
|
Util.GetGameObject(go.transform, "Image"):GetComponent("Image").sprite=this.spLoader:LoadSprite(GetResourcePath(v.itemConfig.ResourceID))
|
2020-05-09 13:31:21 +08:00
|
|
|
|
Util.GetGameObject(go.transform, "Text"):GetComponent("Text").text="X"..PrintWanNum2(v.num)
|
|
|
|
|
go:SetActive(true)
|
|
|
|
|
if BagManager.GetItemCountById(v.id)+v.num>v.itemConfig.ItemNumlimit then
|
2021-01-26 17:08:39 +08:00
|
|
|
|
table.insert(itemMaxList,GetLanguageStrById(v.itemConfig.Name))
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if LengthOfTable(allRewardData)>0 then
|
|
|
|
|
this.rewardGridText:SetActive(true)
|
|
|
|
|
else
|
|
|
|
|
this.rewardGridText:SetActive(false)
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-07-16 10:49:01 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--清空已选择的英雄和装备list
|
|
|
|
|
function this.CleanSelectList()
|
|
|
|
|
selectHeroData={}
|
|
|
|
|
selectEquipData={}
|
|
|
|
|
selectEquipTreasureData = {}
|
|
|
|
|
chooseIdList={}
|
|
|
|
|
this.UpdataPanelRewardAndSelectText()
|
|
|
|
|
end
|
2020-06-30 18:59:44 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--快速选择英雄 或者 装备
|
|
|
|
|
function this.QuickSelectListData()
|
2020-07-16 10:49:01 +08:00
|
|
|
|
if tabType == 4 then
|
2020-05-09 13:31:21 +08:00
|
|
|
|
chooseIdList={}
|
2020-06-30 18:59:44 +08:00
|
|
|
|
local tempchooseIdList={}
|
2020-05-09 13:31:21 +08:00
|
|
|
|
for k, v in pairs(soulPrintData) do
|
|
|
|
|
if LengthOfTable(chooseIdList)<30 then
|
2020-06-30 18:59:44 +08:00
|
|
|
|
table.insert(chooseIdList,v.id)
|
|
|
|
|
table.insert(tempchooseIdList,v.id)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
else
|
|
|
|
|
break
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-06-30 18:59:44 +08:00
|
|
|
|
if tempchooseIdList and #tempchooseIdList > 0 then
|
|
|
|
|
for n,m in pairs(soulPrintData) do
|
|
|
|
|
m.isSelect=false
|
|
|
|
|
for i=1,#tempchooseIdList do
|
|
|
|
|
if tempchooseIdList[i] == m.id then
|
|
|
|
|
table.remove(tempchooseIdList,i)
|
|
|
|
|
m.isSelect=true
|
|
|
|
|
break
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.ScrollView3:SetData(soulPrintData, function (index, go)
|
2020-06-30 18:59:44 +08:00
|
|
|
|
this:SetSoulPrintData(go, soulPrintData[index],index)
|
2021-07-29 15:01:58 +08:00
|
|
|
|
end,not isTop,not isPlayanim)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
this.UpdataPanelRewardAndSelectText()
|
|
|
|
|
end
|
2020-06-30 18:59:44 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
function this.SendBackResolveReCallBack(drop)
|
|
|
|
|
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)
|
|
|
|
|
end)
|
|
|
|
|
else
|
|
|
|
|
BagManager.OnShowTipDropNumZero(drop)
|
|
|
|
|
end
|
2020-07-16 10:49:01 +08:00
|
|
|
|
if tabType== 4 then
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--移除魂印
|
|
|
|
|
SoulPrintManager.RemoveSoulPrint(chooseIdList)
|
|
|
|
|
local soulPrint= SoulPrintManager.GetSoulPrintQualityDataByType(this.soulPrintChooseType)
|
|
|
|
|
soulPrintData=SoulPrintManager.GetSoulPrintAndSort(soulPrint)
|
2021-03-02 16:53:12 +08:00
|
|
|
|
this.selectText.text = Language[11728].."0/"..#soulPrintData
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
this.CleanSelectList()
|
|
|
|
|
--刷新界面
|
2021-01-09 14:20:06 +08:00
|
|
|
|
Log("刷新界面 "..tabSortType.." "..curSelectBtn.name)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.SortTypeClick(tabSortType,curSelectBtn)
|
|
|
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.Bag.BagGold)
|
|
|
|
|
end
|
|
|
|
|
--分解按钮事件处理
|
|
|
|
|
function this.ResolveBtnClickEvent()
|
|
|
|
|
local curResolveAllItemList={}
|
|
|
|
|
local isSoulPrintShowSure=false
|
|
|
|
|
local type=-1
|
2020-07-16 10:49:01 +08:00
|
|
|
|
if tabType==4 then
|
2020-06-30 18:59:44 +08:00
|
|
|
|
isSoulPrintShowSure=false
|
|
|
|
|
type=1
|
|
|
|
|
local temp = {}
|
|
|
|
|
|
|
|
|
|
for i=1,#chooseIdList do
|
|
|
|
|
if temp[chooseIdList[i]] and temp[chooseIdList[i]] >=1 then
|
|
|
|
|
temp[chooseIdList[i]] = temp[chooseIdList[i]] + 1
|
|
|
|
|
else
|
|
|
|
|
temp[chooseIdList[i]] = 1
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
2020-06-30 18:59:44 +08:00
|
|
|
|
if not isSoulPrintShowSure then
|
2021-09-24 10:17:25 +08:00
|
|
|
|
for x=1,#soulPrintData do
|
|
|
|
|
if soulPrintData[x].id == chooseIdList[i] and soulPrintData[x].quality > 4 then
|
2020-06-30 18:59:44 +08:00
|
|
|
|
isSoulPrintShowSure=true
|
|
|
|
|
break
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local index=1
|
|
|
|
|
for k,v in pairs(temp) do
|
|
|
|
|
local item={}
|
|
|
|
|
item.itemId = k
|
|
|
|
|
item.itemNum = v
|
|
|
|
|
curResolveAllItemList[index] = item
|
|
|
|
|
index = index+1
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
2020-07-16 10:49:01 +08:00
|
|
|
|
if isSoulPrintShowSure then
|
|
|
|
|
if isSoulPrintShowSure then
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local isPopUp = RedPointManager.PlayerPrefsGetStr(PlayerManager.uid .. "isSoulPrintShowSure")
|
|
|
|
|
local currentTime = os.date("%Y%m%d", PlayerManager.serverTime)
|
|
|
|
|
if (isPopUp ~= currentTime) then
|
2021-04-01 18:36:34 +08:00
|
|
|
|
MsgPanel.ShowTwo(Language[12260], nil, function(isShow)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if (isShow) then
|
|
|
|
|
local currentTime = os.date("%Y%m%d", PlayerManager.serverTime)
|
|
|
|
|
RedPointManager.PlayerPrefsSetStr(PlayerManager.uid .."isSoulPrintShowSure", currentTime)
|
|
|
|
|
end
|
|
|
|
|
if #itemMaxList>0 then--是否分解物品有超过物品上限的
|
|
|
|
|
this.GetItemIsBeyondMaxNum(type,curResolveAllItemList)
|
|
|
|
|
else
|
|
|
|
|
NetManager.UseAndPriceItemRequest(type,curResolveAllItemList,function (drop)
|
|
|
|
|
this.SendBackResolveReCallBack(drop)
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
end,nil,nil,nil,true)
|
|
|
|
|
else
|
|
|
|
|
if #itemMaxList>0 then--是否分解物品有超过物品上限的
|
|
|
|
|
this.GetItemIsBeyondMaxNum(type,curResolveAllItemList)
|
|
|
|
|
else
|
|
|
|
|
NetManager.UseAndPriceItemRequest(type,curResolveAllItemList,function (drop)
|
|
|
|
|
this.SendBackResolveReCallBack(drop)
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
if #curResolveAllItemList>0 then
|
|
|
|
|
if #itemMaxList>0 then--是否分解物品有超过物品上限的
|
|
|
|
|
this.GetItemIsBeyondMaxNum(type,curResolveAllItemList)
|
|
|
|
|
else
|
|
|
|
|
NetManager.UseAndPriceItemRequest(type,curResolveAllItemList,function (drop)
|
|
|
|
|
this.SendBackResolveReCallBack(drop)
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
else
|
2021-03-02 16:53:12 +08:00
|
|
|
|
PopupTipPanel.ShowTip(Language[11730])
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
function this.GetItemIsBeyondMaxNum(type,curResolveAllItemList)
|
|
|
|
|
if #itemMaxList>0 then--是否分解物品有超过物品上限的
|
|
|
|
|
local itemMaxNumStr=""
|
|
|
|
|
for i = 1, #itemMaxList do
|
|
|
|
|
if i==#itemMaxList then
|
|
|
|
|
itemMaxNumStr=itemMaxNumStr..itemMaxList[i]
|
|
|
|
|
else
|
|
|
|
|
itemMaxNumStr=itemMaxNumStr..itemMaxList[i].."、"
|
|
|
|
|
end
|
|
|
|
|
end
|
2021-03-02 16:53:12 +08:00
|
|
|
|
MsgPanel.ShowTwo(itemMaxNumStr..Language[11731],nil, function()
|
2021-01-09 14:20:06 +08:00
|
|
|
|
Log("资源已达上限,超出部分将无法获得,是否分解")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
NetManager.UseAndPriceItemRequest(type,curResolveAllItemList,function (drop)
|
2021-01-09 14:20:06 +08:00
|
|
|
|
Log("资源已达上限,超出部分将无法获得,是否分解222")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.SendBackResolveReCallBack(drop)
|
|
|
|
|
end)
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
--界面关闭时调用(用于子类重写)
|
|
|
|
|
function HeroAndEquipResolvePanel:OnClose()
|
2021-07-29 15:01:58 +08:00
|
|
|
|
isPlayanim = true
|
|
|
|
|
isTop = true
|
2020-05-09 13:31:21 +08:00
|
|
|
|
tabSortType = 0
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面销毁时调用(用于子类重写)
|
|
|
|
|
function HeroAndEquipResolvePanel:OnDestroy()
|
2021-04-21 13:12:04 +08:00
|
|
|
|
this.spLoader:Destroy()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
|
|
|
|
SubUIManager.Close(this.UpView)
|
|
|
|
|
this.ScrollView = nil
|
|
|
|
|
this.ScrollView2 = nil
|
|
|
|
|
this.ScrollView3=nil
|
2020-07-01 10:54:39 +08:00
|
|
|
|
list={}
|
|
|
|
|
orginLayer2=0
|
|
|
|
|
orginLayer=0
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
2020-07-01 10:54:39 +08:00
|
|
|
|
function this.OnSortingOrderChange()
|
|
|
|
|
--特效层级重设
|
|
|
|
|
for i=1,#list do
|
|
|
|
|
Util.AddParticleSortLayer(list[i], this.sortingOrder- orginLayer)
|
|
|
|
|
end
|
|
|
|
|
orginLayer = this.sortingOrder
|
|
|
|
|
end
|
|
|
|
|
|
2020-06-23 18:36:24 +08:00
|
|
|
|
return HeroAndEquipResolvePanel
|