This commit is contained in:
puxuan 2025-11-06 17:55:02 +08:00
parent 8c370ef327
commit 2e15e45ae0
8 changed files with 187 additions and 12 deletions

View File

@ -1,6 +1,8 @@
-- 竞技场:匹配
local ArenaMatchUI = class("ArenaMatchUI", BaseUI)
local HERO_FORMATION_COMP = "app/ui/arena/comp/hero_formation_comp"
function ArenaMatchUI:isFullScreen()
return true
end
@ -75,18 +77,21 @@ function ArenaMatchUI:onLoadRootComplete()
self.matchResult = uiMap["arena_match_ui.match_result"]
self.btnClose = uiMap["arena_match_ui.match_result.btn_close"]
self.matchAnimator = self.matchResult:getComponent(GConst.TYPEOF_UNITY_CLASS.ANIMATOR)
self.matchAnimator.enabled = false
-- 对手信息
self.matchAvatar = CellManager:addCellComp(uiMap["arena_match_ui.match_result.left_node.match.info.player_head_cell"], GConst.TYPEOF_LUA_CLASS.PLAYER_HEAD_CELL)
self.matchTxName = uiMap["arena_match_ui.match_result.left_node.match.info.tx_name"]
self.matchTxLevel = uiMap["arena_match_ui.match_result.left_node.match.info.tx_level"]
self.matchGrading = uiMap["arena_match_ui.match_result.left_node.match.arena_grading_cell"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.ARENA_GRADING_CELL)
self.matchHeroFormationComp = uiMap["arena_match_ui.match_result.left_node.match.formation.hero_formation_comp"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.HERO_FORMATION_COMP)
self.matchHeroFormationComp = uiMap["arena_match_ui.match_result.left_node.match.formation.hero_formation_comp"]:addLuaComponent(HERO_FORMATION_COMP)
self.matchHeroFormationComp:setCellActive(false)
-- 自己信息
self.selfAvatar = CellManager:addCellComp(uiMap["arena_match_ui.match_result.right_node.self.info.player_head_cell"], GConst.TYPEOF_LUA_CLASS.PLAYER_HEAD_CELL)
self.selfTxName = uiMap["arena_match_ui.match_result.right_node.self.info.tx_name"]
self.selfTxLevel = uiMap["arena_match_ui.match_result.right_node.self.info.tx_level"]
self.selfGrading = uiMap["arena_match_ui.match_result.right_node.self.arena_grading_cell"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.ARENA_GRADING_CELL)
self.selfHeroFormationComp = uiMap["arena_match_ui.match_result.right_node.self.formation.hero_formation_comp"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.HERO_FORMATION_COMP)
self.selfHeroFormationComp = uiMap["arena_match_ui.match_result.right_node.self.formation.hero_formation_comp"]:addLuaComponent(HERO_FORMATION_COMP)
self.selfHeroFormationComp:setCellActive(false)
-- 功能按钮
self.btnStart = uiMap["arena_match_ui.match_result.btn_start"]
self.imgCost = uiMap["arena_match_ui.match_result.btn_start.cost.img_cost"]
@ -130,9 +135,11 @@ function ArenaMatchUI:onRefresh()
ModuleManager.ArenaManager:reqMatch()
self:showMatchLoading()
else
self:showMatchResult()
self.matchSpine:setActive(true)
self.matchSpine:playAnimComplete("die", false, true, function()
self:showMatchResult()
self:showMatchResultBtn()
self.matchAnimator.enabled = true
end)
end
end
@ -157,9 +164,11 @@ function ArenaMatchUI:showMatchLoading()
self:unscheduleGlobal(self.waitSid)
end
self.waitSid = self:performWithDelayGlobal(function()
self:showMatchResult()
self.matchSpine:setActive(true)
self.matchSpine:playAnimComplete("die", false, true, function()
self:showMatchResult()
self:showMatchResultBtn()
self.matchAnimator.enabled = true
end)
end, 1.5)
end
@ -173,9 +182,11 @@ function ArenaMatchUI:showMatchResult()
end
self.matchLoading:setActive(false)
self.matchResult:setActive(true)
self.matchResult:setActive(false)
self.btnStart:setActive(false)
self.btnRematch:setActive(false)
self.btnFormation:setActive(false)
UIManager:setBarsVisible(self, true)
self.vsVfx:setActive(true)
-- self.spineVS:playAnimComplete("born", false, true, function()
-- self.spineVS:playAnim("idle", true, true)
@ -241,6 +252,16 @@ function ArenaMatchUI:showMatchResult()
self:refreshCountdown()
end
function ArenaMatchUI:showMatchResultBtn()
self.matchResult:setActive(true)
self.vsVfx:setActive(true)
self:performWithDelayGlobal(function()
self.btnStart:setActive(true)
self.btnRematch:setActive(true)
self.btnFormation:setActive(true)
end, 0.4)
end
function ArenaMatchUI:refreshCountdown()
self.freeRematchCD = self.freeRematchCD - 1
if self.freeRematchCD <= 0 then

View File

@ -0,0 +1,31 @@
local HeroCell = class("HeroCell", BaseCell)
function HeroCell:init()
local uiMap = self.baseObject:genAllChildren()
-- 通用
self.icon = uiMap["hero_cell.hero_bg.icon"]
self.matchImg = uiMap["hero_cell.hero_bg.match_img"]
self.lvTx = uiMap["hero_cell.hero_bg.lv_tx"]
self.nameTx = uiMap["hero_cell.hero_bg.tx_name"]
self.starComp = uiMap["hero_cell.hero_bg.star_cell"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.STAR_CELL)
end
function HeroCell:refreshBriefInfo(heroEntity)
local id = heroEntity:getCfgId()
local level = heroEntity:getLv()
local star = heroEntity:getStar()
self.starComp:refresh(star)
local matchType = heroEntity:getMatchType()
self.matchImg:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.HeroConst.MATCH_ICON_NAME[matchType])
local avatarName = DataManager.PlayerData:getAvatarIconId(id)
self.icon:setSprite(GConst.ATLAS_PATH.ICON_AVATAR, avatarName)
self.nameTx:setText(ModuleManager.HeroManager:getHeroName(id))
self.lvTx:setText(I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_26, level))
end
function HeroCell:setActive(active)
self.baseObject:setActive(active)
end
return HeroCell

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 17c15ae08807840d5a89e68712fcd103
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 61e7efec58d324899a6cbee9f2267e45
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,88 @@
-- 英雄编队
local HeroFormationComp = class("HeroFormationComp", LuaComponent)
local HERO_CELL = "app/ui/arena/cell/hero_cell"
function HeroFormationComp:init()
local uiMap = self.baseObject:genAllChildren()
self.heroCells = {
uiMap["hero_formation_comp.hero_cell_1"]:addLuaComponent(HERO_CELL),
uiMap["hero_formation_comp.hero_cell_2"]:addLuaComponent(HERO_CELL),
uiMap["hero_formation_comp.hero_cell_3"]:addLuaComponent(HERO_CELL),
uiMap["hero_formation_comp.hero_cell_4"]:addLuaComponent(HERO_CELL),
uiMap["hero_formation_comp.hero_cell_5"]:addLuaComponent(HERO_CELL),
}
-- self:setFormationActive(true)
end
-- 显示英雄升级/使用等等信息
-- function HeroFormationComp:refresh()
-- local formation = DataManager.FormationData:getStageFormation()
-- for i, heroCell in ipairs(self.heroCells) do
-- if formation[i] then
-- local heroEntity = DataManager.HeroData:getHeroById(formation[i])
-- if heroEntity then
-- heroCell:setVisible(true, 0.6)
-- heroCell:refresh(heroEntity)
-- heroCell:addClickListener(function()
-- ModuleManager.HeroManager:showHeroDetailUI(heroEntity:getCfgId())
-- end)
-- else
-- heroCell:setVisible(false)
-- end
-- else
-- heroCell:setVisible(false)
-- end
-- end
-- end
-- function HeroFormationComp:refreshByFormation(formation)
-- for i, heroCell in ipairs(self.heroCells) do
-- if formation[i] then
-- local heroEntity = DataManager.HeroData:getHeroById(formation[i])
-- if heroEntity then
-- heroCell:setVisible(true, 0.6)
-- heroCell:refresh(heroEntity)
-- heroCell:addClickListener(function()
-- ModuleManager.HeroManager:showHeroDetailUI(heroEntity:getCfgId())
-- end)
-- else
-- heroCell:setVisible(false)
-- end
-- else
-- heroCell:setVisible(false)
-- end
-- end
-- end
function HeroFormationComp:refreshByEntitys(formation)
for i, heroCell in ipairs(self.heroCells) do
local heroEntity = formation[i]
if heroEntity then
heroCell:setActive(true)
heroCell:refreshBriefInfo(heroEntity)
heroCell:addClickListener(function()
ModuleManager.HeroManager:showHeroDetailUI(heroEntity:getCfgId(), true, heroEntity)
end)
else
heroCell:setActive(false)
end
end
end
function HeroFormationComp:setCellActive(active)
for i, heroCell in ipairs(self.heroCells) do
heroCell:setActive(active)
end
end
-- function HeroFormationComp:setFormationActive(active)
-- self.baseObject:setActive(active)
-- end
-- function HeroFormationComp:getFormationPosY()
-- return self.baseObject:fastGetAnchoredPositionY()
-- end
return HeroFormationComp

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 7b608aa45c1604b518e7f1e39e3169f9
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -179,8 +179,8 @@ function BattleResultUI:onRefresh()
self:refreshUnitInfo()
self:refreshRewards()
self:refreshArenaNode()
self:refreshArenaBoxNode()
self:refreshDoubleNode()
self:refreshArenaBoxNode()
end
function BattleResultUI:refreshVictoryNode()
@ -316,9 +316,14 @@ end
function BattleResultUI:refreshArenaBoxNode()
self.arenaBoxNode:setActive(false)
if self.battleType ~= GConst.BattleConst.BATTLE_TYPE.ARENA then
return
end
if not self:hasArenaBoxNode() then
self.okBtn:setActive(true)
return
end
self.okBtn:setActive(false)
self.arenaBoxNode:setActive(true)
self.arenaBoxBtnGet:setActive(not self.getedArenaAdBox)
self.arenaBoxTxGet:setText(I18N:getGlobalText(I18N.GlobalConst.BTN_CLAIM))

