From 058c2aec8a3d242e74a208ca7415e0edce21e853 Mon Sep 17 00:00:00 2001 From: CloudJ Date: Mon, 29 May 2023 18:06:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=9F=8E=E7=BA=A2=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cell/side_bar_first_recharge_cell.lua | 4 +++ lua/app/ui/main_city/main_city_ui.lua | 7 +++++ lua/app/ui/shop/first_recharge_pop_ui.lua | 2 +- lua/app/userdata/shop/shop_data.lua | 31 +++++++++++++++++++ 4 files changed, 43 insertions(+), 1 deletion(-) diff --git a/lua/app/ui/main_city/cell/side_bar_first_recharge_cell.lua b/lua/app/ui/main_city/cell/side_bar_first_recharge_cell.lua index c5cf24c9..16ccd14a 100644 --- a/lua/app/ui/main_city/cell/side_bar_first_recharge_cell.lua +++ b/lua/app/ui/main_city/cell/side_bar_first_recharge_cell.lua @@ -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 diff --git a/lua/app/ui/main_city/main_city_ui.lua b/lua/app/ui/main_city/main_city_ui.lua index 936282b0..607157f8 100644 --- a/lua/app/ui/main_city/main_city_ui.lua +++ b/lua/app/ui/main_city/main_city_ui.lua @@ -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() diff --git a/lua/app/ui/shop/first_recharge_pop_ui.lua b/lua/app/ui/shop/first_recharge_pop_ui.lua index ce07fd8b..4090f6ab 100644 --- a/lua/app/ui/shop/first_recharge_pop_ui.lua +++ b/lua/app/ui/shop/first_recharge_pop_ui.lua @@ -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() diff --git a/lua/app/userdata/shop/shop_data.lua b/lua/app/userdata/shop/shop_data.lua index cd7f598c..fdb07b14 100644 --- a/lua/app/userdata/shop/shop_data.lua +++ b/lua/app/userdata/shop/shop_data.lua @@ -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 \ No newline at end of file