From 8b49352830f9b77c4c298701c9661d9be6a66c1b Mon Sep 17 00:00:00 2001 From: puxuan <413323644@qq.com> Date: Wed, 13 Aug 2025 17:17:24 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/common/data_manager.lua | 2 +- lua/app/module/shop/shop_const.lua | 7 +- lua/app/ui/shop/shop_comp.lua | 102 ++++++++++++----------------- 3 files changed, 46 insertions(+), 65 deletions(-) diff --git a/lua/app/common/data_manager.lua b/lua/app/common/data_manager.lua index 3cb976ef..0c608214 100644 --- a/lua/app/common/data_manager.lua +++ b/lua/app/common/data_manager.lua @@ -179,7 +179,7 @@ function DataManager:initWithServerData(data) self.SevenDayData:init(data.seven_day) self.ShopData:initBase() self.ShopData:initActGift(data.act) -- 礼包购买信息 - self.ShopData:initMallDaily(data.mall_daily) -- 每日特惠 + self.ShopData:initMallDaily(data.mall_daily_store) -- 每日特惠 self.ShopData:initCommonDailyGoldGift(data.mall_idle and data.mall_idle.ad_count) -- 常驻金币礼包 self.ShopData:initGrowUpGift(data.act_grow_up_gift2) -- 成长礼包 self.ShopData:initLevelUpGift(data.act_level_up_gift) -- 助力/金币礼包 diff --git a/lua/app/module/shop/shop_const.lua b/lua/app/module/shop/shop_const.lua index 9722b6fa..678d20f6 100644 --- a/lua/app/module/shop/shop_const.lua +++ b/lua/app/module/shop/shop_const.lua @@ -25,10 +25,9 @@ ShopConst.PAGE_TYPE = { } -- 商店主要商品页面的类型 ShopConst.MAIN_PAGE_TYPE = { - BOX = 1, - HOT = 2, - GEM = 3, - GOLD = 4 + HOT = 1, + GEM = 2, + GOLD = 3 } ShopConst.GEM_ICON_NAME = { diff --git a/lua/app/ui/shop/shop_comp.lua b/lua/app/ui/shop/shop_comp.lua index a5841465..91a3abb7 100644 --- a/lua/app/ui/shop/shop_comp.lua +++ b/lua/app/ui/shop/shop_comp.lua @@ -5,8 +5,7 @@ local BOTTOM_HEIGHT = 218 local TITLE_HEIGHT = 54 local PAGE_DISCOUNT = 1 local PAGE_MAIN = 2 -local TITLE_POS = -100 -local PAGE_MAIN_BOX_SELL_CELL = "app/ui/shop/cell/box_sell_cell" +-- local TITLE_POS = -140 local PAGE_MAIN_HOT_SELL_CELL = "app/ui/shop/cell/hot_sell_cell" local PAGE_MAIN_GEM_SELL_CELL = "app/ui/shop/cell/gem_sell_cell" local PAGE_MAIN_GOLD_SELL_CELL = "app/ui/shop/cell/gold_sell_cell" @@ -26,10 +25,10 @@ function ShopComp:init() self.page = PAGE_MAIN -- 默认展示主要商品 self.post = false - -- self:initTitlePage() - -- self:initMainPage() - -- self:initDiscountPage() - -- self:switchPage(self.page) + self:initTitlePage() + self:initMainPage() + self:initDiscountPage() + self:switchPage(self.page) end function ShopComp:initTitlePage() @@ -58,8 +57,8 @@ function ShopComp:initTitlePage() end) self:refreshTitle() - local safeHeight = SafeAreaManager:getNotchScreenHeight() - self.titleNode:setAnchoredPositionY(TITLE_POS - safeHeight) + -- local safeHeight = SafeAreaManager:getNotchScreenHeight() + -- self.titleNode:setAnchoredPositionY(TITLE_POS - safeHeight) if GFunc.isShenhe() then self.subTitleBtn2:setAnchoredPositionX(0) self.subTitleBtn1:setVisible(false) @@ -100,10 +99,6 @@ end function ShopComp:goSubType(subType) local scrollRectObj = self.uiMap["shop_comp.main.scrollrect"] local contentObj = self.uiMap["shop_comp.main.scrollrect.viewport.content"] - local boxHeight = 0 - if self.boxSellCell and self.boxSellCell:getIsOpen() then - boxHeight = self.boxSellCell:getCellHeight() - end local hotHeight = 0 if self.hotSellCell and self.hotSellCell:getIsOpen() then hotHeight = self.hotSellCell:getCellHeight() @@ -116,16 +111,14 @@ function ShopComp:goSubType(subType) if self.goldSellCell and self.goldSellCell:getIsOpen() then goldHeight = self.goldSellCell:getCellHeight() end - local maxHeight = math.min(boxHeight + hotHeight + gemHeight + goldHeight - scrollRectObj:fastGetSizeDeltaY()) + local maxHeight = math.min(hotHeight + gemHeight + goldHeight - scrollRectObj:fastGetSizeDeltaY()) local height = 0 - if subType == GConst.ShopConst.MAIN_PAGE_TYPE.BOX then + if subType == GConst.ShopConst.MAIN_PAGE_TYPE.HOT then -- 默认在开头 - elseif subType == GConst.ShopConst.MAIN_PAGE_TYPE.HOT then - height = height + boxHeight elseif subType == GConst.ShopConst.MAIN_PAGE_TYPE.GEM then - height = height + boxHeight + hotHeight + height = height + hotHeight elseif subType == GConst.ShopConst.MAIN_PAGE_TYPE.GOLD then - height = height + boxHeight + hotHeight + gemHeight + height = height + hotHeight + gemHeight end contentObj:setAnchoredPositionY(math.min(height, maxHeight)) end @@ -139,7 +132,6 @@ function ShopComp:initMainPage() height = height - safeHeight scrollrect:setSizeDeltaY(height) self.mainScrollContent = self.uiMap["shop_comp.main.scrollrect.viewport.content"] - self.boxSellCell = self.uiMap["shop_comp.main.scrollrect.viewport.content.box_sell_cell"]:addLuaComponent(PAGE_MAIN_BOX_SELL_CELL) self.hotSellCell = self.uiMap["shop_comp.main.scrollrect.viewport.content.hot_sell_cell"]:addLuaComponent(PAGE_MAIN_HOT_SELL_CELL) self.gemSellCell = self.uiMap["shop_comp.main.scrollrect.viewport.content.gem_sell_cell"]:addLuaComponent(PAGE_MAIN_GEM_SELL_CELL) self.goldSellCell = self.uiMap["shop_comp.main.scrollrect.viewport.content.gold_sell_cell"]:addLuaComponent(PAGE_MAIN_GOLD_SELL_CELL) @@ -165,42 +157,42 @@ function ShopComp:initDiscountPage() end function ShopComp:refresh() - -- if self.page == PAGE_DISCOUNT then - -- self.mainNode:setAnchoredPositionX(GConst.NOT_VISIBLE_POS) - -- self.discountNode:setAnchoredPositionX(0) - -- DataManager.ShopData:markShopDiscountRedPoint() - -- self.subTitleBtn1:removeRedPoint() - -- if DataManager.ShopData:getRp() then - -- self.subTitleBtn2:addRedPoint(84, 24) - -- else - -- self.subTitleBtn2:removeRedPoint() - -- end - -- else - -- self.mainNode:setAnchoredPositionX(0) - -- self.discountNode:setAnchoredPositionX(GConst.NOT_VISIBLE_POS) - -- self.subTitleBtn2:removeRedPoint() - -- if DataManager.ShopData:getShopDiscountRedPoint() then - -- self.subTitleBtn1:addRedPoint(-84, 24) - -- else - -- self.subTitleBtn1:removeRedPoint() - -- end - -- end + if self.page == PAGE_DISCOUNT then + self.mainNode:setAnchoredPositionX(GConst.NOT_VISIBLE_POS) + self.discountNode:setAnchoredPositionX(0) + DataManager.ShopData:markShopDiscountRedPoint() + self.subTitleBtn1:removeRedPoint() + if DataManager.ShopData:getRp() then + self.subTitleBtn2:addRedPoint(84, 24) + else + self.subTitleBtn2:removeRedPoint() + end + else + self.mainNode:setAnchoredPositionX(0) + self.discountNode:setAnchoredPositionX(GConst.NOT_VISIBLE_POS) + self.subTitleBtn2:removeRedPoint() + if DataManager.ShopData:getShopDiscountRedPoint() then + self.subTitleBtn1:addRedPoint(-84, 24) + else + self.subTitleBtn1:removeRedPoint() + end + end - -- self:refreshTitle() - -- self:refreshDiscountPage() - -- self:refreshMainPage() + self:refreshTitle() + self:refreshDiscountPage() + self:refreshMainPage() - -- -- 如果已经跨天了 需要重新请求每日礼包数据 - -- if DataManager.ShopData:getMallDailyDirty() then - -- DataManager.ShopData:markMallDailyDirty(false) - -- ModuleManager.ShopManager:mallDailyGiftOverDay() - -- end + -- 如果已经跨天了 需要重新请求每日礼包数据 + if DataManager.ShopData:getMallDailyDirty() then + DataManager.ShopData:markMallDailyDirty(false) + ModuleManager.ShopManager:mallDailyGiftOverDay() + end - -- self:refreshTime() + self:refreshTime() - -- -- 上报 - -- self:postEnterPage() + -- 上报 + self:postEnterPage() end function ShopComp:postEnterPage() @@ -409,16 +401,6 @@ end function ShopComp:refreshMainPage() local y = 0 local cellHeight = 0 - -- 宝箱 - if self.boxSellCell:getIsOpen() then - self.boxSellCell:setVisible(true) - self.boxSellCell:refresh() - self.boxSellCell:getBaseObject():setAnchoredPositionY(0) - cellHeight = self.boxSellCell:getCellHeight() - y = y + cellHeight - else - self.boxSellCell:setVisible(false) - end -- 每日特惠 if self.hotSellCell:getIsOpen() then self.hotSellCell:setVisible(true)