更新首充界面
This commit is contained in:
parent
2f15a426bc
commit
23fca8d7bf
@ -103,7 +103,6 @@ function PayManager:getGiftConfigInfo(purchaseType, id)
|
||||
return
|
||||
end
|
||||
local cfg = ConfigManager:getConfig(cfgName)
|
||||
local cfg = ConfigManager:getConfig(cfgName)
|
||||
if not cfg or not cfg[id] then
|
||||
return
|
||||
end
|
||||
|
||||
@ -24,13 +24,17 @@ end
|
||||
-- 触发弹窗礼包
|
||||
function ShopManager:triggerGiftPopUI(actType, actId)
|
||||
if ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.ACT_GIFT_SHOW_OPEN, true) then
|
||||
UIManager:showUI("app/ui/shop/gift_pop_ui", {type = actType, id = actId})
|
||||
self:showGiftPopUI(actType, actId, false)
|
||||
DataManager.ShopData:removePopUpGift(actType, actId)
|
||||
end
|
||||
end
|
||||
|
||||
function ShopManager:showGiftPopUI(actType, actId)
|
||||
UIManager:showUI("app/ui/shop/gift_pop_ui", {type = actType, id = actId, onlySelf = true})
|
||||
function ShopManager:showGiftPopUI(actType, actId, onlySelf)
|
||||
if actType == PayManager.PURCHARSE_TYPE.ACT_GIFT and actId == GConst.ShopConst.FIRST_RECHARGE_ID then
|
||||
UIManager:showUI("app/ui/shop/first_recharge_pop_ui")
|
||||
else
|
||||
UIManager:showUI("app/ui/shop/gift_pop_ui", {type = actType, id = actId, onlySelf = onlySelf})
|
||||
end
|
||||
end
|
||||
|
||||
-- 触发金币弹窗礼包
|
||||
@ -64,23 +68,31 @@ function ShopManager:buyMallDailyGift(id, isAd)
|
||||
end
|
||||
|
||||
-- 二次弹窗确认
|
||||
local isCoin = costs.id == GConst.ItemConst.ITEM_ID_GOLD
|
||||
local params ={
|
||||
titleTx = I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_31),
|
||||
content = isCoin and I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_32) or I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_33),
|
||||
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK_CANCEL,
|
||||
showToday = GConst.MESSAGE_BOX_SHOW_TODAY.HOT_SELL_BUY,
|
||||
costId = costs.id,
|
||||
costNum = costs.num,
|
||||
okFunc = function()
|
||||
local responseData = {
|
||||
rewards = rewards,
|
||||
costs = costs
|
||||
}
|
||||
self:sendMessage(ProtoMsgType.FromMsgEnum.BuyMallDailyReq, params, responseData, self.buyMallDailyGiftFinish, BIReport.ITEM_GET_TYPE.MALL_DAILY)
|
||||
end,
|
||||
}
|
||||
GFunc.showMessageBox(params)
|
||||
if costs then
|
||||
local isCoin = costs.id == GConst.ItemConst.ITEM_ID_GOLD
|
||||
local params ={
|
||||
titleTx = I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_31),
|
||||
content = isCoin and I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_32) or I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_33),
|
||||
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK_CANCEL,
|
||||
showToday = GConst.MESSAGE_BOX_SHOW_TODAY.HOT_SELL_BUY,
|
||||
costId = costs.id,
|
||||
costNum = costs.num,
|
||||
okFunc = function()
|
||||
local responseData = {
|
||||
rewards = rewards,
|
||||
costs = costs
|
||||
}
|
||||
self:sendMessage(ProtoMsgType.FromMsgEnum.BuyMallDailyReq, params, responseData, self.buyMallDailyGiftFinish, BIReport.ITEM_GET_TYPE.MALL_DAILY)
|
||||
end,
|
||||
}
|
||||
GFunc.showMessageBox(params)
|
||||
else
|
||||
local responseData = {
|
||||
rewards = rewards,
|
||||
costs = costs
|
||||
}
|
||||
self:sendMessage(ProtoMsgType.FromMsgEnum.BuyMallDailyReq, params, responseData, self.buyMallDailyGiftFinish, BIReport.ITEM_GET_TYPE.MALL_DAILY)
|
||||
end
|
||||
end
|
||||
|
||||
function ShopManager:buyMallDailyGiftFinish(result)
|
||||
|
||||
@ -10,7 +10,7 @@ function SideBarBeginnerGiftCell:getIconRes()
|
||||
end
|
||||
|
||||
function SideBarBeginnerGiftCell:onClick()
|
||||
ModuleManager.ShopManager:showGiftPopUI(PayManager.PURCHARSE_TYPE.ACT_GIFT, GConst.ShopConst.BEGINNER_GIFT_ID)
|
||||
ModuleManager.ShopManager:showGiftPopUI(PayManager.PURCHARSE_TYPE.ACT_GIFT, GConst.ShopConst.BEGINNER_GIFT_ID, true)
|
||||
end
|
||||
|
||||
function SideBarBeginnerGiftCell:getIsShowRedPoint()
|
||||
|
||||
@ -10,7 +10,7 @@ function SideBarFirstRechargeCell:getIconRes()
|
||||
end
|
||||
|
||||
function SideBarFirstRechargeCell:onClick()
|
||||
ModuleManager.ShopManager:showGiftPopUI(PayManager.PURCHARSE_TYPE.ACT_GIFT, GConst.ShopConst.FIRST_RECHARGE_ID)
|
||||
ModuleManager.ShopManager:showGiftPopUI(PayManager.PURCHARSE_TYPE.ACT_GIFT, GConst.ShopConst.FIRST_RECHARGE_ID, true)
|
||||
end
|
||||
|
||||
function SideBarFirstRechargeCell:getIsShowRedPoint()
|
||||
|
||||
@ -12,7 +12,7 @@ end
|
||||
function SideBarGrowUpGift1Cell:onClick()
|
||||
local gift = DataManager.ShopData:getValidGrowUpGifts()[1]
|
||||
if gift then
|
||||
ModuleManager.ShopManager:showGiftPopUI(PayManager.PURCHARSE_TYPE.GROW_UP_GIFT, gift.current_grow_up_id)
|
||||
ModuleManager.ShopManager:showGiftPopUI(PayManager.PURCHARSE_TYPE.GROW_UP_GIFT, gift.current_grow_up_id, true)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ end
|
||||
function SideBarGrowUpGift2Cell:onClick()
|
||||
local gift = DataManager.ShopData:getValidGrowUpGifts()[2]
|
||||
if gift then
|
||||
ModuleManager.ShopManager:showGiftPopUI(PayManager.PURCHARSE_TYPE.GROW_UP_GIFT, gift.current_grow_up_id)
|
||||
ModuleManager.ShopManager:showGiftPopUI(PayManager.PURCHARSE_TYPE.GROW_UP_GIFT, gift.current_grow_up_id, true)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
107
lua/app/ui/shop/first_recharge_pop_ui.lua
Normal file
107
lua/app/ui/shop/first_recharge_pop_ui.lua
Normal file
@ -0,0 +1,107 @@
|
||||
local FirstRechargePopUI = class("FirstRechargePopUI", BaseUI)
|
||||
local MAX_ITEM_NUM = 3
|
||||
|
||||
function FirstRechargePopUI:ctor()
|
||||
end
|
||||
|
||||
function FirstRechargePopUI:isFullScreen()
|
||||
return false
|
||||
end
|
||||
|
||||
function FirstRechargePopUI:getPrefabPath()
|
||||
return "assets/prefabs/ui/shop/first_recharge_pop_ui.prefab"
|
||||
end
|
||||
|
||||
function FirstRechargePopUI:onLoadRootComplete()
|
||||
self.uiMap = self.root:genAllChildren()
|
||||
self.uiMap["first_recharge_pop_ui.close_btn"]:addClickListener(function()
|
||||
self:closeUI()
|
||||
end)
|
||||
|
||||
self.titleTx = self.uiMap["first_recharge_pop_ui.bg.title_bg.title"]
|
||||
self.titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_34)) -- 首充豪礼
|
||||
|
||||
self.itemNodeList = {}
|
||||
self.itemCellList = {}
|
||||
self.itemTextList = {}
|
||||
self.itemHelpList = {}
|
||||
for i = 1, MAX_ITEM_NUM do
|
||||
table.insert(self.itemNodeList, self.uiMap["first_recharge_pop_ui.bg.item_" .. i])
|
||||
table.insert(self.itemCellList, CellManager:addCellComp(self.uiMap["first_recharge_pop_ui.bg.item_".. i .. ".item_cell"], GConst.TYPEOF_LUA_CLASS.ITEM_CELL))
|
||||
table.insert(self.itemTextList, self.uiMap["first_recharge_pop_ui.bg.item_".. i .. ".num"])
|
||||
table.insert(self.itemHelpList, self.uiMap["first_recharge_pop_ui.bg.item_" .. i .. ".help"])
|
||||
end
|
||||
|
||||
self.descText = self.uiMap["first_recharge_pop_ui.bg.desc_text"]
|
||||
self.titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_35)) -- 充值购买任意商品,即可获得如下奖励,仅此一次!
|
||||
|
||||
self.funcBtn = self.uiMap["first_recharge_pop_ui.bg.func_btn"]
|
||||
self.btnJumpText = self.uiMap["first_recharge_pop_ui.bg.func_btn.jump_text"]
|
||||
self.btnGetText = self.uiMap["first_recharge_pop_ui.bg.func_btn.get_text"]
|
||||
self.btnIcon = self.uiMap["first_recharge_pop_ui.bg.func_btn.icon"]
|
||||
|
||||
self.btnJumpText:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_36)) -- 商店
|
||||
self.btnGetText:setText(I18N:getGlobalText(I18N.GlobalConst.BTN_CLAIM)) -- 领取
|
||||
|
||||
self.funcBtn:addClickListener(function()
|
||||
self:onClickFuncBtn()
|
||||
end)
|
||||
|
||||
self:_bind()
|
||||
self:refresh()
|
||||
end
|
||||
|
||||
function FirstRechargePopUI:_bind()
|
||||
self:bind(DataManager.ShopData, "isDirty", function()
|
||||
self:refresh()
|
||||
end)
|
||||
end
|
||||
|
||||
function FirstRechargePopUI:refresh()
|
||||
local cfgInfo = PayManager:getGiftConfigInfo(PayManager.PURCHARSE_TYPE.ACT_GIFT, GConst.ShopConst.FIRST_RECHARGE_ID)
|
||||
local rewards = cfgInfo.reward or {}
|
||||
for i = 1, MAX_ITEM_NUM do
|
||||
if i <= #rewards then
|
||||
self.itemNodeList[i]:setVisible(true)
|
||||
self.itemCellList[i]:refreshByCfg(rewards[i].id, 0)
|
||||
self.itemCellList[i]:setNum("")
|
||||
self.itemTextList[i]:setText(rewards[i].num)
|
||||
self.itemCellList[i]:addClickListener(function()
|
||||
ModuleManager.TipsManager:showItemTips(rewards[i].id, self.itemCellList[i]:getBaseObject())
|
||||
end)
|
||||
self.itemHelpList[i]:setVisible(false)
|
||||
else
|
||||
self.itemNodeList[i]:setVisible(false)
|
||||
end
|
||||
end
|
||||
|
||||
-- 对于首充礼包,有跳转商店和领取2个分支
|
||||
local canGet = DataManager.ShopData:getHasFirstRechargeReward()
|
||||
if canGet then
|
||||
self.btnIcon:setVisible(false)
|
||||
self.btnJumpText:setVisible(false)
|
||||
self.btnGetText:setVisible(true)
|
||||
else
|
||||
local hasGet = DataManager.ShopData:getHasGotFirstRechargeReward()
|
||||
if hasGet then
|
||||
self:closeUI()
|
||||
else
|
||||
self.btnIcon:setVisible(true)
|
||||
self.btnJumpText:setVisible(true)
|
||||
self.btnGetText:setVisible(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function FirstRechargePopUI:onClickFuncBtn()
|
||||
-- 对于首充礼包,有跳转商店和领取2个分支
|
||||
local canGet = DataManager.ShopData:getHasFirstRechargeReward()
|
||||
if canGet then
|
||||
PayManager:purchasePackage(PayManager.PURCHARSE_TYPE.ACT_GIFT, GConst.ShopConst.FIRST_RECHARGE_ID)
|
||||
else
|
||||
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.GO_SHOP)
|
||||
self:closeUI()
|
||||
end
|
||||
end
|
||||
|
||||
return FirstRechargePopUI
|
||||
10
lua/app/ui/shop/first_recharge_pop_ui.lua.meta
Normal file
10
lua/app/ui/shop/first_recharge_pop_ui.lua.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d1ea4328dc9ac714d8d6e25ef668467e
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
Loading…
x
Reference in New Issue
Block a user