2021-04-21 13:12:04 +08:00
|
|
|
|
require("Base/BasePanel")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
BagPanel = Inherit(BasePanel)
|
|
|
|
|
local this = BagPanel
|
|
|
|
|
local sortIndex = 0
|
|
|
|
|
local sortIndexBtnGo
|
|
|
|
|
local tabs1 = {}
|
|
|
|
|
local tabs1RedPoint = {}
|
|
|
|
|
local itemData = {}
|
|
|
|
|
this.isFristOpen = true
|
|
|
|
|
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
|
|
|
|
|
local specialConfig = ConfigManager.GetConfig(ConfigName.SpecialConfig)
|
|
|
|
|
local isFristOpenTime = Timer.New()
|
2020-06-30 18:59:44 +08:00
|
|
|
|
local orginLayer=0--层级
|
2020-07-01 10:54:39 +08:00
|
|
|
|
local list={}
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--初始化组件(用于子类重写)
|
|
|
|
|
function BagPanel:InitComponent()
|
2021-04-21 13:12:04 +08:00
|
|
|
|
this.spLoader = SpriteLoader.New()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
|
|
|
|
this.BtnBack = Util.GetGameObject(self.transform, "rightUp/btnBack")
|
|
|
|
|
for i = 0, 7 do
|
|
|
|
|
tabs1[i] = Util.GetGameObject(self.transform, "box/Btn" .. i)
|
|
|
|
|
tabs1RedPoint[i] = Util.GetGameObject(self.transform, "box/Btn" .. i .. "/redPoint")
|
|
|
|
|
end
|
2021-03-30 18:42:30 +08:00
|
|
|
|
if not this.playerInfoView then
|
|
|
|
|
this.playerInfoView = SubUIManager.Open(SubUIConfig.PlayerInfoView, this.transform)
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.selectBtn1 = Util.GetGameObject(self.gameObject, "selectBtn")
|
|
|
|
|
this.BtView = SubUIManager.Open(SubUIConfig.BtView, self.gameObject.transform)
|
|
|
|
|
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform)
|
|
|
|
|
this.fenJieBtn = Util.GetGameObject(self.gameObject, "fenJieBtn")
|
|
|
|
|
this.itemNumText = Util.GetGameObject(self.gameObject, "itemNumText")
|
|
|
|
|
this.ItemView = Util.GetGameObject(self.gameObject, "ItemView")
|
|
|
|
|
this.ItemViewEffect = Util.GetGameObject(self.gameObject, "ItemView/GameObject/effects")
|
|
|
|
|
this.item = Util.GetGameObject(self.gameObject, "Item")
|
|
|
|
|
this.grid = Util.GetGameObject(self.gameObject, "scroll/grid")
|
|
|
|
|
this.Scrollbar = Util.GetGameObject(self.gameObject, "Scrollbar"):GetComponent("Scrollbar")
|
|
|
|
|
this.isBagPanel = true
|
|
|
|
|
this.EffectOrginLayer = 0
|
|
|
|
|
this.mask = Util.GetGameObject(self.gameObject, "mask")
|
|
|
|
|
|
|
|
|
|
--无信息图片
|
|
|
|
|
this.noneImage=Util.GetGameObject(self.gameObject,"NoneImage")
|
|
|
|
|
end
|
|
|
|
|
|
2020-07-10 18:29:38 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--绑定事件(用于子类重写)
|
|
|
|
|
function BagPanel:BindEvent()
|
|
|
|
|
|
|
|
|
|
Util.AddClick(this.BtnBack, function()
|
|
|
|
|
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
|
|
|
|
|
self:ClosePanel()
|
|
|
|
|
end)
|
|
|
|
|
for i = 0, 7 do
|
|
|
|
|
Util.AddClick(tabs1[i], function()
|
|
|
|
|
if this.isFristOpen == false then
|
|
|
|
|
if i == sortIndex then
|
2020-12-28 16:26:38 +08:00
|
|
|
|
return
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
2020-12-28 16:26:38 +08:00
|
|
|
|
sortIndex = i
|
|
|
|
|
this.OnClickTabBtn(sortIndex, tabs1[sortIndex])
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
Util.AddClick(this.fenJieBtn, function()
|
2020-07-10 18:29:38 +08:00
|
|
|
|
if sortIndex == ItemBaseType.Equip then
|
2020-09-02 14:47:53 +08:00
|
|
|
|
local temp = BagManager.GetBagItemDataByItemType(ItemBaseType.Equip)
|
|
|
|
|
if not temp or #temp < 1 then
|
2021-04-09 12:26:35 +08:00
|
|
|
|
PopupTipPanel.ShowTip(Language[10170])
|
2020-09-02 14:47:53 +08:00
|
|
|
|
else
|
|
|
|
|
UIManager.OpenPanel(UIName.EquipSellSelectPopup)--宝器
|
|
|
|
|
end
|
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
elseif sortIndex == ItemBaseType.SoulPrint then
|
2020-09-02 14:47:53 +08:00
|
|
|
|
local temp = BagManager.GetAllSoulPrintData()
|
|
|
|
|
if not temp or #temp < 1 then
|
2021-04-09 12:26:35 +08:00
|
|
|
|
PopupTipPanel.ShowTip(Language[10171])
|
2020-09-02 14:47:53 +08:00
|
|
|
|
else
|
|
|
|
|
UIManager.OpenPanel(UIName.HeroAndEquipResolvePanel, 4)--魂印
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
BindRedPointObject(RedPointType.Bag_HeroDebris, tabs1RedPoint[ItemBaseType.HeroChip])
|
|
|
|
|
BindRedPointObject(RedPointType.Bag_BoxAndBlueprint, tabs1RedPoint[ItemBaseType.Special])
|
|
|
|
|
|
|
|
|
|
end
|
2020-07-06 20:35:39 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
function this.JumpOnClickTabBtn(_sortIndex)
|
|
|
|
|
sortIndex = _sortIndex
|
2020-12-30 19:51:14 +08:00
|
|
|
|
this.OnClickTabBtn(sortIndex, tabs1[sortIndex], true)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
function this:SetSelectBtn(_btn)
|
|
|
|
|
if _btn then
|
|
|
|
|
this.selectBtn1:SetActive(true)
|
|
|
|
|
this.selectBtn1.transform:SetParent(_btn.transform)
|
|
|
|
|
this.selectBtn1.transform.localPosition = Vector3.zero
|
|
|
|
|
Util.GetGameObject(this.selectBtn1.transform, "Text"):GetComponent("Text").text = Util.GetGameObject(_btn.transform, "Text"):GetComponent("Text").text
|
|
|
|
|
else
|
|
|
|
|
this.selectBtn1:SetActive(false)
|
|
|
|
|
end
|
2020-07-10 18:29:38 +08:00
|
|
|
|
this.fenJieBtn:SetActive(sortIndex == ItemBaseType.SoulPrint or sortIndex == ItemBaseType.Equip)--装备
|
2021-04-21 13:12:04 +08:00
|
|
|
|
this.fenJieBtn:GetComponent("Image").sprite = this.spLoader:LoadSprite(sortIndex == ItemBaseType.SoulPrint and "r_fenjie_zh" or "r_chushou_zh" )--装备
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.itemNumText:SetActive(sortIndex == ItemBaseType.Equip or sortIndex == ItemBaseType.SoulPrint or sortIndex == ItemBaseType.EquipTreasure)--装备 法宝
|
|
|
|
|
end
|
|
|
|
|
|
2020-12-28 16:26:38 +08:00
|
|
|
|
-- --点击全部按钮
|
|
|
|
|
-- function this:OnClickAllBtn()
|
|
|
|
|
-- sortIndex = 0
|
|
|
|
|
-- this:SetSelectBtn(tabs1[sortIndex])
|
|
|
|
|
-- sortIndexBtnGo = tabs1[sortIndex]
|
|
|
|
|
-- itemData = {}
|
|
|
|
|
-- itemData = this.GetBagItemData()
|
|
|
|
|
-- local curAllEquipTreasure = EquipTreasureManager.GetAllTreasures()
|
|
|
|
|
-- for i = 1, #curAllEquipTreasure do
|
|
|
|
|
-- table.insert(itemData, curAllEquipTreasure[i])
|
|
|
|
|
-- end
|
|
|
|
|
-- local soulPrintData = BagManager.GetAllSoulPrintData()
|
|
|
|
|
-- for i,v in ipairs(soulPrintData) do
|
|
|
|
|
-- table.insert(itemData, v)
|
|
|
|
|
-- end
|
|
|
|
|
|
|
|
|
|
-- this:SetItemData(itemData)
|
|
|
|
|
-- this.noneImage:SetActive(#itemData==0)
|
|
|
|
|
|
|
|
|
|
-- end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
function this.BagGoldChangeCallBackOnClickTabBtn()
|
2021-02-25 12:04:31 +08:00
|
|
|
|
this.OnClickTabBtn(sortIndex, sortIndexBtnGo,false,true)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
2020-07-06 20:35:39 +08:00
|
|
|
|
|
2021-02-25 12:04:31 +08:00
|
|
|
|
function this.OnClickTabBtn(_index, _clickBtn, isTop,isNotAni)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
sortIndexBtnGo = _clickBtn
|
|
|
|
|
itemData = {}
|
|
|
|
|
local itemNumText = this.itemNumText:GetComponent("Text")
|
|
|
|
|
this:SetSelectBtn(_clickBtn)
|
2021-01-15 21:06:48 +08:00
|
|
|
|
print("_index ".._index)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if _index == ItemBaseType.Equip then
|
2020-07-06 20:35:39 +08:00
|
|
|
|
local allEquipData = BagManager.GetBagItemDataByItemType(ItemBaseType.Equip)
|
2021-02-01 17:58:02 +08:00
|
|
|
|
-- local allEquipNum = 0
|
2020-05-09 13:31:21 +08:00
|
|
|
|
for i, v in pairs(allEquipData) do
|
|
|
|
|
table.insert(itemData, v)
|
2021-02-01 17:58:02 +08:00
|
|
|
|
-- allEquipNum = allEquipNum + v.num
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
2021-02-20 16:55:28 +08:00
|
|
|
|
--"装备数量:"
|
2021-04-09 12:26:35 +08:00
|
|
|
|
itemNumText.text = Language[12181] ..LengthOfTable(allEquipData).."/"..ConfigManager.GetConfigData(ConfigName.GameSetting,1).EquipNumlimit
|
2021-02-25 12:04:31 +08:00
|
|
|
|
this:SetItemData(itemData, isTop,isNotAni)
|
2020-12-28 16:26:38 +08:00
|
|
|
|
-- elseif _index == 0 then
|
|
|
|
|
-- this:OnClickAllBtn()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
elseif (_index == ItemBaseType.SoulPrint) then
|
2020-06-30 18:59:44 +08:00
|
|
|
|
itemData = BagManager.GetAllSoulPrintData()
|
2021-04-09 12:26:35 +08:00
|
|
|
|
itemNumText.text = Language[10173]..#itemData.."/"..specialConfig[9].Value
|
2021-02-25 12:04:31 +08:00
|
|
|
|
this:SetItemData(itemData, isTop,isNotAni)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
elseif (_index == ItemBaseType.EquipTreasure) then
|
|
|
|
|
itemData = EquipTreasureManager.GetAllTreasures()
|
2021-04-09 12:26:35 +08:00
|
|
|
|
itemNumText.text = Language[10174]..LengthOfTable(itemData).."/"..specialConfig[10].Value
|
2021-02-25 12:04:31 +08:00
|
|
|
|
this:SetItemData(itemData, isTop,isNotAni)
|
2020-12-28 16:26:38 +08:00
|
|
|
|
elseif (_index == ItemBaseType.Special) then
|
2021-01-15 21:06:48 +08:00
|
|
|
|
itemData = BagManager.GetBagItemDataByItemTypeV2(ItemBaseType.Special,ItemBaseType.Materials,ItemType.HeadFrame)
|
2021-02-25 12:04:31 +08:00
|
|
|
|
this:SetItemData(itemData, isTop,isNotAni)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
else
|
2021-01-15 21:06:48 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
itemData = BagManager.GetBagItemDataByItemType(_index)
|
2021-02-25 12:04:31 +08:00
|
|
|
|
this:SetItemData(itemData, isTop,isNotAni)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
this.noneImage:SetActive(#itemData==0)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--当魂印升级消耗时刷新背包数据
|
|
|
|
|
function this.OnRefreshSoulPanelBagData()
|
|
|
|
|
itemData = SoulPrintManager.soulPrintData
|
2020-12-30 19:51:14 +08:00
|
|
|
|
this:SetItemData(itemData)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
2020-07-07 18:13:34 +08:00
|
|
|
|
local orginLayer2 = 0
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--设置背包列表数据
|
2021-02-25 12:04:31 +08:00
|
|
|
|
function this:SetItemData(_itemDatas, isTop,isNotAni)
|
2021-03-02 16:44:38 +08:00
|
|
|
|
-- LogPink("IsTop = "..tostring(isTop))
|
|
|
|
|
-- LogPink("isNotAni = "..tostring(isNotAni))
|
2020-07-01 10:54:39 +08:00
|
|
|
|
list={}
|
2020-12-28 16:26:38 +08:00
|
|
|
|
this.ItemsSortDataV2(_itemDatas)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if not this.ScrollView then
|
|
|
|
|
local v2 = Util.GetGameObject(self.gameObject, "scroll"):GetComponent("RectTransform").rect
|
|
|
|
|
this.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, Util.GetGameObject(self.transform, "scroll").transform,
|
|
|
|
|
this.ItemView, this.Scrollbar, Vector2.New(-v2.x * 2, -v2.y * 2), 1, 5, Vector2.New(40, 11))
|
|
|
|
|
this.ScrollView.moveTween.MomentumAmount = 1
|
|
|
|
|
this.ScrollView.moveTween.Strength = 2
|
|
|
|
|
end
|
|
|
|
|
this.ScrollView:SetData(_itemDatas, function(index, go)
|
2020-12-30 19:51:14 +08:00
|
|
|
|
this.SingleItemDataShow(go, _itemDatas[index])
|
|
|
|
|
if _itemDatas[index].itemConfig.ItemType == ItemType.HunYin then
|
|
|
|
|
table.insert(list, go)
|
|
|
|
|
end
|
2021-02-25 12:04:31 +08:00
|
|
|
|
end, not isTop,isNotAni)
|
2020-07-01 10:54:39 +08:00
|
|
|
|
--特效层级重设
|
|
|
|
|
for i=1,#list do
|
|
|
|
|
Util.AddParticleSortLayer(list[i], this.sortingOrder- orginLayer2)
|
|
|
|
|
end
|
|
|
|
|
orginLayer2 = this.sortingOrder
|
|
|
|
|
orginLayer = this.sortingOrder
|
2020-06-30 18:59:44 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if this.isFristOpen then
|
2020-12-29 19:13:14 +08:00
|
|
|
|
-- this.ScrollView:ForeachItemGO(function(index, go)
|
|
|
|
|
-- Timer.New(function()
|
|
|
|
|
-- go.gameObject:SetActive(true)
|
|
|
|
|
-- PlayUIAnim(go.gameObject)
|
|
|
|
|
-- end, 0.01 * (index - 1)):Start()
|
|
|
|
|
-- end)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if isFristOpenTime then
|
|
|
|
|
isFristOpenTime:Stop()
|
|
|
|
|
isFristOpenTime = nil
|
|
|
|
|
end
|
|
|
|
|
isFristOpenTime = Timer.New(function()
|
|
|
|
|
this.isFristOpen = false
|
|
|
|
|
this.mask:SetActive(false)
|
|
|
|
|
end, 0.5):Start()
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--设置魂印循环滚动数据
|
|
|
|
|
function this:SetSoulPrintData(_go, _itemData)
|
|
|
|
|
local openBtn = Util.GetGameObject(_go.gameObject, "openBtn")
|
|
|
|
|
local quality = Util.GetGameObject(_go.gameObject, "itemShow/quality"):GetComponent("Image")
|
|
|
|
|
local icon = Util.GetGameObject(_go.gameObject, "itemShow/icon"):GetComponent("Image")
|
|
|
|
|
local name = Util.GetGameObject(_go.gameObject, "itemShow/Image/name"):GetComponent("Text")
|
|
|
|
|
local level = Util.GetGameObject(_go.gameObject, "itemShow/level"):GetComponent("Text")
|
|
|
|
|
local propertyText = Util.GetGameObject(_go.gameObject, "propertyText"):GetComponent("Text")
|
|
|
|
|
local propertyText2 = Util.GetGameObject(_go.gameObject, "propertyText (1)"):GetComponent("Text")
|
2021-04-21 13:12:04 +08:00
|
|
|
|
quality.sprite = this.spLoader:LoadSprite(GetQuantityImageByquality(_itemData.quality))
|
|
|
|
|
icon.sprite = this.spLoader:LoadSprite(_itemData.icon)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
name.text = _itemData.name
|
2020-07-10 18:29:38 +08:00
|
|
|
|
num.gameObject.SetActive(false)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
level.text = "+" .. _itemData.level
|
|
|
|
|
propertyText.text = ""
|
|
|
|
|
propertyText2.text = ""
|
|
|
|
|
local property = SoulPrintManager.GetShowPropertyData(_itemData.property[1][1], _itemData.property[1][2])
|
|
|
|
|
propertyText.text = property.name .. property.num
|
|
|
|
|
if (#_itemData.property >= 2) then
|
|
|
|
|
property = SoulPrintManager.GetShowPropertyData(_itemData.property[2][1], _itemData.property[2][2])
|
|
|
|
|
propertyText2.text = property.name .. property.num
|
|
|
|
|
end
|
|
|
|
|
Util.AddOnceClick(openBtn, function()
|
|
|
|
|
UIManager.OpenPanel(UIName.SoulPrintPopUp, ShowType.showTip3, _itemData.did, nil, nil, nil)
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.SingleItemDataShow(_go, _itemData)
|
|
|
|
|
Util.GetGameObject(_go.gameObject, "GameObject/item"):SetActive(true)
|
2021-04-21 13:12:04 +08:00
|
|
|
|
Util.GetGameObject(_go.gameObject, "GameObject/item/frame"):GetComponent("Image").sprite = this.spLoader:LoadSprite(_itemData.frame)
|
|
|
|
|
Util.GetGameObject(_go.gameObject, "GameObject/item/icon"):GetComponent("Image").sprite = this.spLoader:LoadSprite(_itemData.icon)
|
2020-06-23 18:36:24 +08:00
|
|
|
|
Util.GetGameObject(_go.gameObject, "GameObject/item/icon"):SetActive(true)
|
|
|
|
|
Util.GetGameObject(_go.gameObject, "GameObject/item/circleFrameBg"):SetActive(false)
|
2020-08-28 18:37:16 +08:00
|
|
|
|
|
|
|
|
|
local str=""
|
2021-01-26 17:08:39 +08:00
|
|
|
|
if GetCurLanguage() == 0 and LengthString(GetLanguageStrById(_itemData.itemConfig.Name))>6 then
|
|
|
|
|
str=SubString(GetLanguageStrById(_itemData.itemConfig.Name),5).."..."
|
|
|
|
|
elseif GetCurLanguage() == 1 and LengthString(GetLanguageStrById(_itemData.itemConfig.Name))>8 then
|
|
|
|
|
str=SubString(GetLanguageStrById(_itemData.itemConfig.Name),8).."..."
|
2021-02-18 17:21:14 +08:00
|
|
|
|
elseif GetCurLanguage() == 2 and LengthString(GetLanguageStrById(_itemData.itemConfig.Name))>8 then
|
|
|
|
|
str=SubString(GetLanguageStrById(_itemData.itemConfig.Name),8).."..."
|
2020-08-28 18:37:16 +08:00
|
|
|
|
else
|
2021-01-26 17:08:39 +08:00
|
|
|
|
str = GetLanguageStrById(_itemData.itemConfig.Name)
|
2020-08-28 18:37:16 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
Util.GetGameObject(_go.gameObject, "GameObject/name"):GetComponent("Text").text = str
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local upHeroInage = Util.GetGameObject(_go.transform, "GameObject/item/upHeroInage")
|
2020-08-02 09:16:45 +08:00
|
|
|
|
|
|
|
|
|
local UI_Effect_jinkuang_Fang = Util.GetGameObject(_go.transform, "GameObject/effects/UI_Effect_jinkuang_Fang")
|
|
|
|
|
if(UI_Effect_jinkuang_Fang) then
|
|
|
|
|
UI_Effect_jinkuang_Fang:SetActive(false)
|
|
|
|
|
end
|
|
|
|
|
local UI_Effect_jinkuang_Yuan = Util.GetGameObject(_go.transform, "GameObject/effects/UI_Effect_jinkuang_Yuan")
|
|
|
|
|
if(UI_Effect_jinkuang_Yuan) then
|
|
|
|
|
UI_Effect_jinkuang_Yuan:SetActive(false)
|
|
|
|
|
end
|
2020-06-30 18:59:44 +08:00
|
|
|
|
local UI_Effect_Kuang_JinSe = Util.GetGameObject(_go.transform, "GameObject/effects/UI_Effect_Kuang_JinSe")
|
|
|
|
|
if(UI_Effect_Kuang_JinSe) then
|
|
|
|
|
UI_Effect_Kuang_JinSe:SetActive(false)
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
upHeroInage:SetActive(false)
|
|
|
|
|
local frameMask = Util.GetGameObject(_go.transform, "GameObject/item/frameMask")
|
|
|
|
|
frameMask:SetActive(false)
|
|
|
|
|
local num = Util.GetGameObject(_go.gameObject, "GameObject/item/num")
|
2020-05-15 16:52:35 +08:00
|
|
|
|
local strongLv=Util.GetGameObject(_go.gameObject, "GameObject/item/lv"):GetComponent("Text")
|
|
|
|
|
local refine=Util.GetGameObject(_go.gameObject, "GameObject/item/refine"):GetComponent("Text")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local resetLv = Util.GetGameObject(_go.gameObject, "GameObject/item/resetLv")
|
|
|
|
|
local talismanStar = Util.GetGameObject(_go.gameObject, "GameObject/item/talismanStar")
|
|
|
|
|
num:SetActive(true)
|
|
|
|
|
resetLv:SetActive(false)
|
|
|
|
|
talismanStar:SetActive(false)
|
2020-05-15 16:52:35 +08:00
|
|
|
|
strongLv.gameObject:SetActive(false)
|
|
|
|
|
refine.gameObject:SetActive(false)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if _itemData.itemConfig then
|
|
|
|
|
Util.GetGameObject(_go.transform, "GameObject/item/innateImage"):SetActive(false)
|
|
|
|
|
Util.GetGameObject(_go.transform, "GameObject/item/fragmentIcon"):SetActive(false)
|
2020-07-06 20:35:39 +08:00
|
|
|
|
num:SetActive(true)
|
|
|
|
|
num:GetComponent("Text").text = _itemData.num
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if _itemData.itemConfig.ItemType == ItemType.Equip then
|
2020-07-06 20:35:39 +08:00
|
|
|
|
--装备
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local equipConfig = ConfigManager.GetConfigData(ConfigName.EquipConfig,_itemData.itemConfig.Id)
|
|
|
|
|
if equipConfig then
|
|
|
|
|
local equipStarsConfig = ConfigManager.GetConfigData(ConfigName.EquipStarsConfig,equipConfig.Star)
|
|
|
|
|
if equipStarsConfig then
|
|
|
|
|
talismanStar:SetActive(true)
|
2021-04-21 13:12:04 +08:00
|
|
|
|
SetHeroStars(this.spLoader, talismanStar, equipStarsConfig.Stars,1,Vector2.New(32.5,32.5),-15)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
elseif _itemData.itemConfig.ItemType == ItemType.Pokemon then
|
2021-04-21 13:12:04 +08:00
|
|
|
|
Util.GetGameObject(_go.gameObject, "GameObject/item/frame"):GetComponent("Image").sprite = this.spLoader:LoadSprite(YaoHunFrame[_itemData.quality])
|
2020-07-06 20:35:39 +08:00
|
|
|
|
num:SetActive(false)
|
|
|
|
|
elseif _itemData.itemConfig.ItemType == ItemType.HeroDebris then
|
2020-05-09 13:31:21 +08:00
|
|
|
|
frameMask:SetActive(true)
|
|
|
|
|
num:SetActive(false)
|
2021-04-21 13:12:04 +08:00
|
|
|
|
frameMask:GetComponent("Image").sprite = this.spLoader:LoadSprite(GetHeroChipQuantityImageByquality(_itemData.itemConfig.Quantity))
|
2020-05-09 13:31:21 +08:00
|
|
|
|
Util.GetGameObject(_go.transform, "GameObject/item/frameMask/exp/Text"):GetComponent("Text").text = BagManager.GetItemCountById(_itemData.itemConfig.Id) .. "/" .. _itemData.itemConfig.UsePerCount
|
|
|
|
|
local curExpVal = BagManager.GetItemCountById(_itemData.itemConfig.Id) / _itemData.itemConfig.UsePerCount
|
|
|
|
|
local expValue = curExpVal >= 1 and 1 or curExpVal
|
|
|
|
|
Util.GetGameObject(_go.transform, "GameObject/item/frameMask/exp"):GetComponent("Slider").value = expValue
|
|
|
|
|
local expMask = Util.GetGameObject(_go.transform, "GameObject/item/frameMask/mask")
|
|
|
|
|
if expValue >= 1 then
|
|
|
|
|
expMask:SetActive(true)
|
|
|
|
|
else
|
|
|
|
|
expMask:SetActive(false)
|
|
|
|
|
end
|
|
|
|
|
local propertyName = itemConfig[_itemData.itemConfig.Id].PropertyName
|
|
|
|
|
if (propertyName ~= 0) then
|
|
|
|
|
Util.GetGameObject(_go.transform, "GameObject/item/fragmentIcon"):SetActive(true)
|
2021-04-21 13:12:04 +08:00
|
|
|
|
Util.GetGameObject(_go.transform, "GameObject/item/fragmentIcon"):GetComponent("Image").sprite = this.spLoader:LoadSprite(GetProStrImageByProNum(propertyName))
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
2020-07-06 20:35:39 +08:00
|
|
|
|
elseif _itemData.itemConfig.ItemType == ItemType.TalentItem then
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--天赋材料
|
|
|
|
|
if _itemData.itemConfig.RingLevel > 0 then
|
|
|
|
|
Util.GetGameObject(_go.transform, "GameObject/item/innateImage"):SetActive(true)
|
|
|
|
|
Util.GetGameObject(_go.transform, "GameObject/item/innateImage/Text"):GetComponent("Text").text = "+" .. _itemData.itemConfig.RingLevel
|
|
|
|
|
else
|
|
|
|
|
Util.GetGameObject(_go.transform, "GameObject/item/innateImage"):SetActive(false)
|
|
|
|
|
Util.GetGameObject(_go.transform, "GameObject/item/innateImage/Text"):GetComponent("Text").text = ""
|
|
|
|
|
end
|
2020-07-06 20:35:39 +08:00
|
|
|
|
elseif _itemData.itemConfig.ItemType == ItemType.Talisman then
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--法宝
|
|
|
|
|
talismanStar:SetActive(true)
|
2021-04-21 13:12:04 +08:00
|
|
|
|
SetHeroStars(this.spLoader, talismanStar, _itemData.star,1,Vector2.New(32.5,32.5),-15)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
num:SetActive(false)
|
2020-07-06 20:35:39 +08:00
|
|
|
|
elseif _itemData.itemConfig.ItemType == ItemType.EquipTreasure then
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--宝器
|
2020-05-15 16:52:35 +08:00
|
|
|
|
num:SetActive(false)
|
|
|
|
|
if _itemData.lv>0 then
|
|
|
|
|
strongLv.gameObject:SetActive(true)
|
|
|
|
|
strongLv.text=_itemData.lv
|
|
|
|
|
end
|
|
|
|
|
if _itemData.refineLv>0 then
|
|
|
|
|
refine.gameObject:SetActive(true)
|
|
|
|
|
refine.text="+".._itemData.refineLv
|
|
|
|
|
end
|
2020-06-13 11:47:13 +08:00
|
|
|
|
Util.GetGameObject(_go.transform, "GameObject/item/fragmentIcon"):SetActive(true)
|
2021-04-21 13:12:04 +08:00
|
|
|
|
Util.GetGameObject(_go.transform, "GameObject/item/fragmentIcon"):GetComponent("Image").sprite = this.spLoader:LoadSprite(GetProStrImageByProNum(itemConfig[_itemData.itemConfig.Id].PropertyName))
|
2020-08-02 09:16:45 +08:00
|
|
|
|
elseif _itemData.itemConfig.ItemType == ItemType.HunYin then
|
|
|
|
|
SetSoulEffect(itemConfig[_itemData.itemConfig.Id].Quantity,Util.GetGameObject(_go.transform, "GameObject/effects"))
|
2020-05-09 13:31:21 +08:00
|
|
|
|
Util.GetGameObject(_go.transform, "GameObject/item/resetLv"):SetActive(false)
|
2020-06-23 18:36:24 +08:00
|
|
|
|
Util.GetGameObject(_go.gameObject, "GameObject/item/icon"):SetActive(false)
|
|
|
|
|
Util.GetGameObject(_go.gameObject, "GameObject/item/circleFrameBg"):SetActive(true)
|
2021-04-21 13:12:04 +08:00
|
|
|
|
Util.GetGameObject(_go.gameObject,"GameObject/item/circleFrameBg"):GetComponent("Image").sprite=this.spLoader:LoadSprite(SoulPrintSpriteByQuantity[itemConfig[_itemData.itemConfig.Id].Quantity].circleBg2)
|
|
|
|
|
Util.GetGameObject(_go.gameObject,"GameObject/item/circleFrameBg/Icon"):GetComponent("Image").sprite=this.spLoader:LoadSprite(_itemData.icon)
|
|
|
|
|
Util.GetGameObject(_go.gameObject,"GameObject/item/circleFrameBg/circleFrame"):GetComponent("Image").sprite=this.spLoader:LoadSprite(SoulPrintSpriteByQuantity[itemConfig[_itemData.itemConfig.Id].Quantity].circle)
|
2020-07-10 18:29:38 +08:00
|
|
|
|
num:SetActive(false)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
local redPoint = Util.GetGameObject(_go.gameObject, "GameObject/redPoint")
|
|
|
|
|
Util.AddOnceClick(Util.GetGameObject(_go.gameObject, "GameObject/item/frame"), function()
|
|
|
|
|
if _itemData.itemConfig then
|
|
|
|
|
if _itemData.itemConfig.ItemBaseType == ItemBaseType.Equip then
|
2020-07-06 20:35:39 +08:00
|
|
|
|
UIManager.OpenPanel(UIName.RewardEquipSingleShowPopup, _itemData, function()
|
2021-02-25 12:04:31 +08:00
|
|
|
|
this.OnClickTabBtn(sortIndex, sortIndexBtnGo,false,true)
|
2020-07-28 15:57:36 +08:00
|
|
|
|
end,nil,true)
|
2020-06-13 11:47:13 +08:00
|
|
|
|
elseif _itemData.itemConfig.ItemType == ItemType.SelfBox then--自选宝箱
|
|
|
|
|
UIManager.OpenPanel(UIName.RewardBoxPanel, _itemData, function()
|
2021-02-25 12:04:31 +08:00
|
|
|
|
this.OnClickTabBtn(sortIndex, sortIndexBtnGo,false,true)
|
2020-06-13 11:47:13 +08:00
|
|
|
|
UIManager.ClosePanel(UIName.RewardBoxPanel)
|
|
|
|
|
end)
|
|
|
|
|
-- body
|
2020-05-09 13:31:21 +08:00
|
|
|
|
elseif _itemData.itemConfig.ItemBaseType == ItemBaseType.HeroChip then
|
|
|
|
|
UIManager.OpenPanel(UIName.RewardItemSingleShowPopup, _itemData.id, function()
|
2021-02-25 12:04:31 +08:00
|
|
|
|
this.OnClickTabBtn(sortIndex, sortIndexBtnGo,false,true)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
UIManager.ClosePanel(UIName.RewardItemSingleShowPopup)
|
|
|
|
|
end)
|
|
|
|
|
elseif _itemData.itemConfig.ItemType == ItemType.Blueprint then
|
|
|
|
|
--蓝图
|
|
|
|
|
local lanTuData = WorkShopManager.GetLanTuIsOpenLock(_itemData.itemConfig.Id)
|
|
|
|
|
if lanTuData and lanTuData[1] == true then
|
|
|
|
|
UIManager.OpenPanel(UIName. WorkShopArmorOnePanel, 2, 2, lanTuData[2], this, function()
|
2021-02-25 12:04:31 +08:00
|
|
|
|
this.OnClickTabBtn(sortIndex, sortIndexBtnGo,false,true)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end)
|
|
|
|
|
elseif lanTuData and lanTuData[1] == false then
|
|
|
|
|
UIManager.OpenPanel(UIName.WorkShopArmorOnePanel, 2, 1, lanTuData[2], this, function()
|
2021-02-25 12:04:31 +08:00
|
|
|
|
this.OnClickTabBtn(sortIndex, sortIndexBtnGo,false,true)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
elseif _itemData.itemConfig.ItemType == ItemType.HeroDebris then
|
|
|
|
|
--角色碎片
|
|
|
|
|
if _itemData.num >= _itemData.itemConfig.UsePerCount then
|
|
|
|
|
UIManager.OpenPanel(UIName.BagResolveAnCompoundPanel, 3, _itemData, function()
|
2021-02-25 12:04:31 +08:00
|
|
|
|
this.OnClickTabBtn(sortIndex, sortIndexBtnGo,false,true)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end)
|
|
|
|
|
else
|
|
|
|
|
UIManager.OpenPanel(UIName.RewardItemSingleShowPopup, _itemData.id, function()
|
2021-02-25 12:04:31 +08:00
|
|
|
|
this.OnClickTabBtn(sortIndex, sortIndexBtnGo,false,true)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
UIManager.ClosePanel(UIName.RewardItemSingleShowPopup)
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
elseif _itemData.itemConfig.ItemBaseType == ItemBaseType.EquipTreasure then
|
|
|
|
|
--宝器
|
2020-05-25 19:16:23 +08:00
|
|
|
|
UIManager.OpenPanel(UIName.RewardTalismanSingleShowPopup, 0, _itemData.idDyn,_itemData.id, _itemData.lv,_itemData.refineLv, function()
|
2021-02-25 12:04:31 +08:00
|
|
|
|
this.OnClickTabBtn(sortIndex, sortIndexBtnGo,false,true)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end)
|
|
|
|
|
elseif _itemData.itemConfig.ItemBaseType == ItemBaseType.SoulPrint then
|
|
|
|
|
--魂印
|
|
|
|
|
UIManager.OpenPanel(UIName.SoulPrintPopUp, ShowType.showTip3, nil,_itemData.id)
|
2020-11-03 17:27:32 +08:00
|
|
|
|
elseif _itemData.itemConfig.ItemType == ItemType.Skin then
|
|
|
|
|
--皮肤
|
|
|
|
|
UIManager.OpenPanel(UIName.RewardItemSingleShowPopup, _itemData.id,function()
|
2021-02-25 12:04:31 +08:00
|
|
|
|
this.OnClickTabBtn(sortIndex, sortIndexBtnGo,false,true)
|
2020-11-03 17:27:32 +08:00
|
|
|
|
UIManager.ClosePanel(UIName.RewardItemSingleShowPopup)
|
|
|
|
|
end)
|
2021-01-15 21:06:48 +08:00
|
|
|
|
-- elseif _itemData.itemConfig.ItemType == ItemType.HeadFrame then
|
|
|
|
|
-- --
|
|
|
|
|
-- UIManager.OpenPanel(UIName.RewardItemSingleShowPopup, _itemData.id,function()
|
|
|
|
|
-- this.OnClickTabBtn(sortIndex, sortIndexBtnGo)
|
|
|
|
|
-- UIManager.ClosePanel(UIName.RewardItemSingleShowPopup)
|
|
|
|
|
-- end)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
else
|
|
|
|
|
UIManager.OpenPanel(UIName.RewardItemSingleShowPopup, _itemData.id, function()
|
2021-02-25 12:04:31 +08:00
|
|
|
|
this.OnClickTabBtn(sortIndex, sortIndexBtnGo,false,true)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
UIManager.ClosePanel(UIName.RewardItemSingleShowPopup)
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
--显示红点
|
|
|
|
|
redPoint:SetActive(false)
|
|
|
|
|
if _itemData.itemConfig.ItemType == ItemType.Equip then
|
|
|
|
|
if _itemData.itemConfig.Quantity >= 4 then
|
|
|
|
|
redPoint:SetActive(EquipManager.IsNewEquipFrame(_itemData.did))
|
|
|
|
|
end
|
|
|
|
|
elseif _itemData.itemConfig.ItemType == ItemType.Blueprint then
|
|
|
|
|
local lanTuData = WorkShopManager.GetLanTuIsOpenLock(_itemData.itemConfig.Id)
|
|
|
|
|
if lanTuData and lanTuData[1] == false then
|
|
|
|
|
redPoint:SetActive(true)
|
|
|
|
|
end
|
|
|
|
|
elseif _itemData.itemConfig.ItemType == ItemType.Box then
|
|
|
|
|
redPoint:SetActive(true)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--通过物品类型获取物品数据
|
|
|
|
|
function this:GetItemsByItemTpye(_itemType)
|
|
|
|
|
local items = {}
|
|
|
|
|
local index = 1
|
|
|
|
|
for i, v in pairs(BagManager.bagDatas) do
|
|
|
|
|
if v.type == _itemType then
|
|
|
|
|
items[index] = v
|
|
|
|
|
index = index + 1
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return items
|
|
|
|
|
end
|
|
|
|
|
--添加事件监听(用于子类重写)
|
|
|
|
|
function BagPanel:AddListener()
|
|
|
|
|
|
2020-06-13 11:47:13 +08:00
|
|
|
|
Game.GlobalEvent:AddEvent(GameEvent.Bag.OnTempBagChanged, this.BagGoldChangeCallBackOnClickTabBtn)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
Game.GlobalEvent:AddEvent(GameEvent.Bag.BagGold, this.BagGoldChangeCallBackOnClickTabBtn)
|
|
|
|
|
Game.GlobalEvent:AddEvent(GameEvent.Bag.OnRefreshSoulPanelData, this.OnRefreshSoulPanelBagData)
|
2021-03-30 17:17:11 +08:00
|
|
|
|
Game.GlobalEvent:AddEvent(GameEvent.Bag.OnBagShowWarPowerChange, this.ShowWarPowerChange)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--移除事件监听(用于子类重写)
|
|
|
|
|
function BagPanel:RemoveListener()
|
|
|
|
|
|
2020-06-13 11:47:13 +08:00
|
|
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.Bag.OnTempBagChanged, this.BagGoldChangeCallBackOnClickTabBtn)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.Bag.BagGold, this.BagGoldChangeCallBackOnClickTabBtn)
|
2020-06-13 11:47:13 +08:00
|
|
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.Bag.OnRefreshSoulPanelData, this.OnRefreshSoulPanelBagData)
|
2021-03-30 17:17:11 +08:00
|
|
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.Bag.OnBagShowWarPowerChange, this.ShowWarPowerChange)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
--界面打开时调用(用于子类重写)
|
|
|
|
|
function BagPanel:OnOpen(_sortIndex)
|
|
|
|
|
|
2020-12-28 16:26:38 +08:00
|
|
|
|
sortIndex = 1--注释掉就是记录选择类型
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if _sortIndex then
|
|
|
|
|
sortIndex = _sortIndex
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
this.UpView:OnOpen({ showType = UpViewOpenType.ShowRight, panelType = PanelType.Main })
|
2021-04-22 13:40:04 +08:00
|
|
|
|
this.BtView:OnOpen(self, { sortOrder = self.sortingOrder, panelType = PanelTypeView.BagPanel })
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
--界面打开时调用(用于子类重写)
|
|
|
|
|
function BagPanel:OnShow()
|
|
|
|
|
this.sortingOrder = self.sortingOrder
|
|
|
|
|
this.isFristOpen = true
|
|
|
|
|
this.mask:SetActive(true)
|
|
|
|
|
if this.ScrollView then
|
|
|
|
|
this.ScrollView:SetIndex(1)
|
|
|
|
|
end
|
|
|
|
|
if sortIndex > 0 then
|
2020-12-30 19:51:14 +08:00
|
|
|
|
this.OnClickTabBtn(sortIndex, tabs1[sortIndex], true)
|
2020-12-28 16:26:38 +08:00
|
|
|
|
-- else
|
|
|
|
|
-- this:OnClickAllBtn()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
SoundManager.PlayMusic(SoundConfig.BGM_Main)
|
|
|
|
|
BagManager.isBagPanel = true
|
|
|
|
|
|
2020-09-02 18:33:17 +08:00
|
|
|
|
this.SetBottomBarIsActive()
|
2021-03-30 20:46:47 +08:00
|
|
|
|
-- 刷新一次编队战斗力
|
|
|
|
|
FormationManager.RefreshMainFormationPower()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
2020-09-02 18:33:17 +08:00
|
|
|
|
--特殊的开启条件
|
|
|
|
|
function this.SetBottomBarIsActive()
|
|
|
|
|
local ConfigData = ConfigManager.GetConfig(ConfigName.SpecialConfig)
|
|
|
|
|
for i = 1, #tabs1 do
|
|
|
|
|
--为宝物定开启规则
|
|
|
|
|
if i == 5 then
|
|
|
|
|
local string = ConfigData[40].Value
|
|
|
|
|
local num = string.split(string.split(string,"|")[1],"#")[2]
|
|
|
|
|
tabs1[i]:SetActive(PlayerManager.level >= tonumber(num))
|
|
|
|
|
end
|
|
|
|
|
--为魂印定开启规则
|
|
|
|
|
if i == 6 then
|
|
|
|
|
local string = ConfigData[37].Value
|
|
|
|
|
local num = string.split(string,"#")[1]
|
|
|
|
|
tabs1[i]:SetActive(PlayerManager.level >= tonumber(num))
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
2020-07-01 10:54:39 +08:00
|
|
|
|
local orginLayer
|
2020-05-09 13:31:21 +08:00
|
|
|
|
function BagPanel:OnSortingOrderChange()
|
|
|
|
|
Util.AddParticleSortLayer(this.ItemViewEffect, self.sortingOrder - this.EffectOrginLayer)
|
|
|
|
|
|
2020-07-01 10:54:39 +08:00
|
|
|
|
--特效层级重设
|
|
|
|
|
for i=1,#list do
|
|
|
|
|
Util.AddParticleSortLayer(list[i], this.sortingOrder- orginLayer)
|
|
|
|
|
end
|
|
|
|
|
orginLayer = this.sortingOrder
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.EffectOrginLayer = self.sortingOrder
|
2020-06-08 13:57:30 +08:00
|
|
|
|
this.BtView:SetOrderStatus({ sortOrder = self.sortingOrder })
|
2021-03-30 18:42:30 +08:00
|
|
|
|
|
|
|
|
|
if this.playerInfoView then
|
|
|
|
|
this.playerInfoView:SetLayer(self.sortingOrder)
|
2020-09-25 21:19:01 +08:00
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
--界面关闭时调用(用于子类重写)
|
|
|
|
|
function BagPanel:OnClose()
|
|
|
|
|
|
|
|
|
|
this.noneImage:SetActive(false)
|
|
|
|
|
BagManager.isBagPanel = false
|
|
|
|
|
if isFristOpenTime then
|
|
|
|
|
isFristOpenTime:Stop()
|
|
|
|
|
isFristOpenTime = nil
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
function this.DelePokemonItemData(_itemDatas)
|
|
|
|
|
local curItemDatas = {}
|
|
|
|
|
--背包特殊处理 sortType=1 sortIndex=5 时显示妖魂 其他页签不显示
|
|
|
|
|
for k, v in pairs(_itemDatas) do
|
|
|
|
|
if sortIndex == ItemBaseType.DemonSoul then
|
|
|
|
|
else
|
|
|
|
|
if v.itemConfig.ItemType == ItemType.Pokemon then
|
|
|
|
|
_itemDatas[k] = nil
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
for k, v in pairs(_itemDatas) do
|
|
|
|
|
table.insert(curItemDatas, v)
|
|
|
|
|
end
|
|
|
|
|
return curItemDatas
|
|
|
|
|
end
|
2020-12-28 16:26:38 +08:00
|
|
|
|
|
|
|
|
|
function this.ItemsSortDataV2(_itemDatas)
|
|
|
|
|
table.sort(_itemDatas, function(a, b)
|
|
|
|
|
if a.itemConfig.Sort == b.itemConfig.Sort then
|
2020-12-29 10:33:45 +08:00
|
|
|
|
return a.itemConfig.Id > b.itemConfig.Id
|
2020-12-28 16:26:38 +08:00
|
|
|
|
else
|
2020-12-29 10:33:45 +08:00
|
|
|
|
return a.itemConfig.Sort > b.itemConfig.Sort
|
2020-12-28 16:26:38 +08:00
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
--弃用
|
2020-05-09 13:31:21 +08:00
|
|
|
|
function this.ItemsSortData(_itemDatas)
|
|
|
|
|
--排序
|
|
|
|
|
table.sort(_itemDatas, function(a, b)
|
|
|
|
|
if sortIndex == 0 then
|
|
|
|
|
--0全部 1装备 2材料 3消耗 4特殊 5碎片
|
|
|
|
|
if a.itemConfig.ItemBaseType == b.itemConfig.ItemBaseType then
|
|
|
|
|
if a.itemConfig.ItemType == a.itemConfig.ItemType then
|
|
|
|
|
if a.itemConfig.ItemType == ItemType.Talisman and b.itemConfig.ItemType == ItemType.Talisman then
|
2020-07-28 23:40:36 +08:00
|
|
|
|
if a.itemConfig.Quantity == b.itemConfig.Quantity then
|
|
|
|
|
if a.star == b.star then
|
|
|
|
|
return a.id < b.id
|
|
|
|
|
else
|
|
|
|
|
return a.star > b.star
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
else
|
2020-07-28 23:40:36 +08:00
|
|
|
|
return a.itemConfig.Quantity > b.itemConfig.Quantity
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if a.itemConfig.ItemType == ItemType.HunYin and b.itemConfig.ItemType == ItemType.HunYin then
|
2020-07-28 23:40:36 +08:00
|
|
|
|
if a.itemConfig.Quantity == b.itemConfig.Quantity then
|
|
|
|
|
if a.quality == b.quality then
|
|
|
|
|
return a.id > b.id
|
|
|
|
|
else
|
|
|
|
|
return a.quality > b.quality
|
|
|
|
|
end
|
2020-06-30 18:59:44 +08:00
|
|
|
|
else
|
2020-07-28 23:40:36 +08:00
|
|
|
|
return a.itemConfig.Quantity > b.itemConfig.Quantity
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if a.itemConfig.ItemType == ItemType.EquipTreasure and b.itemConfig.ItemType == ItemType.EquipTreasure then
|
2020-07-28 23:40:36 +08:00
|
|
|
|
if a.itemConfig.Quantity == b.itemConfig.Quantity then
|
|
|
|
|
if a.refineLv == b.refineLv then
|
|
|
|
|
if a.lv == b.lv then
|
|
|
|
|
return a.id > b.id
|
|
|
|
|
else
|
|
|
|
|
return a.lv > b.lv
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
else
|
2020-07-28 23:40:36 +08:00
|
|
|
|
return a.refineLv > b.refineLv
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
else
|
2020-07-28 23:40:36 +08:00
|
|
|
|
return a.itemConfig.Quantity > b.itemConfig.Quantity
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-09-04 17:21:16 +08:00
|
|
|
|
if a.itemConfig.ItemType == ItemType.Equip and b.itemConfig.ItemType == ItemType.Equip then
|
|
|
|
|
if a.itemConfig.Quantity == b.itemConfig.Quantity then
|
|
|
|
|
return a.id > b.id
|
|
|
|
|
else
|
|
|
|
|
return a.itemConfig.Quantity > b.itemConfig.Quantity
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-07-28 23:40:36 +08:00
|
|
|
|
if a.itemConfig.ItemType == ItemType.HeroDebris and b.itemConfig.ItemType == ItemType.HeroDebris then
|
|
|
|
|
local aNum = BagManager.GetItemCountById(a.itemConfig.Id) >= a.itemConfig.UsePerCount and 2 or 1
|
|
|
|
|
local bNum = BagManager.GetItemCountById(b.itemConfig.Id) >= b.itemConfig.UsePerCount and 2 or 1
|
|
|
|
|
if aNum == bNum then
|
|
|
|
|
if a.itemConfig.Quantity == b.itemConfig.Quantity then
|
|
|
|
|
if a.itemConfig.PropertyName == b.itemConfig.PropertyName then
|
|
|
|
|
return a.id < b.id
|
|
|
|
|
else
|
|
|
|
|
return a.itemConfig.PropertyName < b.itemConfig.PropertyName
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
return a.itemConfig.Quantity > b.itemConfig.Quantity
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
return aNum > bNum
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
return a.itemConfig.ItemType < b.itemConfig.ItemType
|
|
|
|
|
end
|
2020-07-28 23:40:36 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
else
|
|
|
|
|
return a.itemConfig.ItemBaseType < b.itemConfig.ItemBaseType
|
|
|
|
|
end
|
2020-07-28 23:40:36 +08:00
|
|
|
|
elseif sortIndex == ItemBaseType.Equip or sortIndex == ItemBaseType.Materials or sortIndex == ItemBaseType.Special then
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if a.itemConfig.Quantity == b.itemConfig.Quantity then
|
|
|
|
|
if a.itemConfig.ItemType == b.itemConfig.ItemType then
|
|
|
|
|
return a.id > b.id
|
|
|
|
|
else
|
|
|
|
|
return a.itemConfig.ItemType < b.itemConfig.ItemType
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
return a.itemConfig.Quantity > b.itemConfig.Quantity
|
|
|
|
|
end
|
2020-07-28 23:40:36 +08:00
|
|
|
|
elseif sortIndex == ItemBaseType.HeroChip then
|
|
|
|
|
local aNum = BagManager.GetItemCountById(a.itemConfig.Id) >= a.itemConfig.UsePerCount and 2 or 1
|
|
|
|
|
local bNum = BagManager.GetItemCountById(b.itemConfig.Id) >= b.itemConfig.UsePerCount and 2 or 1
|
|
|
|
|
if aNum == bNum then
|
|
|
|
|
if a.itemConfig.Quantity == b.itemConfig.Quantity then
|
|
|
|
|
if a.itemConfig.PropertyName == b.itemConfig.PropertyName then
|
|
|
|
|
return a.id < b.id
|
|
|
|
|
else
|
|
|
|
|
return a.itemConfig.PropertyName < b.itemConfig.PropertyName
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
return a.itemConfig.Quantity > b.itemConfig.Quantity
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
return aNum > bNum
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
elseif sortIndex == ItemBaseType.DemonSoul then
|
|
|
|
|
local aNum = BagManager.GetItemCountById(a.itemConfig.Id) >= a.itemConfig.UsePerCount and 2 or 1
|
|
|
|
|
local bNum = BagManager.GetItemCountById(b.itemConfig.Id) >= b.itemConfig.UsePerCount and 2 or 1
|
|
|
|
|
if aNum == bNum then
|
|
|
|
|
if a.itemConfig.Quantity == b.itemConfig.Quantity then
|
|
|
|
|
if a.itemConfig.ItemType == b.itemConfig.ItemType then
|
|
|
|
|
return a.id > b.id
|
|
|
|
|
else
|
|
|
|
|
return a.itemConfig.ItemType < b.itemConfig.ItemType
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
return a.itemConfig.Quantity > b.itemConfig.Quantity
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
return aNum > bNum
|
|
|
|
|
end
|
|
|
|
|
elseif sortIndex == ItemBaseType.SoulPrint then
|
2020-06-30 18:59:44 +08:00
|
|
|
|
if a.quality == b.quality then
|
|
|
|
|
return a.id > b.id
|
2020-05-09 13:31:21 +08:00
|
|
|
|
else
|
2020-06-30 18:59:44 +08:00
|
|
|
|
return a.quality > b.quality
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
elseif sortIndex == ItemBaseType.EquipTreasure then
|
|
|
|
|
if a.itemConfig.Quantity == b.itemConfig.Quantity then
|
|
|
|
|
if a.refineLv == b.refineLv then
|
|
|
|
|
if a.lv == b.lv then
|
|
|
|
|
return a.id > b.id
|
|
|
|
|
else
|
|
|
|
|
return a.lv > b.lv
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
return a.refineLv > b.refineLv
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
return a.itemConfig.Quantity > b.itemConfig.Quantity
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--获取所有背包物品
|
|
|
|
|
function this.GetBagItemData()
|
|
|
|
|
local _index = 1
|
|
|
|
|
local _bagItemData = {}
|
|
|
|
|
for i, v in pairs(BagManager.bagDatas) do
|
2020-07-01 10:54:39 +08:00
|
|
|
|
if v.isBag and v.num > 0 and v.itemConfig.ItemType ~= ItemType.Pokemon and v.itemConfig.ItemType ~= ItemType.HunYin then
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--进背包 数量大于零的 不是异妖部件
|
|
|
|
|
_bagItemData[_index] = v
|
|
|
|
|
_index = _index + 1
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return _bagItemData
|
|
|
|
|
end
|
|
|
|
|
--界面销毁时调用(用于子类重写)
|
|
|
|
|
function BagPanel:OnDestroy()
|
2021-04-21 13:12:04 +08:00
|
|
|
|
this.spLoader:Destroy()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
|
|
|
|
SubUIManager.Close(this.UpView)
|
|
|
|
|
SubUIManager.Close(this.BtView)
|
|
|
|
|
this.ScrollView = nil
|
|
|
|
|
this.ScrollView1 = nil
|
|
|
|
|
ClearRedPointObject(RedPointType.Bag_HeroDebris, tabs1RedPoint[ItemBaseType.HeroChip])
|
|
|
|
|
ClearRedPointObject(RedPointType.Bag_BoxAndBlueprint, tabs1RedPoint[ItemBaseType.Special])
|
|
|
|
|
ClearRedPointObject(RedPointType.Setting, this.headRedpot)
|
|
|
|
|
ClearRedPointObject(RedPointType.VipPrivilege, this.vipRedPoint)
|
2020-07-01 10:54:39 +08:00
|
|
|
|
list={}
|
|
|
|
|
orginLayer2=0
|
|
|
|
|
orginLayer=0
|
2021-03-30 18:42:30 +08:00
|
|
|
|
|
|
|
|
|
if this.playerInfoView then
|
|
|
|
|
SubUIManager.Close(this.playerInfoView)
|
|
|
|
|
this.playerInfoView = nil
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--跳转显示新手提示圈
|
|
|
|
|
function this.ShowGuideGo()
|
|
|
|
|
local item1Btn = Util.GetGameObject(this.transform, "scroll/ScrollCycleView/grid/item1")
|
|
|
|
|
if item1Btn then
|
|
|
|
|
JumpManager.ShowGuide(UIName.BagPanel, item1Btn)
|
|
|
|
|
end
|
|
|
|
|
end
|
2021-04-12 16:23:57 +08:00
|
|
|
|
function this.ShowWarPowerChange(powernum,type)
|
2021-03-30 17:17:11 +08:00
|
|
|
|
Timer.New(function()
|
2021-04-12 16:23:57 +08:00
|
|
|
|
local str=nil
|
|
|
|
|
if type==PowerChangeJumpType.ride then
|
|
|
|
|
str=Language[12236]
|
|
|
|
|
elseif type== PowerChangeJumpType.title then
|
|
|
|
|
str="是否前往称号界面?"
|
|
|
|
|
end
|
|
|
|
|
MsgPanel.ShowTwo(str,nil,function()
|
|
|
|
|
UIManager.OpenPanel(UIName.SettingPanel,type)
|
2021-03-30 17:17:11 +08:00
|
|
|
|
end)
|
|
|
|
|
end, 1):Start()
|
|
|
|
|
end
|
2021-04-21 13:12:04 +08:00
|
|
|
|
return BagPanel
|
|
|
|
|
|