界面处理

This commit is contained in:
xiekaidong 2023-09-15 20:46:20 +08:00
parent 8b6b8d2772
commit ea8b6f6214
3 changed files with 44 additions and 5 deletions

View File

@ -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

View File

@ -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

View File

@ -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