From ea8b6f6214d94ff186107a2d837d925d9ef89090 Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Fri, 15 Sep 2023 20:46:20 +0800 Subject: [PATCH] =?UTF-8?q?=E7=95=8C=E9=9D=A2=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../activity/act_pvp/act_pvp_manager.lua | 2 +- .../ui/activity/act_pvp/act_pvp_rank_ui.lua | 2 +- .../ui/activity/act_pvp/act_pvp_select_ui.lua | 45 +++++++++++++++++-- 3 files changed, 44 insertions(+), 5 deletions(-) diff --git a/lua/app/module/activity/act_pvp/act_pvp_manager.lua b/lua/app/module/activity/act_pvp/act_pvp_manager.lua index f52eb529..3cc6309f 100644 --- a/lua/app/module/activity/act_pvp/act_pvp_manager.lua +++ b/lua/app/module/activity/act_pvp/act_pvp_manager.lua @@ -158,8 +158,8 @@ end function ActPvpManager:rspRefreshHero(result) if result.err_code == GConst.ERROR_STR.SUCCESS then - DataManager.ActPvpData:updateSelectInfo(result.pair_id, result.next_select_four_id) DataManager.ActPvpData:addFlushCount() + DataManager.ActPvpData:updateSelectInfo(result.pair_id, result.next_select_four_id) end end diff --git a/lua/app/ui/activity/act_pvp/act_pvp_rank_ui.lua b/lua/app/ui/activity/act_pvp/act_pvp_rank_ui.lua index 2335501b..d3d18cec 100644 --- a/lua/app/ui/activity/act_pvp/act_pvp_rank_ui.lua +++ b/lua/app/ui/activity/act_pvp/act_pvp_rank_ui.lua @@ -249,7 +249,7 @@ function ActPvpRankUI:refreshMyRankInfo() winDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_PVP_DESC_17)) else local got = DataManager.ActPvpData:getGotRankReward() - local rewards = ataManager.ActPvpData:getRankRewards(myRank) + local rewards = DataManager.ActPvpData:getRankRewards(myRank) for index, cell in ipairs(self.selfRewardCells) do if rewards and rewards[index] then diff --git a/lua/app/ui/activity/act_pvp/act_pvp_select_ui.lua b/lua/app/ui/activity/act_pvp/act_pvp_select_ui.lua index 7a9832d8..63045098 100644 --- a/lua/app/ui/activity/act_pvp/act_pvp_select_ui.lua +++ b/lua/app/ui/activity/act_pvp/act_pvp_select_ui.lua @@ -1,5 +1,20 @@ local ActPvpSelectUI = class("ActPvpSelectUI", BaseUI) +local INFO_BG = { + [1] = "common_board_quality_2", + [2] = "common_board_quality_2", + [3] = "common_board_quality_3", + [4] = "common_board_quality_4", +} + +local BG_SPINE = { + [GConst.BattleConst.ELEMENT_TYPE.RED] = "ui_hero_red", + [GConst.BattleConst.ELEMENT_TYPE.YELLOW] = "ui_hero_yellow", + [GConst.BattleConst.ELEMENT_TYPE.GREEN] = "ui_hero_green", + [GConst.BattleConst.ELEMENT_TYPE.BLUE] = "ui_hero_blue", + [GConst.BattleConst.ELEMENT_TYPE.PURPLE] = "ui_hero_purple", +} + local SIMPLE_HERO_CELL = "app/ui/activity/act_pvp/cell/simple_hero_cell" function ActPvpSelectUI:getPrefabPath() @@ -24,7 +39,9 @@ function ActPvpSelectUI:_display() local heroCfg = ConfigManager:getConfig("hero")[heroId] local matchType = heroCfg and heroCfg.position or GConst.BattleConst.ELEMENT_TYPE.RED local matchStr = ModuleManager.HeroManager:getMatchTypeName(matchType, true) - uiMap["act_pvp_select_ui.bg.title_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_PVP_DESC_8, matchStr)) + local txTitle = uiMap["act_pvp_select_ui.bg.title_tx"] + txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_PVP_DESC_8, matchStr)) + txTitle:setSizeDeltaX(txTitle:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).preferredWidth) uiMap["act_pvp_select_ui.bg.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_PVP_DESC_9)) uiMap["act_pvp_select_ui.bg.hero_cell_1.select_btn.tx_desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_PVP_DESC_12)) uiMap["act_pvp_select_ui.bg.hero_cell_2.select_btn.tx_desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_PVP_DESC_12)) @@ -35,7 +52,12 @@ function ActPvpSelectUI:_display() local unit = {} local prefix = "act_pvp_select_ui.bg.hero_cell_" .. i unit.node = uiMap[prefix] + unit.spineBg = uiMap[prefix .. ".ui_spine_obj_bg"] + unit.spineHero = uiMap[prefix .. ".ui_spine_obj_hero"] unit.simpleHeroCell = CellManager:addCellComp(uiMap[prefix .. ".simple_hero_cell"], SIMPLE_HERO_CELL) + unit.info = uiMap[prefix .. ".info"] + unit.matchIcon = uiMap[prefix .. ".info.icon"] + unit.name = uiMap[prefix .. ".info.name"] unit.nextNode = uiMap[prefix .. ".next_node"] unit.nextDesc = uiMap[prefix .. ".next_node.desc"] unit.nextBg1 = uiMap[prefix .. ".next_node.bg_1"] @@ -113,6 +135,20 @@ function ActPvpSelectUI:refreshSelectInfo() local heroEntity = DataManager.HeroData:getEntity({id = heroId, level = DataManager.ActPvpData:getHeroLv()}) unit.node:setVisible(true) unit.simpleHeroCell:refresh(heroEntity) + unit.info:setSprite(GConst.ATLAS_PATH.COMMON, INFO_BG[heroEntity:getQlt()]) + local heroInfo = heroEntity:getConfig() + unit.matchIcon:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.HeroConst.MATCH_ICON_NAME[heroInfo.position]) + unit.name:setText(heroEntity:getName()) + unit.spineBg:setVisible(false) + unit.spineBg:loadAssetAsync(BG_SPINE[heroEntity:getMatchType()], function() + unit.spineBg:setVisible(true, 1.8) + unit.spineBg:playAnim("idle", true, true, true) + end) + unit.spineHero:setVisible(false) + unit.spineHero:loadAssetAsync(heroEntity:getModelId(), function() + unit.spineHero:setVisible(true) + unit.spineHero:playAnim("idle", true, true, true) + end, true) if nextId1 and nextId2 then unit.nextNode:setVisible(true) unit.nextDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_PVP_DESC_11)) @@ -162,17 +198,20 @@ function ActPvpSelectUI:rfreshRefreshBtns() local tx = uiMap["act_pvp_select_ui.bg.refresh_btn.tx_desc"] local txCost = uiMap["act_pvp_select_ui.bg.refresh_btn.tx_cost"] local imgCost = uiMap["act_pvp_select_ui.bg.refresh_btn.img_cost"] + local ad = uiMap["act_pvp_select_ui.bg.refresh_btn.img_ad"] if DataManager.ActPvpData:getCanAdFlush() then tx:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_PVP_DESC_10)) txCost:setVisible(false) imgCost:setVisible(false) + ad:setVisible(true) else tx:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_3)) - txCost:setVisible(false) - imgCost:setVisible(false) + txCost:setVisible(true) + imgCost:setVisible(true) txCost:setText(DataManager.ActPvpData:getFlushCost().num) GFunc.centerImgAndTx(imgCost, txCost, 5) + ad:setVisible(false) end end