【商店】免费次数的商店,取消刷新后今日不再显示满次红点的功能,满次后刷新红点显示添加
parent
582ab51299
commit
25a14f7a79
|
@ -25,6 +25,9 @@ function this.SetSelectIndex(shopType,storeId,b)
|
||||||
end
|
end
|
||||||
|
|
||||||
function this.Initialize()
|
function this.Initialize()
|
||||||
|
-- 是否已经刷新红点标志位
|
||||||
|
this.RecoverCountRedFlag = {}
|
||||||
|
|
||||||
if not this._CountDownTimer then
|
if not this._CountDownTimer then
|
||||||
this._CountDownTimer = Timer.New(this.TimeUpdate, 1, -1, true)
|
this._CountDownTimer = Timer.New(this.TimeUpdate, 1, -1, true)
|
||||||
this._CountDownTimer:Start()
|
this._CountDownTimer:Start()
|
||||||
|
@ -118,7 +121,7 @@ function this.UpdateShopData(msg)
|
||||||
local shopInfo = this.GetShopInfo(newdata.id)
|
local shopInfo = this.GetShopInfo(newdata.id)
|
||||||
this.CheckShopRedpot(shopInfo.StoreType)
|
this.CheckShopRedpot(shopInfo.StoreType)
|
||||||
|
|
||||||
--Log(string.format("服务器推送商店刷新,商店id = %d", newdata.id))
|
-- LogYellow(string.format("服务器推送商店刷新,商店id = %s, 商店类型 = %s", newdata.id, shopInfo.StoreType))
|
||||||
end
|
end
|
||||||
-- 刷新物品排序
|
-- 刷新物品排序
|
||||||
this.SortItemList()
|
this.SortItemList()
|
||||||
|
@ -678,9 +681,25 @@ function this.CheckShopRefreshTime()
|
||||||
this._IsRefresh = 0
|
this._IsRefresh = 0
|
||||||
this._RefreshShopList = {}
|
this._RefreshShopList = {}
|
||||||
for _, v in ipairs(this.allShopData) do
|
for _, v in ipairs(this.allShopData) do
|
||||||
local leftTime = this.CountShopRefreshLeftTime(v.id)
|
|
||||||
local shopInfo = this.GetShopInfo(v.id)
|
local shopInfo = this.GetShopInfo(v.id)
|
||||||
local shopType = shopInfo.StoreType
|
local shopType = shopInfo.StoreType
|
||||||
|
|
||||||
|
-- 判断是否是自动恢复次数的商店,到达最大次数刷新红点显示
|
||||||
|
local IsAutoRecoverCount, Count = this.IsAutoRecoverCount(shopType)
|
||||||
|
if IsAutoRecoverCount then
|
||||||
|
local MaxCount = shopInfo.IfManualRefresh[1]
|
||||||
|
if Count >= MaxCount then
|
||||||
|
if not this.RecoverCountRedFlag[shopType] then
|
||||||
|
this.RecoverCountRedFlag[shopType] = true
|
||||||
|
this.CheckShopRedpot(shopType)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
this.RecoverCountRedFlag[shopType] = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 判断是否是自动刷新的商店
|
||||||
|
local leftTime = this.CountShopRefreshLeftTime(v.id)
|
||||||
this._RefreshShopList[shopType] = leftTime
|
this._RefreshShopList[shopType] = leftTime
|
||||||
-- 判断是否需要刷新商店
|
-- 判断是否需要刷新商店
|
||||||
if leftTime == 0 then
|
if leftTime == 0 then
|
||||||
|
@ -994,7 +1013,7 @@ end
|
||||||
--- 商店的查看时间
|
--- 商店的查看时间
|
||||||
local _ShopCheckTime = {}
|
local _ShopCheckTime = {}
|
||||||
--- 商店刷新按钮的点击状态
|
--- 商店刷新按钮的点击状态
|
||||||
local _RefreshBtnIsClick = {}
|
-- local _RefreshBtnIsClick = {}
|
||||||
|
|
||||||
-- 检测红点数据,shopType 为空时检测所有商店
|
-- 检测红点数据,shopType 为空时检测所有商店
|
||||||
function this.ShopCheckRPIsShow(shopType)
|
function this.ShopCheckRPIsShow(shopType)
|
||||||
|
@ -1024,9 +1043,9 @@ end
|
||||||
-- 检测商店刷新次数是否存在
|
-- 检测商店刷新次数是否存在
|
||||||
function this.ShopRefreshRPIsShow(shopType)
|
function this.ShopRefreshRPIsShow(shopType)
|
||||||
-- 判断今天商店的刷新按钮是否被点击过
|
-- 判断今天商店的刷新按钮是否被点击过
|
||||||
if _RefreshBtnIsClick[shopType] then
|
-- if _RefreshBtnIsClick[shopType] then
|
||||||
return false
|
-- return false
|
||||||
end
|
-- end
|
||||||
-- 没有商店数据
|
-- 没有商店数据
|
||||||
local shopData = this.GetShopDataByType(shopType)
|
local shopData = this.GetShopDataByType(shopType)
|
||||||
if not shopData then
|
if not shopData then
|
||||||
|
@ -1106,7 +1125,7 @@ function this.LoadRedpotDataFromLocal()
|
||||||
-- 检测所有商店
|
-- 检测所有商店
|
||||||
for _, type in pairs(SHOP_TYPE) do
|
for _, type in pairs(SHOP_TYPE) do
|
||||||
_ShopCheckTime[type] = PlayerPrefs.GetInt(PlayerManager.uid.."_ShopRedPot_"..type)
|
_ShopCheckTime[type] = PlayerPrefs.GetInt(PlayerManager.uid.."_ShopRedPot_"..type)
|
||||||
_RefreshBtnIsClick[type] = PlayerPrefs.GetInt(PlayerManager.uid.."_ShopBtnStatus_"..type) == 1
|
-- _RefreshBtnIsClick[type] = PlayerPrefs.GetInt(PlayerManager.uid.."_ShopBtnStatus_"..type) == 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1124,8 +1143,8 @@ end
|
||||||
|
|
||||||
-- 设置商店刷新按钮是否被点击过
|
-- 设置商店刷新按钮是否被点击过
|
||||||
function this.SetShopRefreshBtnClickStatus(shopType, status)
|
function this.SetShopRefreshBtnClickStatus(shopType, status)
|
||||||
PlayerPrefs.SetInt(PlayerManager.uid.."_ShopBtnStatus_"..shopType, status and 1 or 0)
|
-- PlayerPrefs.SetInt(PlayerManager.uid.."_ShopBtnStatus_"..shopType, status and 1 or 0)
|
||||||
_RefreshBtnIsClick[shopType] = status
|
-- _RefreshBtnIsClick[shopType] = status
|
||||||
|
|
||||||
this.CheckShopRedpot(shopType)
|
this.CheckShopRedpot(shopType)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue