This commit is contained in:
puxuan 2025-08-13 17:17:24 +08:00
parent 6b9e3b9ded
commit 8b49352830
3 changed files with 46 additions and 65 deletions

View File

@ -179,7 +179,7 @@ function DataManager:initWithServerData(data)
self.SevenDayData:init(data.seven_day) self.SevenDayData:init(data.seven_day)
self.ShopData:initBase() self.ShopData:initBase()
self.ShopData:initActGift(data.act) -- 礼包购买信息 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:initCommonDailyGoldGift(data.mall_idle and data.mall_idle.ad_count) -- 常驻金币礼包
self.ShopData:initGrowUpGift(data.act_grow_up_gift2) -- 成长礼包 self.ShopData:initGrowUpGift(data.act_grow_up_gift2) -- 成长礼包
self.ShopData:initLevelUpGift(data.act_level_up_gift) -- 助力/金币礼包 self.ShopData:initLevelUpGift(data.act_level_up_gift) -- 助力/金币礼包

View File

@ -25,10 +25,9 @@ ShopConst.PAGE_TYPE = {
} }
-- 商店主要商品页面的类型 -- 商店主要商品页面的类型
ShopConst.MAIN_PAGE_TYPE = { ShopConst.MAIN_PAGE_TYPE = {
BOX = 1, HOT = 1,
HOT = 2, GEM = 2,
GEM = 3, GOLD = 3
GOLD = 4
} }
ShopConst.GEM_ICON_NAME = { ShopConst.GEM_ICON_NAME = {

View File

@ -5,8 +5,7 @@ local BOTTOM_HEIGHT = 218
local TITLE_HEIGHT = 54 local TITLE_HEIGHT = 54
local PAGE_DISCOUNT = 1 local PAGE_DISCOUNT = 1
local PAGE_MAIN = 2 local PAGE_MAIN = 2
local TITLE_POS = -100 -- local TITLE_POS = -140
local PAGE_MAIN_BOX_SELL_CELL = "app/ui/shop/cell/box_sell_cell"
local PAGE_MAIN_HOT_SELL_CELL = "app/ui/shop/cell/hot_sell_cell" 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_GEM_SELL_CELL = "app/ui/shop/cell/gem_sell_cell"
local PAGE_MAIN_GOLD_SELL_CELL = "app/ui/shop/cell/gold_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.page = PAGE_MAIN -- 默认展示主要商品
self.post = false self.post = false
-- self:initTitlePage() self:initTitlePage()
-- self:initMainPage() self:initMainPage()
-- self:initDiscountPage() self:initDiscountPage()
-- self:switchPage(self.page) self:switchPage(self.page)
end end
function ShopComp:initTitlePage() function ShopComp:initTitlePage()
@ -58,8 +57,8 @@ function ShopComp:initTitlePage()
end) end)
self:refreshTitle() self:refreshTitle()
local safeHeight = SafeAreaManager:getNotchScreenHeight() -- local safeHeight = SafeAreaManager:getNotchScreenHeight()
self.titleNode:setAnchoredPositionY(TITLE_POS - safeHeight) -- self.titleNode:setAnchoredPositionY(TITLE_POS - safeHeight)
if GFunc.isShenhe() then if GFunc.isShenhe() then
self.subTitleBtn2:setAnchoredPositionX(0) self.subTitleBtn2:setAnchoredPositionX(0)
self.subTitleBtn1:setVisible(false) self.subTitleBtn1:setVisible(false)
@ -100,10 +99,6 @@ end
function ShopComp:goSubType(subType) function ShopComp:goSubType(subType)
local scrollRectObj = self.uiMap["shop_comp.main.scrollrect"] local scrollRectObj = self.uiMap["shop_comp.main.scrollrect"]
local contentObj = self.uiMap["shop_comp.main.scrollrect.viewport.content"] 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 local hotHeight = 0
if self.hotSellCell and self.hotSellCell:getIsOpen() then if self.hotSellCell and self.hotSellCell:getIsOpen() then
hotHeight = self.hotSellCell:getCellHeight() hotHeight = self.hotSellCell:getCellHeight()
@ -116,16 +111,14 @@ function ShopComp:goSubType(subType)
if self.goldSellCell and self.goldSellCell:getIsOpen() then if self.goldSellCell and self.goldSellCell:getIsOpen() then
goldHeight = self.goldSellCell:getCellHeight() goldHeight = self.goldSellCell:getCellHeight()
end end
local maxHeight = math.min(boxHeight + hotHeight + gemHeight + goldHeight - scrollRectObj:fastGetSizeDeltaY()) local maxHeight = math.min(hotHeight + gemHeight + goldHeight - scrollRectObj:fastGetSizeDeltaY())
local height = 0 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 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 elseif subType == GConst.ShopConst.MAIN_PAGE_TYPE.GOLD then
height = height + boxHeight + hotHeight + gemHeight height = height + hotHeight + gemHeight
end end
contentObj:setAnchoredPositionY(math.min(height, maxHeight)) contentObj:setAnchoredPositionY(math.min(height, maxHeight))
end end
@ -139,7 +132,6 @@ function ShopComp:initMainPage()
height = height - safeHeight height = height - safeHeight
scrollrect:setSizeDeltaY(height) scrollrect:setSizeDeltaY(height)
self.mainScrollContent = self.uiMap["shop_comp.main.scrollrect.viewport.content"] 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.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.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) 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 end
function ShopComp:refresh() function ShopComp:refresh()
-- if self.page == PAGE_DISCOUNT then if self.page == PAGE_DISCOUNT then
-- self.mainNode:setAnchoredPositionX(GConst.NOT_VISIBLE_POS) self.mainNode:setAnchoredPositionX(GConst.NOT_VISIBLE_POS)
-- self.discountNode:setAnchoredPositionX(0) self.discountNode:setAnchoredPositionX(0)
-- DataManager.ShopData:markShopDiscountRedPoint() DataManager.ShopData:markShopDiscountRedPoint()
-- self.subTitleBtn1:removeRedPoint() self.subTitleBtn1:removeRedPoint()
-- if DataManager.ShopData:getRp() then if DataManager.ShopData:getRp() then
-- self.subTitleBtn2:addRedPoint(84, 24) self.subTitleBtn2:addRedPoint(84, 24)
-- else else
-- self.subTitleBtn2:removeRedPoint() self.subTitleBtn2:removeRedPoint()
-- end end
-- else else
-- self.mainNode:setAnchoredPositionX(0) self.mainNode:setAnchoredPositionX(0)
-- self.discountNode:setAnchoredPositionX(GConst.NOT_VISIBLE_POS) self.discountNode:setAnchoredPositionX(GConst.NOT_VISIBLE_POS)
-- self.subTitleBtn2:removeRedPoint() self.subTitleBtn2:removeRedPoint()
-- if DataManager.ShopData:getShopDiscountRedPoint() then if DataManager.ShopData:getShopDiscountRedPoint() then
-- self.subTitleBtn1:addRedPoint(-84, 24) self.subTitleBtn1:addRedPoint(-84, 24)
-- else else
-- self.subTitleBtn1:removeRedPoint() self.subTitleBtn1:removeRedPoint()
-- end end
-- end end
-- self:refreshTitle() self:refreshTitle()
-- self:refreshDiscountPage() self:refreshDiscountPage()
-- self:refreshMainPage() self:refreshMainPage()
-- -- 如果已经跨天了 需要重新请求每日礼包数据 -- 如果已经跨天了 需要重新请求每日礼包数据
-- if DataManager.ShopData:getMallDailyDirty() then if DataManager.ShopData:getMallDailyDirty() then
-- DataManager.ShopData:markMallDailyDirty(false) DataManager.ShopData:markMallDailyDirty(false)
-- ModuleManager.ShopManager:mallDailyGiftOverDay() ModuleManager.ShopManager:mallDailyGiftOverDay()
-- end end
-- self:refreshTime() self:refreshTime()
-- -- 上报 -- 上报
-- self:postEnterPage() self:postEnterPage()
end end
function ShopComp:postEnterPage() function ShopComp:postEnterPage()
@ -409,16 +401,6 @@ end
function ShopComp:refreshMainPage() function ShopComp:refreshMainPage()
local y = 0 local y = 0
local cellHeight = 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 if self.hotSellCell:getIsOpen() then
self.hotSellCell:setVisible(true) self.hotSellCell:setVisible(true)