【商店】修复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 ShopView = {}
|
||||||
local this = ShopView
|
local this = ShopView
|
||||||
this.sortingOrder = 0
|
this.sortingOrder = 0
|
||||||
-- 保存商品中的物品节点
|
local isPlayShow = true
|
||||||
local _GoodsItemList = {}
|
|
||||||
---===============================生命周期函数================================
|
---===============================生命周期函数================================
|
||||||
function this:New(gameObject)
|
function this:New(gameObject)
|
||||||
local o = {}
|
local o = {}
|
||||||
|
@ -80,6 +79,8 @@ end
|
||||||
function this:BindEvent()
|
function this:BindEvent()
|
||||||
local localSelf = self
|
local localSelf = self
|
||||||
Util.AddOnceClick(self.refreshBtn, function()
|
Util.AddOnceClick(self.refreshBtn, function()
|
||||||
|
PlaySoundWithoutClick("UI_refresh")
|
||||||
|
isPlayShow = true
|
||||||
local isPopUp = RedPointManager.PlayerPrefsGetStr(PlayerManager.uid .. localSelf.ShopType)
|
local isPopUp = RedPointManager.PlayerPrefsGetStr(PlayerManager.uid .. localSelf.ShopType)
|
||||||
local currentTime = os.date("%Y%m%d", PlayerManager.serverTime)
|
local currentTime = os.date("%Y%m%d", PlayerManager.serverTime)
|
||||||
local shopType = localSelf.ShopType
|
local shopType = localSelf.ShopType
|
||||||
|
@ -136,12 +137,14 @@ function this:OnClose()
|
||||||
|
|
||||||
|
|
||||||
-- 物品节点回收
|
-- 物品节点回收
|
||||||
for _, item in pairs(_GoodsItemList) do
|
if self._GoodsItemList then
|
||||||
|
for _, item in pairs(self._GoodsItemList) do
|
||||||
Util.SetColor(item.gameObject, Color.New(1,1,1,1))
|
Util.SetColor(item.gameObject, Color.New(1,1,1,1))
|
||||||
Util.SetGray(item.gameObject, false)
|
Util.SetGray(item.gameObject, false)
|
||||||
SubUIManager.Close(item)
|
SubUIManager.Close(item)
|
||||||
end
|
end
|
||||||
_GoodsItemList = {}
|
self._GoodsItemList = {}
|
||||||
|
end
|
||||||
|
|
||||||
-- 红点销毁
|
-- 红点销毁
|
||||||
-- if self.ShopType == SHOP_TYPE.GENERAL_SHOP then
|
-- if self.ShopType == SHOP_TYPE.GENERAL_SHOP then
|
||||||
|
@ -189,11 +192,13 @@ function this:RefreshShopInfo(isRefresh, isTop)
|
||||||
|
|
||||||
if isRefresh then
|
if isRefresh then
|
||||||
-- 物品节点播放特效
|
-- 物品节点播放特效
|
||||||
for _, item in pairs(_GoodsItemList) do
|
if self._GoodsItemList then
|
||||||
|
for _, item in pairs(self._GoodsItemList) do
|
||||||
item:OnShowUIeffectItemViewSaoguang()
|
item:OnShowUIeffectItemViewSaoguang()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- 刷新立绘显示
|
-- 刷新立绘显示
|
||||||
function this:RefreshLive()
|
function this:RefreshLive()
|
||||||
|
@ -382,17 +387,17 @@ function this:RefreshItemList(isTop)
|
||||||
self.RechargeScrollView:SetData(itemlist, function(index, shopItem)
|
self.RechargeScrollView:SetData(itemlist, function(index, shopItem)
|
||||||
local itemData = itemlist[index]
|
local itemData = itemlist[index]
|
||||||
self:RechargeShopItemAdapter(shopItem, itemData)
|
self:RechargeShopItemAdapter(shopItem, itemData)
|
||||||
|
if isPlayShow then
|
||||||
|
shopItem.gameObject:SetActive(false)
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
if isTop then
|
if isTop then
|
||||||
self.RechargeScrollView:SetIndex(1)
|
self.RechargeScrollView:SetIndex(1)
|
||||||
end
|
end
|
||||||
self.RechargeScrollView:ForeachItemGO(function (index, go)
|
if isPlayShow then
|
||||||
Timer.New(function ()
|
SecTorPlayAnimByScroll(self.RechargeScrollView,0.03)
|
||||||
go.gameObject:SetActive(true)
|
isPlayShow = false
|
||||||
PlayUIAnim(go.gameObject)
|
end
|
||||||
end, 0.03*(index-1)):Start()
|
|
||||||
end)
|
|
||||||
|
|
||||||
else
|
else
|
||||||
-- 重置列表
|
-- 重置列表
|
||||||
self.RechargeScrollView.gameObject:SetActive(false)
|
self.RechargeScrollView.gameObject:SetActive(false)
|
||||||
|
@ -401,17 +406,17 @@ function this:RefreshItemList(isTop)
|
||||||
self.ScrollView:SetData(itemlist, function(index, shopItem)
|
self.ScrollView:SetData(itemlist, function(index, shopItem)
|
||||||
local itemData = itemlist[index]
|
local itemData = itemlist[index]
|
||||||
self:ShopItemAdapter(shopItem, itemData)
|
self:ShopItemAdapter(shopItem, itemData)
|
||||||
|
if isPlayShow then
|
||||||
|
shopItem.gameObject:SetActive(false)
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
if isTop then
|
if isTop then
|
||||||
self.ScrollView:SetIndex(1)
|
self.ScrollView:SetIndex(1)
|
||||||
end
|
end
|
||||||
self.ScrollView:ForeachItemGO(function (index, go)
|
if isPlayShow then
|
||||||
Timer.New(function ()
|
SecTorPlayAnimByScroll(self.ScrollView,0.03)
|
||||||
go.gameObject:SetActive(true)
|
isPlayShow = false
|
||||||
PlayUIAnim(go.gameObject)
|
end
|
||||||
end, 0.03*(index-1)):Start()
|
|
||||||
end)
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -481,14 +486,17 @@ function this:ShopItemAdapter(shopItem, itemData)
|
||||||
empty:SetActive(isEmpty)
|
empty:SetActive(isEmpty)
|
||||||
|
|
||||||
-- 数据匹配
|
-- 数据匹配
|
||||||
if not _GoodsItemList[shopItem] then
|
if not self._GoodsItemList then
|
||||||
_GoodsItemList[shopItem] = SubUIManager.Open(SubUIConfig.ItemView, item.transform)
|
self._GoodsItemList = {}
|
||||||
end
|
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 -- 物品空或者未解锁不现实物品特效
|
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
|
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
|
end
|
||||||
|
|
||||||
-- 商品颜色显示
|
-- 商品颜色显示
|
||||||
|
@ -547,6 +555,8 @@ function this:RechargeShopItemAdapter(shopItem, itemData)
|
||||||
self:RechargeSuccessFunc(itemData.goodsId)
|
self:RechargeSuccessFunc(itemData.goodsId)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 充值成功回调
|
-- 充值成功回调
|
||||||
|
@ -579,6 +589,7 @@ function this:ShowShop(shopType,_sortingOrder)
|
||||||
|
|
||||||
-- 刷新显示
|
-- 刷新显示
|
||||||
self.ShopType = shopType
|
self.ShopType = shopType
|
||||||
|
isPlayShow = true
|
||||||
self.ShopId = ShopManager.GetShopDataByType(self.ShopType).id
|
self.ShopId = ShopManager.GetShopDataByType(self.ShopType).id
|
||||||
self.ShopConfig = _ShopTypeConfig[self.ShopId]
|
self.ShopConfig = _ShopTypeConfig[self.ShopId]
|
||||||
-- 显示帮助按钮
|
-- 显示帮助按钮
|
||||||
|
@ -624,8 +635,8 @@ end
|
||||||
-- 设置层级
|
-- 设置层级
|
||||||
function this:SetSortLayer(sortLayer)
|
function this:SetSortLayer(sortLayer)
|
||||||
--
|
--
|
||||||
Log("sortLayer _GoodsItemList "..sortLayer.." "..LengthOfTable(_GoodsItemList))
|
Log("sortLayer _GoodsItemList "..sortLayer.." "..LengthOfTable(self._GoodsItemList))
|
||||||
for _, item in pairs(_GoodsItemList) do
|
for _, item in pairs(self._GoodsItemList) do
|
||||||
item:SetEffectLayer(sortLayer)--this.sortingOrder)
|
item:SetEffectLayer(sortLayer)--this.sortingOrder)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue