【商店】修复ShopView销毁时会导致其他shopview物品回收的问题(修复商店偶现物品消失的问题)
parent
4b522dd9ea
commit
9add8d8dbf
|
@ -0,0 +1,88 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0becfb702d9034b42a066aa225fdeb27
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
serializedVersion: 9
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 2
|
||||
aniso: -1
|
||||
mipBias: -100
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 2
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: c9e50b79681466840af4ae85b937b4d3
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
spritePackingTag: TagAtlas
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -4,8 +4,7 @@ local _ShopTypeConfig = ConfigManager.GetConfig(ConfigName.StoreTypeConfig)
|
|||
local ShopView = {}
|
||||
local this = ShopView
|
||||
this.sortingOrder = 0
|
||||
-- 保存商品中的物品节点
|
||||
local _GoodsItemList = {}
|
||||
local isPlayShow = true
|
||||
---===============================生命周期函数================================
|
||||
function this:New(gameObject)
|
||||
local o = {}
|
||||
|
@ -80,6 +79,8 @@ end
|
|||
function this:BindEvent()
|
||||
local localSelf = self
|
||||
Util.AddOnceClick(self.refreshBtn, function()
|
||||
PlaySoundWithoutClick("UI_refresh")
|
||||
isPlayShow = true
|
||||
local isPopUp = RedPointManager.PlayerPrefsGetStr(PlayerManager.uid .. localSelf.ShopType)
|
||||
local currentTime = os.date("%Y%m%d", PlayerManager.serverTime)
|
||||
local shopType = localSelf.ShopType
|
||||
|
@ -136,12 +137,14 @@ function this:OnClose()
|
|||
|
||||
|
||||
-- 物品节点回收
|
||||
for _, item in pairs(_GoodsItemList) do
|
||||
Util.SetColor(item.gameObject, Color.New(1,1,1,1))
|
||||
Util.SetGray(item.gameObject, false)
|
||||
SubUIManager.Close(item)
|
||||
if self._GoodsItemList then
|
||||
for _, item in pairs(self._GoodsItemList) do
|
||||
Util.SetColor(item.gameObject, Color.New(1,1,1,1))
|
||||
Util.SetGray(item.gameObject, false)
|
||||
SubUIManager.Close(item)
|
||||
end
|
||||
self._GoodsItemList = {}
|
||||
end
|
||||
_GoodsItemList = {}
|
||||
|
||||
-- 红点销毁
|
||||
-- if self.ShopType == SHOP_TYPE.GENERAL_SHOP then
|
||||
|
@ -189,8 +192,10 @@ function this:RefreshShopInfo(isRefresh, isTop)
|
|||
|
||||
if isRefresh then
|
||||
-- 物品节点播放特效
|
||||
for _, item in pairs(_GoodsItemList) do
|
||||
item:OnShowUIeffectItemViewSaoguang()
|
||||
if self._GoodsItemList then
|
||||
for _, item in pairs(self._GoodsItemList) do
|
||||
item:OnShowUIeffectItemViewSaoguang()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -382,17 +387,17 @@ function this:RefreshItemList(isTop)
|
|||
self.RechargeScrollView:SetData(itemlist, function(index, shopItem)
|
||||
local itemData = itemlist[index]
|
||||
self:RechargeShopItemAdapter(shopItem, itemData)
|
||||
if isPlayShow then
|
||||
shopItem.gameObject:SetActive(false)
|
||||
end
|
||||
end)
|
||||
if isTop then
|
||||
self.RechargeScrollView:SetIndex(1)
|
||||
end
|
||||
self.RechargeScrollView:ForeachItemGO(function (index, go)
|
||||
Timer.New(function ()
|
||||
go.gameObject:SetActive(true)
|
||||
PlayUIAnim(go.gameObject)
|
||||
end, 0.03*(index-1)):Start()
|
||||
end)
|
||||
|
||||
if isPlayShow then
|
||||
SecTorPlayAnimByScroll(self.RechargeScrollView,0.03)
|
||||
isPlayShow = false
|
||||
end
|
||||
else
|
||||
-- 重置列表
|
||||
self.RechargeScrollView.gameObject:SetActive(false)
|
||||
|
@ -401,17 +406,17 @@ function this:RefreshItemList(isTop)
|
|||
self.ScrollView:SetData(itemlist, function(index, shopItem)
|
||||
local itemData = itemlist[index]
|
||||
self:ShopItemAdapter(shopItem, itemData)
|
||||
if isPlayShow then
|
||||
shopItem.gameObject:SetActive(false)
|
||||
end
|
||||
end)
|
||||
if isTop then
|
||||
self.ScrollView:SetIndex(1)
|
||||
end
|
||||
self.ScrollView:ForeachItemGO(function (index, go)
|
||||
Timer.New(function ()
|
||||
go.gameObject:SetActive(true)
|
||||
PlayUIAnim(go.gameObject)
|
||||
end, 0.03*(index-1)):Start()
|
||||
end)
|
||||
|
||||
if isPlayShow then
|
||||
SecTorPlayAnimByScroll(self.ScrollView,0.03)
|
||||
isPlayShow = false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -481,14 +486,17 @@ function this:ShopItemAdapter(shopItem, itemData)
|
|||
empty:SetActive(isEmpty)
|
||||
|
||||
-- 数据匹配
|
||||
if not _GoodsItemList[shopItem] then
|
||||
_GoodsItemList[shopItem] = SubUIManager.Open(SubUIConfig.ItemView, item.transform)
|
||||
if not self._GoodsItemList then
|
||||
self._GoodsItemList = {}
|
||||
end
|
||||
Util.SetGray(_GoodsItemList[shopItem].gameObject, not _IsUnLock)
|
||||
if not self._GoodsItemList[shopItem] then
|
||||
self._GoodsItemList[shopItem] = SubUIManager.Open(SubUIConfig.ItemView, item.transform)
|
||||
end
|
||||
Util.SetGray(self._GoodsItemList[shopItem].gameObject, not _IsUnLock)
|
||||
if isEmpty or not _IsUnLock then -- 物品空或者未解锁不现实物品特效
|
||||
_GoodsItemList[shopItem]:OnOpen(false, goods[1],1,false,false,false)
|
||||
self._GoodsItemList[shopItem]:OnOpen(false, goods[1],1,false,false,false)
|
||||
else
|
||||
_GoodsItemList[shopItem]:OnOpen(false, goods[1],1,false,false,false,this.sortingOrder)
|
||||
self._GoodsItemList[shopItem]:OnOpen(false, goods[1],1,false,false,false,this.sortingOrder)
|
||||
end
|
||||
|
||||
-- 商品颜色显示
|
||||
|
@ -547,6 +555,8 @@ function this:RechargeShopItemAdapter(shopItem, itemData)
|
|||
self:RechargeSuccessFunc(itemData.goodsId)
|
||||
end)
|
||||
end)
|
||||
|
||||
|
||||
end
|
||||
|
||||
-- 充值成功回调
|
||||
|
@ -579,6 +589,7 @@ function this:ShowShop(shopType,_sortingOrder)
|
|||
|
||||
-- 刷新显示
|
||||
self.ShopType = shopType
|
||||
isPlayShow = true
|
||||
self.ShopId = ShopManager.GetShopDataByType(self.ShopType).id
|
||||
self.ShopConfig = _ShopTypeConfig[self.ShopId]
|
||||
-- 显示帮助按钮
|
||||
|
@ -624,8 +635,8 @@ end
|
|||
-- 设置层级
|
||||
function this:SetSortLayer(sortLayer)
|
||||
--
|
||||
Log("sortLayer _GoodsItemList "..sortLayer.." "..LengthOfTable(_GoodsItemList))
|
||||
for _, item in pairs(_GoodsItemList) do
|
||||
Log("sortLayer _GoodsItemList "..sortLayer.." "..LengthOfTable(self._GoodsItemList))
|
||||
for _, item in pairs(self._GoodsItemList) do
|
||||
item:SetEffectLayer(sortLayer)--this.sortingOrder)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue