竞技场弹出礼包

This commit is contained in:
xiekaidong 2023-07-05 21:01:18 +08:00
parent dea1136538
commit 592eb102ef
3 changed files with 44 additions and 20 deletions

View File

@ -322,6 +322,7 @@ local localization_global =
["ARENA_BATTLE_DESC_10"] = "下一页",
["ARENA_BATTLE_DESC_11"] = "退出将判定为战败,是否退出?",
["BATTLE_DESC_13"] = "滑动至此处可取消连线",
["ARENA_POP_GIFT_DESC_1"] ="竞技场弹出礼包描述",
}
return localization_global

View File

@ -20,6 +20,13 @@ function GiftPopUI:getPrefabPath()
return "assets/prefabs/ui/arena/arena_gift_pop_ui.prefab"
end
function GiftPopUI:onClose()
if self.titleSeq then
self.titleSeq:Kill()
self.titleSeq = nil
end
end
function GiftPopUI:onLoadRootComplete()
if not self.actType or not self.actId then
self:closeUI()
@ -31,11 +38,7 @@ function GiftPopUI:onLoadRootComplete()
self:closeUI()
end)
self.titleTx = self.uiMap["gift_pop_ui.bg.title"]
self.banner = self.uiMap["gift_pop_ui.bg.banner"]
self.offNode = self.uiMap["gift_pop_ui.bg.off_img"]
self.offText = self.uiMap["gift_pop_ui.bg.off_img.text"]
self.titleTx = self.uiMap["arena_gift_pop_ui.bg.banner.title"]
self.rewardCellList = {}
for i = 1, MAX_ITEM_NUM do
@ -47,7 +50,19 @@ function GiftPopUI:onLoadRootComplete()
self.timeText = self.uiMap["gift_pop_ui.bg.time_node.text"]
self.buyBtn = self.uiMap["gift_pop_ui.bg.buy_btn"]
self.buyBtnTx = self.uiMap["gift_pop_ui.bg.buy_btn.text"]
self.buyBtnIcon = self.uiMap["gift_pop_ui.bg.buy_btn.icon"]
self.textOrigin = self.uiMap["arena_gift_pop_ui.bg.buy_btn.text_origin"]
self.desctx = self.uiMap["arena_gift_pop_ui.bg.desc"]
if self.titleSeq then
self.titleSeq:Kill()
self.titleSeq = nil
end
self.titleSeq = self.root:createBindTweenSequence()
self.titleSeq:AppendCallback(function()
self.titleTx:setVisible(false)
end)
self.titleSeq:AppendInterval(0.01)
self.titleSeq:Append(self.titleTx:getTransform():DOScale(1, 0.3))
self.buyBtn:addClickListener(function()
self:onClickGift()
@ -61,21 +76,9 @@ end
function GiftPopUI:refresh()
self.titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_40))
-- self.banner:setTexture(GIFT_BG_NAME[self.actType][type])
self.desctx:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_POP_GIFT_DESC_1))
local cfgInfo = PayManager:getGiftConfigInfo(self.actType, self.actId)
if cfgInfo then
local off = cfgInfo.value or 0
if off < 100 then -- 统一为百分比格式
off = off * 100
end
if off > 0 then
self.offNode:setVisible(true)
self.offText:setText(tostring(off) .. "%")
else
self.offNode:setVisible(false)
end
end
local rewards = cfgInfo.reward or {}
for i = 1, MAX_ITEM_NUM do
@ -93,6 +96,17 @@ function GiftPopUI:refresh()
local rechargeId = cfgInfo.recharge_id
if rechargeId then
self.buyBtnTx:setText(GFunc.getFormatPrice(rechargeId))
if self.actId ~= MAX_GIFT_ID then
self.textOrigin:setVisible(true)
local maxCfgInfo = PayManager:getGiftConfigInfo(self.actType, MAX_GIFT_ID)
if maxCfgInfo and maxCfgInfo.recharge_id then
self.textOrigin:setText(GFunc.getFormatPrice(maxCfgInfo.recharge_id))
end
self.buyBtnTx:setAnchoredPositionY(-8)
else
self.buyBtnTx:setAnchoredPositionY(6)
self.textOrigin:setVisible(false)
end
end
-- 上报

View File

@ -2,10 +2,19 @@ local ArenaGiftSellCell = class("ArenaGiftSellCell", BaseCell)
local MAX_REWARD_COUNT = 4
local BASE_CELL_HEIGHT = 320
local BG = {
[90102] = "assets/arts/textures/background/shop/arena_gift_banner_1.png",
[90202] = "assets/arts/textures/background/shop/arena_gift_banner_2.png",
[90302] = "assets/arts/textures/background/shop/arena_gift_banner_3.png",
[90402] = "assets/arts/textures/background/shop/arena_gift_banner_4.png",
}
function ArenaGiftSellCell:init()
local uiMap = self.baseObject:genAllChildren()
self.bg = uiMap["gift_cell.bg"]
self.bg:setTexture("assets/arts/textures/background/shop/shop_gift_banner_3.png")
if BG[DataManager.ArenaData:getGiftId()] then
self.bg:setTexture(BG[DataManager.ArenaData:getGiftId()])
end
self.leftArrow = uiMap["gift_cell.left_arrow"]
self.rightArrow = uiMap["gift_cell.right_arrow"]