Merge branch 'dev' of git.juzugame.com:b6-client/b6-lua into dev
This commit is contained in:
commit
29e23ea88a
@ -15,6 +15,18 @@ ShopConst.BOX_REWARD_TYPE = {
|
|||||||
BOUNTY = 2,
|
BOUNTY = 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ShopConst.PAGE_TYPE = {
|
||||||
|
DISCOUNT = 1,
|
||||||
|
MAIN = 2
|
||||||
|
}
|
||||||
|
-- 商店主要商品页面的类型
|
||||||
|
ShopConst.MAIN_PAGE_TYPE = {
|
||||||
|
BOX = 1,
|
||||||
|
HOT = 2,
|
||||||
|
GEM = 3,
|
||||||
|
GOLD = 4
|
||||||
|
}
|
||||||
|
|
||||||
ShopConst.GEM_ICON_NAME = {
|
ShopConst.GEM_ICON_NAME = {
|
||||||
[1] = "shop_diamond_1",
|
[1] = "shop_diamond_1",
|
||||||
[2] = "shop_diamond_1",
|
[2] = "shop_diamond_1",
|
||||||
|
|||||||
@ -39,12 +39,12 @@ function ResourceCell:show(itemId, hideAddImg)
|
|||||||
self.timeTx:setVisible(true)
|
self.timeTx:setVisible(true)
|
||||||
elseif itemId == GConst.ItemConst.ITEM_ID_GOLD then
|
elseif itemId == GConst.ItemConst.ITEM_ID_GOLD then
|
||||||
self.baseObject:addClickListener(function()
|
self.baseObject:addClickListener(function()
|
||||||
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.GO_SHOP, {page = 2})
|
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.GO_SHOP, {page = GConst.ShopConst.PAGE_TYPE.MAIN, subType = GConst.ShopConst.MAIN_PAGE_TYPE.GOLD})
|
||||||
end)
|
end)
|
||||||
self.addImg:setVisible(true)
|
self.addImg:setVisible(true)
|
||||||
elseif itemId == GConst.ItemConst.ITEM_ID_GEM then
|
elseif itemId == GConst.ItemConst.ITEM_ID_GEM then
|
||||||
self.baseObject:addClickListener(function()
|
self.baseObject:addClickListener(function()
|
||||||
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.GO_SHOP, {page = 2})
|
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.GO_SHOP, {page = GConst.ShopConst.PAGE_TYPE.MAIN, subType = GConst.ShopConst.MAIN_PAGE_TYPE.GEM})
|
||||||
end)
|
end)
|
||||||
self.addImg:setVisible(true)
|
self.addImg:setVisible(true)
|
||||||
else
|
else
|
||||||
|
|||||||
@ -9,8 +9,8 @@ function SideBarFirstRechargeCell:getIsOpen()
|
|||||||
return DataManager.ShopData:getShowFirstRechargeSideBar()
|
return DataManager.ShopData:getShowFirstRechargeSideBar()
|
||||||
end
|
end
|
||||||
|
|
||||||
function SideBarFirstRechargeCell:getIconRes()
|
function SideBarFirstRechargeCell:getSpineName()
|
||||||
return "main_btn_gift_3"
|
return "ui_main_btn_gift_first"
|
||||||
end
|
end
|
||||||
|
|
||||||
function SideBarFirstRechargeCell:getIsShowRedPoint()
|
function SideBarFirstRechargeCell:getIsShowRedPoint()
|
||||||
|
|||||||
@ -132,10 +132,14 @@ function MainCityUI:_addListeners()
|
|||||||
end)
|
end)
|
||||||
self:addEventListener(EventManager.CUSTOM_EVENT.GO_SHOP, function(params)
|
self:addEventListener(EventManager.CUSTOM_EVENT.GO_SHOP, function(params)
|
||||||
if ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.MALL, false) then
|
if ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.MALL, false) then
|
||||||
local page = params and params.page or 2 -- 默认主要商品
|
local page = params and params.page or GConst.ShopConst.PAGE_TYPE.MAIN -- 默认主要商品
|
||||||
|
local subType = params.subType
|
||||||
if self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.SHOP then
|
if self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.SHOP then
|
||||||
if self.subComps and self.subComps[GConst.MainCityConst.BOTTOM_PAGE.SHOP] then
|
if self.subComps and self.subComps[GConst.MainCityConst.BOTTOM_PAGE.SHOP] then
|
||||||
self.subComps[GConst.MainCityConst.BOTTOM_PAGE.SHOP]:switchPage(page)
|
self.subComps[GConst.MainCityConst.BOTTOM_PAGE.SHOP]:switchPage(page)
|
||||||
|
if page == GConst.ShopConst.PAGE_TYPE.MAIN and subType then
|
||||||
|
self.subComps[GConst.MainCityConst.BOTTOM_PAGE.SHOP]:goSubType(subType)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -147,6 +151,9 @@ function MainCityUI:_addListeners()
|
|||||||
self:refreshBottom(GConst.MainCityConst.BOTTOM_PAGE.SHOP, true)
|
self:refreshBottom(GConst.MainCityConst.BOTTOM_PAGE.SHOP, true)
|
||||||
if self.subComps and self.subComps[GConst.MainCityConst.BOTTOM_PAGE.SHOP] then
|
if self.subComps and self.subComps[GConst.MainCityConst.BOTTOM_PAGE.SHOP] then
|
||||||
self.subComps[GConst.MainCityConst.BOTTOM_PAGE.SHOP]:switchPage(page)
|
self.subComps[GConst.MainCityConst.BOTTOM_PAGE.SHOP]:switchPage(page)
|
||||||
|
if page == GConst.ShopConst.PAGE_TYPE.MAIN and subType then
|
||||||
|
self.subComps[GConst.MainCityConst.BOTTOM_PAGE.SHOP]:goSubType(subType)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|||||||
@ -1,5 +1,19 @@
|
|||||||
local BoxOpenUI = class("BoxOpenUI", BaseUI)
|
local BoxOpenUI = class("BoxOpenUI", BaseUI)
|
||||||
local SPINE_OPEN_TIME = 1.4
|
local SPINE_OPEN_TIME = 1.4
|
||||||
|
local DEFAULT_SPINE_NAME = "ui_shop_box_1" -- 默认的展示动画
|
||||||
|
|
||||||
|
local SUMMON_SPINE_NAME = {
|
||||||
|
[1] = "ui_shop_box_1",
|
||||||
|
[2] = "ui_shop_box_2",
|
||||||
|
[3] = "ui_shop_box_3",
|
||||||
|
}
|
||||||
|
local BOUNTY_SPINE_NAME = {
|
||||||
|
[8] = "ui_bounty_chestopen_1",
|
||||||
|
[9] = "ui_bounty_chestopen_2",
|
||||||
|
[11] = "ui_bounty_chestopen_3",
|
||||||
|
[18] = "ui_bounty_chestopen_4",
|
||||||
|
[10] = "ui_bounty_chestopen_5",
|
||||||
|
}
|
||||||
|
|
||||||
function BoxOpenUI:ctor(params)
|
function BoxOpenUI:ctor(params)
|
||||||
self.params = params or {} -- 将信息传递给下一个界面
|
self.params = params or {} -- 将信息传递给下一个界面
|
||||||
@ -18,31 +32,32 @@ end
|
|||||||
function BoxOpenUI:onLoadRootComplete()
|
function BoxOpenUI:onLoadRootComplete()
|
||||||
self.uiMap = self.root:genAllChildren()
|
self.uiMap = self.root:genAllChildren()
|
||||||
self.bg = self.uiMap["box_open_ui.bg"]
|
self.bg = self.uiMap["box_open_ui.bg"]
|
||||||
self.summonSpineList = {}
|
|
||||||
for i = 1, 3 do
|
|
||||||
table.insert(self.summonSpineList, self.uiMap["box_open_ui.ui_spine_obj_" .. i])
|
|
||||||
self.summonSpineList[i]:setVisible(false)
|
|
||||||
end
|
|
||||||
-- 奖励界面打开时 关闭此界面
|
-- 奖励界面打开时 关闭此界面
|
||||||
self:addEventListener(EventManager.CUSTOM_EVENT.CLOSE_BOX_OPEN_UI, function()
|
self:addEventListener(EventManager.CUSTOM_EVENT.CLOSE_BOX_OPEN_UI, function()
|
||||||
self:closeUI()
|
self:closeUI()
|
||||||
end)
|
end)
|
||||||
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.CLOSE_BOX_HERO_UI)
|
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.CLOSE_BOX_HERO_UI)
|
||||||
-- 播放spine表现 播放完毕后打开奖励UI
|
-- 播放spine表现 播放完毕后打开奖励UI
|
||||||
local spineObj
|
self.spineObj = self.uiMap["box_open_ui.ui_spine_obj"]
|
||||||
|
local spineName
|
||||||
|
|
||||||
|
Logger.logHighlight("type:%s index:%s", self.type, self.index)
|
||||||
|
|
||||||
if self.type == GConst.ShopConst.BOX_REWARD_TYPE.SUMMON then
|
if self.type == GConst.ShopConst.BOX_REWARD_TYPE.SUMMON then
|
||||||
spineObj = self.summonSpineList[self.index]
|
spineName = SUMMON_SPINE_NAME[self.index]
|
||||||
elseif self.type == GConst.ShopConst.BOX_REWARD_TYPE.BOUNTY then
|
elseif self.type == GConst.ShopConst.BOX_REWARD_TYPE.BOUNTY then
|
||||||
-- TODOJ
|
spineName = BOUNTY_SPINE_NAME[self.index]
|
||||||
end
|
end
|
||||||
if not spineObj then
|
if not spineName then
|
||||||
spineObj = self.summonSpineList[1]
|
spineName = DEFAULT_SPINE_NAME
|
||||||
end
|
end
|
||||||
spineObj:setVisible(true)
|
self.spineObj:loadAssetAsync(spineName, function()
|
||||||
spineObj:playAnim("born", false, true)
|
self.spineObj:playAnim("born", false, true, true)
|
||||||
|
self.spineObj:getSkeletonGraphic().enabled = true
|
||||||
self:performWithDelayGlobal(function()
|
self:performWithDelayGlobal(function()
|
||||||
ModuleManager.ShopManager:showBoxRewardUI(self.params)
|
ModuleManager.ShopManager:showBoxRewardUI(self.params)
|
||||||
end, SPINE_OPEN_TIME)
|
end, SPINE_OPEN_TIME)
|
||||||
|
end, false)
|
||||||
end
|
end
|
||||||
|
|
||||||
return BoxOpenUI
|
return BoxOpenUI
|
||||||
@ -107,6 +107,7 @@ function BoxRewardUI:onLoadRootComplete()
|
|||||||
self.rewardCells = self.rewardCells or {}
|
self.rewardCells = self.rewardCells or {}
|
||||||
local contentTrans = self.scrollRectContent:getTransform()
|
local contentTrans = self.scrollRectContent:getTransform()
|
||||||
local alreadyCellCount = contentTrans.childCount - 1
|
local alreadyCellCount = contentTrans.childCount - 1
|
||||||
|
local rewardCount = #self.fragmentRewards
|
||||||
if alreadyCellCount > 0 then
|
if alreadyCellCount > 0 then
|
||||||
for i = 1, alreadyCellCount do
|
for i = 1, alreadyCellCount do
|
||||||
local prefab = contentTrans:GetChild(i).gameObject
|
local prefab = contentTrans:GetChild(i).gameObject
|
||||||
@ -114,10 +115,18 @@ function BoxRewardUI:onLoadRootComplete()
|
|||||||
local prefabObject = UIPrefabObject:create()
|
local prefabObject = UIPrefabObject:create()
|
||||||
prefabObject:initWithPrefab(GConst.EMPTY_STRING, prefab)
|
prefabObject:initWithPrefab(GConst.EMPTY_STRING, prefab)
|
||||||
prefabObject:initPrefabHelper()
|
prefabObject:initPrefabHelper()
|
||||||
|
-- 设定位置
|
||||||
|
local index = i
|
||||||
|
local rowIdx = (index - 1) % CELL_NUM + 1 -- 横排位置 1-4
|
||||||
|
local cowIdx = (index - 1) // CELL_NUM + 1
|
||||||
|
if rewardCount <= CELL_NUM then -- 居中展示
|
||||||
|
prefabObject:setAnchoredPosition(POSITION_X_DATA[rewardCount][rowIdx], 0)
|
||||||
|
else
|
||||||
|
prefabObject:setAnchoredPosition(POSITION_X_DATA[4][rowIdx], -(cowIdx - 1) * REWARD_CELL_HEIGHT)
|
||||||
|
end
|
||||||
table.insert(self.rewardCells, CellManager:addCellComp(prefabObject, BOX_HERO_CELL))
|
table.insert(self.rewardCells, CellManager:addCellComp(prefabObject, BOX_HERO_CELL))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local rewardCount = #self.fragmentRewards
|
|
||||||
local cellCount = #self.rewardCells
|
local cellCount = #self.rewardCells
|
||||||
local needCreateCount = rewardCount - cellCount
|
local needCreateCount = rewardCount - cellCount
|
||||||
-- 将cell扩充至与奖励等数量
|
-- 将cell扩充至与奖励等数量
|
||||||
|
|||||||
@ -82,9 +82,9 @@ function ChapterCell:refresh(idx, cfgInfo, totalCount, arrowCallback)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
self.reweardLayout:RefreshLayout()
|
self.reweardLayout:RefreshLayout()
|
||||||
-- 价格(使用1类型)
|
-- 价格(使用1类型)(取消原价)
|
||||||
self.originPriceImg1:setVisible(true)
|
self.originPriceImg1:setVisible(false)
|
||||||
self.originPriceText1:setVisible(true)
|
self.originPriceText1:setVisible(false)
|
||||||
self.priceText1:setVisible(true)
|
self.priceText1:setVisible(true)
|
||||||
|
|
||||||
self.originPriceImg2:setVisible(false)
|
self.originPriceImg2:setVisible(false)
|
||||||
|
|||||||
@ -87,7 +87,7 @@ function FirstRechargePopUI:onClickFuncBtn()
|
|||||||
if canGet then
|
if canGet then
|
||||||
PayManager:purchasePackage(GConst.ShopConst.FIRST_RECHARGE_ID, PayManager.PURCHARSE_TYPE.ACT_GIFT)
|
PayManager:purchasePackage(GConst.ShopConst.FIRST_RECHARGE_ID, PayManager.PURCHARSE_TYPE.ACT_GIFT)
|
||||||
else
|
else
|
||||||
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.GO_SHOP, {page = 1})
|
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.GO_SHOP, {page = GConst.ShopConst.PAGE_TYPE.DISCOUNT})
|
||||||
self:closeUI()
|
self:closeUI()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -199,7 +199,7 @@ function GiftPopUI:onClickGift()
|
|||||||
if canGet then
|
if canGet then
|
||||||
PayManager:purchasePackage(self.actId, self.actType)
|
PayManager:purchasePackage(self.actId, self.actType)
|
||||||
else
|
else
|
||||||
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.GO_SHOP, {page = 1})
|
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.GO_SHOP, {page = GConst.ShopConst.PAGE_TYPE.DISCOUNT})
|
||||||
self:closeUI()
|
self:closeUI()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|||||||
@ -79,6 +79,42 @@ function ShopComp:switchPage(page)
|
|||||||
end
|
end
|
||||||
end
|
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()
|
||||||
|
end
|
||||||
|
local gemHeight = 0
|
||||||
|
if self.gemSellCell and self.gemSellCell:getIsOpen() then
|
||||||
|
gemHeight = self.gemSellCell:getCellHeight()
|
||||||
|
end
|
||||||
|
local goldHeight = 0
|
||||||
|
if self.goldSellCell and self.goldSellCell:getIsOpen() then
|
||||||
|
goldHeight = self.goldSellCell:getCellHeight()
|
||||||
|
end
|
||||||
|
|
||||||
|
Logger.logHighlight("goSubType -- %s %s %s %s %s %s %s %s", self.boxSellCell, boxHeight, self.hotSellCell, hotHeight, self.gemSellCell, gemHeight, self.goldSellCell, goldHeight)
|
||||||
|
|
||||||
|
local maxHeight = math.min(boxHeight + hotHeight + gemHeight + goldHeight - scrollRectObj:fastGetSizeDeltaY())
|
||||||
|
local height = 0
|
||||||
|
if subType == GConst.ShopConst.MAIN_PAGE_TYPE.BOX 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
|
||||||
|
elseif subType == GConst.ShopConst.MAIN_PAGE_TYPE.GOLD then
|
||||||
|
height = height + boxHeight + hotHeight + gemHeight
|
||||||
|
end
|
||||||
|
contentObj:setAnchoredPositionY(math.min(height, maxHeight))
|
||||||
|
end
|
||||||
|
|
||||||
function ShopComp:initMainPage()
|
function ShopComp:initMainPage()
|
||||||
self.mainNode = self.uiMap["shop_comp.main"]
|
self.mainNode = self.uiMap["shop_comp.main"]
|
||||||
local scrollrect = self.uiMap["shop_comp.main.scrollrect"]
|
local scrollrect = self.uiMap["shop_comp.main.scrollrect"]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user