View File

@ -1,15 +1,17 @@
-- 英雄编队
local HeroFormationComp = class("HeroFormationComp", LuaComponent)
local HERO_CELL = "app/ui/arena/cell/hero_cell"
function HeroFormationComp:init()
local uiMap = self.baseObject:genAllChildren()
self.heroCells = {
uiMap["hero_formation_comp.hero_cell_1"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.HERO_CELL),
uiMap["hero_formation_comp.hero_cell_2"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.HERO_CELL),
uiMap["hero_formation_comp.hero_cell_3"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.HERO_CELL),
uiMap["hero_formation_comp.hero_cell_4"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.HERO_CELL),
uiMap["hero_formation_comp.hero_cell_5"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.HERO_CELL),
uiMap["hero_formation_comp.hero_cell_1"]:addLuaComponent(HERO_CELL),
uiMap["hero_formation_comp.hero_cell_2"]:addLuaComponent(HERO_CELL),
uiMap["hero_formation_comp.hero_cell_3"]:addLuaComponent(HERO_CELL),
uiMap["hero_formation_comp.hero_cell_4"]:addLuaComponent(HERO_CELL),
uiMap["hero_formation_comp.hero_cell_5"]:addLuaComponent(HERO_CELL),
}
self:setFormationActive(true)
end