This commit is contained in:
puxuan 2025-10-22 20:50:52 +08:00
parent b9f3f557ab
commit 2b85e103b6
2 changed files with 21 additions and 159 deletions

View File

@ -43,13 +43,13 @@ function GemCell:refresh(id)
local count = DataManager.PaymentData:getGemStoreDoubleCount(self.id)
if count > 0 then
self.tag:setActive(true)
self.txReward:setAnchoredPositionY(-90)
-- self.txReward:setAnchoredPositionY(-90)
self.txDouble:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_21, count))
self.txDoubleNum:setText("+" .. GFunc.getRewardNum(reward))
GFunc.centerImgAndTx(self.imgIcon, self.txDoubleNum, 0)
-- GFunc.centerImgAndTx(self.imgIcon, self.txDoubleNum, 0)
else
self.tag:setActive(false)
self.txReward:setAnchoredPositionY(-50)
-- self.txReward:setAnchoredPositionY(-50)
end
end

View File

@ -1,23 +1,15 @@
local ShopComp = class("ShopComp", LuaComponent)
local CHAPTER_CELL = "app/ui/shop/cell/chapter_cell"
local CORE_SOUL_MAIN_CELL = "app/ui/shop/cell/core_soul_main_cell"
local DAILY_MAIN_CELL = "app/ui/shop/cell/daily_main_cell"
local GEM_MAIN_CELL = "app/ui/shop/cell/gem_main_cell"
local GOLD_MAIN_CELL = "app/ui/shop/cell/gold_main_cell"
local SKIN_CELL = "app/ui/shop/cell/force_skin_shop_cell"
local PAGE_TYPE = {
SHOP = 1,
SKIN = 2,
}
function ShopComp:init()
local uiMap = self.baseObject:genAllChildren()
self.bg = uiMap["shop_comp.bg"]
self.scrollrectNode = uiMap["shop_comp.bg.scrollrect"]
self.chapterTitleBg = uiMap["shop_comp.bg.scrollrect.viewport.content.chapter_title_bg"]
self.coreSoulTitleBg = uiMap["shop_comp.bg.scrollrect.viewport.content.core_soul_title_bg"]
self.dailyTitleBg = uiMap["shop_comp.bg.scrollrect.viewport.content.daily_title_bg"]
self.gemTitleBg = uiMap["shop_comp.bg.scrollrect.viewport.content.gem_title_bg"]
self.goldTitleBg = uiMap["shop_comp.bg.scrollrect.viewport.content.gold_title_bg"]
@ -26,13 +18,11 @@ function ShopComp:init()
self.chapterContent = uiMap["shop_comp.bg.scrollrect.viewport.content.chapter_scrollrect.viewport.content"]
uiMap["shop_comp.bg.scrollrect.viewport.content.chapter_title_bg.title"]:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_10))
uiMap["shop_comp.bg.scrollrect.viewport.content.core_soul_title_bg.title"]:setText(I18N:getGlobalText(I18N.GlobalConst.CORE_SUMMON_DESC_13))
uiMap["shop_comp.bg.scrollrect.viewport.content.daily_title_bg.title"]:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_28))
uiMap["shop_comp.bg.scrollrect.viewport.content.gem_title_bg.title"]:setText(ModuleManager.ItemManager:getItemName(GConst.ItemConst.ITEM_ID_GEM))
uiMap["shop_comp.bg.scrollrect.viewport.content.gold_title_bg.title"]:setText(ModuleManager.ItemManager:getItemName(GConst.ItemConst.ITEM_ID_GOLD))
self.chapterScrollrect = uiMap["shop_comp.bg.scrollrect.viewport.content.chapter_scrollrect"]
-- self.coreSoulMainCell = uiMap["shop_comp.bg.scrollrect.viewport.content.core_soul_main_cell"]
self.dailyCell = uiMap["shop_comp.bg.scrollrect.viewport.content.daily_cell"]
self.gemCell = uiMap["shop_comp.bg.scrollrect.viewport.content.gem_cell"]
self.goldCell = uiMap["shop_comp.bg.scrollrect.viewport.content.gold_cell"]
@ -56,44 +46,6 @@ function ShopComp:init()
self.dailyCells[i] = uiMap["shop_comp.bg.scrollrect.viewport.content.new_cell"]
end
self.scrollrectSkinNode = uiMap["shop_comp.bg.scrollrect_skin"]
self.txTitleSkin = uiMap["shop_comp.bg.scrollrect_skin.title.tx_title"]
-- 页签
self.tagNode = uiMap["shop_comp.bg.tag"]
self.btnShop = uiMap["shop_comp.bg.tag.btn_shop"]
self.txShop = uiMap["shop_comp.bg.tag.btn_shop.tx_desc"]
self.btnSkin = uiMap["shop_comp.bg.tag.btn_skin"]
self.txSkin = uiMap["shop_comp.bg.tag.btn_skin.tx_desc"]
self.btnShopSoul = uiMap["shop_comp.bg.scrollrect.viewport.content.core_soul_title_bg.btn_shop_soul"]
self.imgShopIcon = uiMap["shop_comp.bg.scrollrect.viewport.content.core_soul_title_bg.btn_shop_soul.bg.img_shop_icon"]
self.txShopNum = uiMap["shop_comp.bg.scrollrect.viewport.content.core_soul_title_bg.btn_shop_soul.bg.tx_shop_num"]
self.soulSpine = uiMap["shop_comp.bg.scrollrect.viewport.content.core_soul_title_bg.btn_shop_soul.ui_spine_obj"]
self.curPage = PAGE_TYPE.SHOP
self.txShop:setText(I18N:getGlobalText(I18N.GlobalConst.MAIN_BTN_1))
self.txSkin:setText(I18N:getGlobalText(I18N.GlobalConst.SKIN_FORCE_DESC_4))
self.txTitleSkin:setText(I18N:getGlobalText(I18N.GlobalConst.SKIN_FORCE_DESC_5))
self.btnShop:addClickListener(function()
if self.curPage == PAGE_TYPE.SHOP then
return
end
self.curPage = PAGE_TYPE.SHOP
self:refresh()
end)
self.btnSkin:addClickListener(function()
if self.curPage == PAGE_TYPE.SKIN then
return
end
self.curPage = PAGE_TYPE.SKIN
self:refresh()
end)
self.btnShopSoul:addClickListener(function()
ModuleManager.SummonManager:showSummonShopCommerceUI(3)
end)
self:bind(DataManager.ShopData, "isDirty", function()
self:refresh(nil, true)
end)
@ -109,7 +61,7 @@ function ShopComp:init()
-- end)
-- self:bind(DataManager.BagData.ItemData, "isDirty", function(binder, value)
-- self:refresh(nil, true)
-- end)
-- end)
self:bind(DataManager.PaymentData, "isDirty", function()
self:refresh(nil, true)
end)
@ -118,98 +70,44 @@ function ShopComp:init()
-- local height = rect.height - 390
-- self.bgHeight = math.max(height, 1015)
-- self.bg:setSizeDeltaY(self.bgHeight)
-- 审核模式屏蔽皮肤
-- self.btnSkin:setActive(not GFunc.isShenhe())
end
function ShopComp:refresh(showIdx, noShowIdx)
-- if showIdx ~= nil then
-- if showIdx == GConst.ShopConst.MAIN_PAGE_TYPE.FORCE_SKIN then
-- self.curPage = PAGE_TYPE.SKIN
-- else
-- self.curPage = PAGE_TYPE.SHOP
-- end
-- end
-- if self.curPage == PAGE_TYPE.SHOP then
-- self:refreshShop(showIdx, noShowIdx)
-- elseif self.curPage == PAGE_TYPE.SKIN then
-- self:refreshSkin()
-- end
-- self.btnShop:setSprite(GConst.ATLAS_PATH.COMMON, self.curPage == PAGE_TYPE.SHOP and "common_menu_6" or "common_menu_5")
-- self.btnSkin:setSprite(GConst.ATLAS_PATH.COMMON, self.curPage == PAGE_TYPE.SKIN and "common_menu_6" or "common_menu_5")
self:refreshShop(showIdx, noShowIdx)
-- if DataManager.ShopData:showRedPoint() then
-- self.btnShop:addRedPoint(75, 23, 0.9)
-- else
-- self.btnShop:removeRedPoint()
-- end
end
function ShopComp:updateTime()
end
function ShopComp:refreshShop(showIdx, noShowIdx)
self.scrollrectNode:setActive(true)
self.scrollrectSkinNode:setActive(false)
self.showIdx = showIdx or self.showIdx
self:updateList(noShowIdx)
-- if self.showIdx then -- 指定跳转
-- if self.showIdx == GConst.ShopConst.MAIN_PAGE_TYPE.CHAPTER_GIFT then
-- BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME.SHOP_CHAPTER)
-- elseif self.showIdx == GConst.ShopConst.MAIN_PAGE_TYPE.DAILY_STORE then
-- BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME.SHOP_DAILY_STORE)
-- elseif self.showIdx == GConst.ShopConst.MAIN_PAGE_TYPE.GEM_STORE then
-- BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME.SHOP_GEM_STORE)
-- elseif self.showIdx == GConst.ShopConst.MAIN_PAGE_TYPE.GOLD_STORE then
-- BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME.SHOP_GOLD_STORE)
-- else
-- BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME.MAIN_SHOP)
-- end
-- else
-- BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME.MAIN_SHOP)
-- end
if self.showIdx then -- 指定跳转
if self.showIdx == GConst.ShopConst.MAIN_PAGE_TYPE.CHAPTER_GIFT then
BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME.SHOP_CHAPTER)
elseif self.showIdx == GConst.ShopConst.MAIN_PAGE_TYPE.DAILY_STORE then
BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME.SHOP_DAILY_STORE)
elseif self.showIdx == GConst.ShopConst.MAIN_PAGE_TYPE.GEM_STORE then
BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME.SHOP_GEM_STORE)
elseif self.showIdx == GConst.ShopConst.MAIN_PAGE_TYPE.GOLD_STORE then
BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME.SHOP_GOLD_STORE)
else
BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME.MAIN_SHOP)
end
else
BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME.MAIN_SHOP)
end
self.showIdx = nil
end
function ShopComp:refreshSkin()
self.scrollrectNode:setActive(false)
self.scrollrectSkinNode:setActive(true)
local list = DataManager.ForceData:getSkinIdsShopSort()
if self.scrollrectSkinComp == nil then
self.scrollrectSkinComp = self.scrollrectSkinNode:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
self.scrollrectSkinComp:addInitCallback(function()
return SKIN_CELL
end)
self.scrollrectSkinComp:addRefreshCallback(function(index, cell)
cell:refresh(list[index])
end)
end
local count = #list
if self.scrollrectSkinComp:getTotalCount() == nil or self.scrollrectSkinComp:getTotalCount() <= 0 then
self.scrollrectSkinComp:refillCells(count)
elseif self.scrollrectSkinComp:getTotalCount() ~= count then
self.scrollrectSkinComp:clearCells()
self.scrollrectSkinComp:refillCells(count)
else
self.scrollrectSkinComp:updateAllCell()
end
end
function ShopComp:updateList(noShowIdx)
local height = -80
local height = -20
height = self:updateChapterList(height)
-- height = self:updateCoreSoulCell(height)
height = self:updateDailyCell(height)
height = self:updateGemCell(height)
height = self:updateGoldCell(height)
height = height - 50
height = height - 160
self.content:setSizeDeltaY(math.abs(height))
@ -263,42 +161,6 @@ function ShopComp:updateChapterList(offsetY)
return offsetY
end
-- function ShopComp:updateCoreSoulCell(offsetY)
-- -- self.imgShopIcon:setSprite(GConst.ATLAS_PATH.ICON_ITEM, ModuleManager.ItemManager:getItemIcon(GConst.ItemConst.SOUL_SHOP_GOLD))
-- -- self.txShopNum:setText(DataManager.BagData.ItemData:getItemNumById(GConst.ItemConst.SOUL_SHOP_GOLD))
-- self.txShopNum:setText(I18N:getGlobalText(I18N.GlobalConst.CORE_SUMMON_DESC_21))
-- self.coreSoulTitleBg:setActive(false)
-- self.coreSoulMainCell:setActive(false)
-- if DataManager.SummonData:getSummonShopSoulUnlock(3) then
-- self.soulSpine:setActive(true)
-- else
-- self.soulSpine:setActive(false)
-- end
-- if not DataManager.ShopData:isCoreSoulOpen() then
-- return offsetY
-- end
-- self.coreSoulTitleBg:setActive(true)
-- self.coreSoulMainCell:setActive(true)
-- if self.showIdx == GConst.ShopConst.MAIN_PAGE_TYPE.CORE_SOUL_STORE then
-- self.beginPosY = math.abs(offsetY)
-- end
-- if self.rpPosY == nil then
-- self.rpPosY = DataManager.ShopData:hasCoreSoulRedPoint() and math.abs(offsetY) or nil
-- end
-- self.coreSoulTitleBg:setAnchoredPositionY(offsetY)
-- offsetY = offsetY - 75
-- self.coreSoulMainCell:setAnchoredPositionY(offsetY)
-- offsetY = offsetY - 450
-- local cell = self.coreSoulMainCell:addLuaComponent(CORE_SOUL_MAIN_CELL)
-- cell:refresh()
-- return offsetY
-- end
function ShopComp:updateDailyCell(offsetY)
self.dailyCell:setActive(false)
self.dailyTitleBg:setActive(false)