商店报错添加容错
parent
39254af42e
commit
b1c5113c39
|
@ -37,7 +37,6 @@ end
|
|||
--绑定事件(用于子类重写)
|
||||
function ArenaTrialPanel:BindEvent()
|
||||
Util.AddClick(self.btnBack, function()
|
||||
LogError("self.btnBack....")
|
||||
self:ClosePanel()
|
||||
end)
|
||||
|
||||
|
|
|
@ -390,46 +390,50 @@ function this.SortItemList(shopType)
|
|||
-- 排序
|
||||
local shopData = nil
|
||||
for _, v in ipairs(this.allShopData) do
|
||||
local storeInfo = ConfigManager.GetConfigData(ConfigName.StoreTypeConfig, v.id)
|
||||
-- shopType不存在时全部刷新,否则按shoptype刷新
|
||||
if not shopType or storeInfo.StoreType == shopType then
|
||||
-- 试炼副本商店不按sort字段排序
|
||||
if storeInfo.StoreType ~= SHOP_TYPE.TRIAL_SHOP then
|
||||
table.sort(v.storeItem, function(a, b)
|
||||
local aId = a.id % _StoreItemIdFilter
|
||||
local bId = b.id % _StoreItemIdFilter
|
||||
local aInfo = ConfigManager.GetConfigData(ConfigName.StoreConfig, aId)
|
||||
local bInfo = ConfigManager.GetConfigData(ConfigName.StoreConfig, bId)
|
||||
local storeInfo = ConfigManager.TryGetConfigData(ConfigName.StoreTypeConfig, v.id)
|
||||
if not storeInfo then
|
||||
LogError("StoreTypeConfig not find Id:"..v.id)
|
||||
else
|
||||
-- shopType不存在时全部刷新,否则按shoptype刷新
|
||||
if not shopType or storeInfo.StoreType == shopType then
|
||||
-- 试炼副本商店不按sort字段排序
|
||||
if storeInfo.StoreType ~= SHOP_TYPE.TRIAL_SHOP then
|
||||
table.sort(v.storeItem, function(a, b)
|
||||
local aId = a.id % _StoreItemIdFilter
|
||||
local bId = b.id % _StoreItemIdFilter
|
||||
local aInfo = ConfigManager.GetConfigData(ConfigName.StoreConfig, aId)
|
||||
local bInfo = ConfigManager.GetConfigData(ConfigName.StoreConfig, bId)
|
||||
|
||||
-- 公会商店排序未解锁的往后排
|
||||
if v.id == SHOP_TYPE.GUILD_SHOP and PlayerManager.familyId ~= 0 and MyGuildManager.GetMyGuildInfo() then
|
||||
local aIsUnLock = MyGuildManager.GetGuildShopSortIsUnLock(aInfo.Sort)
|
||||
local bIsUnLock = MyGuildManager.GetGuildShopSortIsUnLock(bInfo.Sort)
|
||||
if aIsUnLock and not bIsUnLock then return true end
|
||||
if not aIsUnLock and bIsUnLock then return false end
|
||||
end
|
||||
-- 免费的往前排
|
||||
local _, a_price = this.calculateBuyCost(storeInfo.StoreType, aId, 1)
|
||||
local _, b_price = this.calculateBuyCost(storeInfo.StoreType, bId, 1)
|
||||
if a_price == 0 and b_price ~= 0 then return true end
|
||||
if a_price ~= 0 and b_price == 0 then return false end
|
||||
-- 按sort排序
|
||||
return aInfo.Sort < bInfo.Sort
|
||||
end)
|
||||
else--是试炼商店
|
||||
table.sort(v.storeItem, function(a, b)
|
||||
local aId = a.id % _StoreItemIdFilter
|
||||
local bId = b.id % _StoreItemIdFilter
|
||||
local aInfo = ConfigManager.GetConfigData(ConfigName.StoreConfig, aId)
|
||||
local bInfo = ConfigManager.GetConfigData(ConfigName.StoreConfig, bId)
|
||||
if a.buyNum == 0 and b.buyNum > 0 then
|
||||
return true
|
||||
end
|
||||
if a.buyNum > 0 and b.buyNum == 0 then
|
||||
return false
|
||||
end
|
||||
return aInfo.Sort < bInfo.Sort
|
||||
end)
|
||||
-- 公会商店排序未解锁的往后排
|
||||
if v.id == SHOP_TYPE.GUILD_SHOP and PlayerManager.familyId ~= 0 and MyGuildManager.GetMyGuildInfo() then
|
||||
local aIsUnLock = MyGuildManager.GetGuildShopSortIsUnLock(aInfo.Sort)
|
||||
local bIsUnLock = MyGuildManager.GetGuildShopSortIsUnLock(bInfo.Sort)
|
||||
if aIsUnLock and not bIsUnLock then return true end
|
||||
if not aIsUnLock and bIsUnLock then return false end
|
||||
end
|
||||
-- 免费的往前排
|
||||
local _, a_price = this.calculateBuyCost(storeInfo.StoreType, aId, 1)
|
||||
local _, b_price = this.calculateBuyCost(storeInfo.StoreType, bId, 1)
|
||||
if a_price == 0 and b_price ~= 0 then return true end
|
||||
if a_price ~= 0 and b_price == 0 then return false end
|
||||
-- 按sort排序
|
||||
return aInfo.Sort < bInfo.Sort
|
||||
end)
|
||||
else--是试炼商店
|
||||
table.sort(v.storeItem, function(a, b)
|
||||
local aId = a.id % _StoreItemIdFilter
|
||||
local bId = b.id % _StoreItemIdFilter
|
||||
local aInfo = ConfigManager.GetConfigData(ConfigName.StoreConfig, aId)
|
||||
local bInfo = ConfigManager.GetConfigData(ConfigName.StoreConfig, bId)
|
||||
if a.buyNum == 0 and b.buyNum > 0 then
|
||||
return true
|
||||
end
|
||||
if a.buyNum > 0 and b.buyNum == 0 then
|
||||
return false
|
||||
end
|
||||
return aInfo.Sort < bInfo.Sort
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue