From 592eb102ef5f02d379624702f6f450abc2c39e35 Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Wed, 5 Jul 2023 21:01:18 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AB=9E=E6=8A=80=E5=9C=BA=E5=BC=B9=E5=87=BA?= =?UTF-8?q?=E7=A4=BC=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/config/strings/cn/global.lua | 1 + lua/app/ui/arena/arena_pop_gift_ui.lua | 52 ++++++++++++------- lua/app/ui/shop/cell/arena_gift_sell_cell.lua | 11 +++- 3 files changed, 44 insertions(+), 20 deletions(-) diff --git a/lua/app/config/strings/cn/global.lua b/lua/app/config/strings/cn/global.lua index 700ebe43..eb646cce 100644 --- a/lua/app/config/strings/cn/global.lua +++ b/lua/app/config/strings/cn/global.lua @@ -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 \ No newline at end of file diff --git a/lua/app/ui/arena/arena_pop_gift_ui.lua b/lua/app/ui/arena/arena_pop_gift_ui.lua index e5b32d86..01652f19 100644 --- a/lua/app/ui/arena/arena_pop_gift_ui.lua +++ b/lua/app/ui/arena/arena_pop_gift_ui.lua @@ -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 -- 上报 diff --git a/lua/app/ui/shop/cell/arena_gift_sell_cell.lua b/lua/app/ui/shop/cell/arena_gift_sell_cell.lua index afcacfdb..e42274fa 100644 --- a/lua/app/ui/shop/cell/arena_gift_sell_cell.lua +++ b/lua/app/ui/shop/cell/arena_gift_sell_cell.lua @@ -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"]