商城红点

This commit is contained in:
CloudJ 2023-05-29 18:06:40 +08:00
parent 23fca8d7bf
commit 058c2aec8a
4 changed files with 43 additions and 1 deletions

View File

@ -9,6 +9,10 @@ function SideBarFirstRechargeCell:getIconRes()
return "main_btn_gift_3"
end
function SideBarFirstRechargeCell:getIsShowRedPoint()
return DataManager.ShopData:showFirstRechargeRp()
end
function SideBarFirstRechargeCell:onClick()
ModuleManager.ShopManager:showGiftPopUI(PayManager.PURCHARSE_TYPE.ACT_GIFT, GConst.ShopConst.FIRST_RECHARGE_ID, true)
end

View File

@ -201,6 +201,7 @@ function MainCityUI:_bind()
self.subComps[self.selectedIndex]:refresh()
end
end
self:refreshBottomRp()
end)
self:bind(DataManager.SummonData, "isDirty", function()
if self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.SHOP and self.subComps[self.selectedIndex] then
@ -767,6 +768,12 @@ function MainCityUI:refreshBottomRp()
else
heroRpObj:removeRedPoint()
end
local shopRpObj = uiMap["main_ui.bottom_node.icons.ui_spine_obj_3.rp_node"]
if DataManager.ShopData:getRp() then
shopRpObj:addRedPoint(0, 0, 1)
else
shopRpObj:removeRedPoint()
end
end
function MainCityUI:refreshSettingBtn()

View File

@ -97,7 +97,7 @@ function FirstRechargePopUI:onClickFuncBtn()
-- 对于首充礼包,有跳转商店和领取2个分支
local canGet = DataManager.ShopData:getHasFirstRechargeReward()
if canGet then
PayManager:purchasePackage(PayManager.PURCHARSE_TYPE.ACT_GIFT, GConst.ShopConst.FIRST_RECHARGE_ID)
PayManager:purchasePackage(GConst.ShopConst.FIRST_RECHARGE_ID, PayManager.PURCHARSE_TYPE.ACT_GIFT)
else
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.GO_SHOP)
self:closeUI()

View File

@ -750,7 +750,38 @@ function ShopData:getShowFirstRechargeSideBar()
end
end
-- 侧边栏红点
function ShopData:showFirstRechargeRp()
return self:getHasFirstRechargeReward()
end
-- 首充结束 ----------------------------------------------------------------------------------------------
-- 底部栏是否有红点
function ShopData:getRp()
if not ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.MALL) then
return false
end
local isHotOpen = ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.MALL_DAILY)
-- 主要商品 每日特惠广告道具
local hotAdGoods = self:getMallDailyGoods() and self:getMallDailyGoods()[1]
local hotAdGoodsBuyCount = hotAdGoods and hotAdGoods.bought or 0
local hotAdGoodsRp = self:getMallDailyFirstItemAdMaxCount() - hotAdGoodsBuyCount > 0
-- 主要商品 每日特惠刷新
local hotRefreshRp = self:getMallDailyAdLeftCount() > 0
-- 主要商品 钻石广告道具
local gemAdId = 1 -- 约定首位为免费栏位
local cfgInfo = self:getMallTreasureConfig()[gemAdId]
local gemAdMaxTimes = cfgInfo.daily or 0
local gemAdRp = gemAdMaxTimes - DataManager.ShopData:getGiftBoughtNum(PayManager.PURCHARSE_TYPE.MALL_TREASURE, gemAdId) > 0
-- 主要商品 金币广告道具
local coinAdId = 1 -- 约定首位为免费栏位
local cfgInfo = self:getMallGoldConfig()[coinAdId]
local coinAdMaxTimes = cfgInfo.daily or 0
local coinAdRp = coinAdMaxTimes - DataManager.ShopData:getCommonDailyCoinAdBuyCount() > 0
return (isHotOpen and (hotAdGoodsRp or hotRefreshRp)) or gemAdRp or coinAdRp
end
return ShopData