This commit is contained in:
puxuan 2025-10-29 15:16:51 +08:00
parent cd58359de1
commit 200598d7e0
13 changed files with 277 additions and 15 deletions

View File

@ -37,6 +37,14 @@ function ShopManager:showVoucherReceiveUI()
UIManager:showUI("app/ui/shop/voucher_receive_ui")
end
-- 展示竞技场ad宝箱
function ShopManager:showArenaAdBoxUI(isWin)
local params = {
isWin = isWin
}
UIManager:showUI("app/ui/shop/box_hero_ui", {arena = params})
end
-- 宝箱奖励开箱界面 type,params,rewards
function ShopManager:showBoxOpenUI(params)
return UIManager:showUI("app/ui/shop/open_box_ui", params)

View File

@ -53,6 +53,9 @@ function ArenaMatchUI:onClose()
self:unscheduleGlobal(self.existSid)
self.existSid = nil
end
self.matchGrading:onClose()
self.selfGrading:onClose()
end
function ArenaMatchUI:onLoadRootComplete()

View File

@ -185,6 +185,12 @@ function ArenaUI:onRefresh()
self:refreshRightBtns()
self:refreshFightBtn()
self:refreshRedPoint()
local adBoxState = ModuleManager.ArenaManager:getAdBoxState()
if adBoxState ~= nil then
ModuleManager.ShopManager:showArenaAdBoxUI(adBoxState)
ModuleManager.ArenaManager:markAdBox(nil)
end
end
function ArenaUI:refreshBounty()

View File

@ -3,9 +3,17 @@ local ArenaGradingCell = class("ArenaGradingCell", BaseCell)
function ArenaGradingCell:init()
local uiMap = self:getUIMap()
self.imgGrading = uiMap["arena_grading_cell.img_grading"]
self.imgIdx = uiMap["arena_grading_cell.img_idx"]
-- self.imgGrading = uiMap["arena_grading_cell.img_grading"]
-- self.imgIdx = uiMap["arena_grading_cell.img_idx"]
self.txGrading = uiMap["arena_grading_cell.tx_grading"]
self.spineRoot = uiMap["arena_grading_cell.spine_root"]
end
function ArenaGradingCell:onClose()
if self.spineGrading then
self.spineGrading:destroy()
self.spineGrading = nil
end
end
function ArenaGradingCell:refresh(id)
@ -13,9 +21,18 @@ function ArenaGradingCell:refresh(id)
return
end
local gradingIconName = DataManager.ArenaData:getGradingIconName(id)
local gradingNumName = DataManager.ArenaData:getGradingNumName(id)
self.txGrading:setText(DataManager.ArenaData:getGradingName(id))
self.imgIdx:setSprite(GConst.ATLAS_PATH.ARENA, DataManager.ArenaData:getGradingNumName(id))
self.imgGrading:setSprite(GConst.ATLAS_PATH.ARENA, DataManager.ArenaData:getGradingIconName(id))
-- self.imgIdx:setSprite(GConst.ATLAS_PATH.ARENA, DataManager.ArenaData:getGradingNumName(id))
-- self.imgGrading:setSprite(GConst.ATLAS_PATH.ARENA, DataManager.ArenaData:getGradingIconName(id))
self.spineRoot:removeAllChildren()
SpineManager:loadUISpineWidgetAsync(gradingIconName.."_spine", self.spineRoot, function(spineObject)
self.spineGrading = spineObject
self.spineGrading:setSkin(gradingNumName)
self.spineGrading:playAnim("idle", true)
end)
end
return ArenaGradingCell

View File

@ -3,7 +3,7 @@ local ArenaGradingRewardCell = class("ArenaGradingRewardCell", BaseCell)
-- 光效
local EFFECT_LIGHT = "assets/prefabs/effects/ui/vfx_ui_arena_gift_b01.prefab"
local COMMON_GRADING_POSY = 242
local COMMON_GRADING_POSY = 222
local UNLOCK_GRADING_POSY = 346
function ArenaGradingRewardCell:init()
@ -63,7 +63,7 @@ function ArenaGradingRewardCell:refresh(id)
self.baseObject:setSizeDeltaY(DataManager.ArenaData:getGradingRewardItemHeight(self.id))
if DataManager.ArenaData:isGradingMin(self.id) then
self.gradingNode:setActive(true)
self.gradingNode:setAnchoredPositionY(COMMON_GRADING_POSY)
-- self.gradingNode:setAnchoredPositionY(COMMON_GRADING_POSY)
else
self.gradingNode:setActive(false)
end
@ -118,13 +118,16 @@ function ArenaGradingRewardCell:refresh(id)
reward:addClickListener(nil)
reward:setVisible(true)
reward:refreshByConfig(cfg.reward[idx], isReceived, isReceived)
reward:showLight(canGet and not isReceived, self.uiRoot)
-- reward:showLight(canGet and not isReceived, self.uiRoot)
if canGet and not isReceived then
reward:showFrameAnimation()
reward:addClickListener(function()
if DataManager.ArenaData:canGetGradingReward(self.id) and not DataManager.ArenaData:isReceivedGradingReward(self.id) then
ModuleManager.ArenaManager:reqGradingReward(self.id)
end
end)
else
reward:hideFrameAnimation()
end
else
reward:setVisible(false)

View File

@ -310,11 +310,11 @@ function BattleResultUI:hasArenaBoxNode()
end
function BattleResultUI:refreshArenaBoxNode()
self.arenaBoxNode:setVisible(false)
self.arenaBoxNode:setActive(false)
if not self:hasArenaBoxNode() then
return
end
self.arenaBoxNode:setVisible(true)
self.arenaBoxNode:setActive(true)
self.arenaBoxBtnGet:setActive(not self.getedArenaAdBox)
self.arenaBoxTxGet:setText(I18N:getGlobalText(I18N.GlobalConst.BTN_CLAIM))

View File

@ -121,7 +121,7 @@ function HeroCell:refreshBriefInfo(heroEntity)
self.unlockTx:setActive(false)
self:_refresh(id)
self.lvTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, level))
self.lvTx:setText(I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_26, level))
end
function HeroCell:refreshWithCfgId(id, isGray)
@ -129,7 +129,7 @@ function HeroCell:refreshWithCfgId(id, isGray)
self:_refresh(id, isGray)
local lv = heroInfo.begin_lv
self.lvTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, lv))
self.lvTx:setText(I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_26, lv))
self.lvTx:setActive(true)
self.unlockTx:setActive(false)
self.lvUpArrow:setActive(false)

View File

@ -17,10 +17,13 @@ function EquipInfoComp:init()
self.upBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_3))
self.autoWearBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_2))
self.currEquipEids = {}
self.equipCells = {}
self.suitTxs = {}
self.equipVfxs = {}
for i = 1, 6 do
self.suitTxs[i] = uiMap["equip_info.equip_node.up.suit_tx_" .. i]
self.equipVfxs[i] = uiMap["equip_info.equip_node.equip_cell_" .. i .. ".vfx_c1_ui_up_b06"]
self.equipCells[i] = uiMap["equip_info.equip_node.equip_cell_" .. i]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.EQUIP_CELL)
self.equipCells[i]:addClickListener(function()
local eid = DataManager.EquipData:getPartEquipUid(self.heroEntity:getMatchType(), i)
@ -84,6 +87,12 @@ function EquipInfoComp:setParentUI(ui)
end
function EquipInfoComp:setHeroData(heroEntity)
if not self.heroEntity or self.heroEntity ~= heroEntity then
for part = 1, 6 do
local eid = DataManager.EquipData:getPartEquipUid(heroEntity:getMatchType(), part)
self.currEquipEids[part] = eid
end
end
self.heroEntity = heroEntity
end
@ -105,9 +114,14 @@ function EquipInfoComp:refreshEquip()
self.equipNode:setActive(true)
for part = 1, 6 do
local eid = DataManager.EquipData:getPartEquipUid(slotId, part)
self.equipVfxs[part]:setActive(false)
if eid and eid > 0 then
local equipEntity = DataManager.EquipData:getEquipByUid(eid)
self.equipCells[part]:refresh(equipEntity, slotId)
if not self.currEquipEids[part] or self.currEquipEids[part] ~= eid then
self.equipVfxs[part]:setActive(true)
end
self.currEquipEids[part] = eid
else
self.equipCells[part]:refreshEmpty(part)
end

View File

@ -109,6 +109,7 @@ function HeroDetailUI:onLoadRootComplete()
self.skill = {}
self.skillIcon = {}
self.skillDescTxs = {}
self.skillVfxs = {}
self.skillNeedStarNodes = {}
self.skillNeedStarDescTx1s = {}
self.skillNeedStarStarImgs = {}
@ -121,6 +122,8 @@ function HeroDetailUI:onLoadRootComplete()
self.skillNeedStarDescTx1s[i] = uiMap["hero_detail_ui.top.bg_1.skill_node.skill_up_" .. i .. ".need_star_node.desc_tx_1"]
self.skillNeedStarStarImgs[i] = uiMap["hero_detail_ui.top.bg_1.skill_node.skill_up_" .. i .. ".need_star_node.star_img"]
self.skillNeedStarDescTx2s[i] = uiMap["hero_detail_ui.top.bg_1.skill_node.skill_up_" .. i .. ".need_star_node.desc_tx_2"]
self.skillVfxs[i] = uiMap["hero_detail_ui.top.bg_1.skill_node.skill_up_" .. i .. ".vfx_c1_ui_up_b05"]
self.skillVfxs[i]:setActive(false)
end
self.skillBg:addClickListener(function()
local cfg = ConfigManager:getConfig("skill")[self.heroEntity:getBaseSkill()]
@ -208,7 +211,7 @@ function HeroDetailUI:onRefresh(checkUp)
self:updateHero()
self:updateSide()
self:refreshPageInfo()
self:refreshSkillInfo()
self:refreshSkillInfo(checkUp)
self:checkLvUp(checkUp)
self.checkLvUpState = nil
end
@ -270,7 +273,7 @@ function HeroDetailUI:updateHero()
self.qltBgTx:setText(GFunc.getHeroQltStr(qlt))
end
function HeroDetailUI:refreshSkillInfo()
function HeroDetailUI:refreshSkillInfo(checkUp)
local skillId = self.heroEntity:getBaseSkill()
self.skillNameTx:setText(ModuleManager.HeroManager:getSkillName(skillId))
-- self.txSkill:setText(ModuleManager.HeroManager:getSkillDesc(skillId))
@ -278,9 +281,11 @@ function HeroDetailUI:refreshSkillInfo()
self.imgSkill:setSprite(GConst.ATLAS_PATH.ICON_SKILL, ModuleManager.HeroManager:getSkillIcon(skillId))
local skillList = self.heroEntity:getRogueSkillList()
local unlockIdx = self.heroEntity:getUnlockSkillIdx(checkUp)
local lv = self.heroEntity:getLv()
local star = self.heroEntity:getStar()
for i = 1, 4 do
self.skillVfxs[i]:setActive(false)
local skillInfo = skillList[i]
if skillInfo then
local skillUnlcokStar = skillInfo[1]
@ -294,6 +299,9 @@ function HeroDetailUI:refreshSkillInfo()
ModuleManager.HeroManager:showHeroSkillInfoUI(self.heroEntity, i, cfg.buff_id)
end)
skillBg:setTouchEnable(true)
if unlockIdx and unlockIdx == i then
self.skillVfxs[i]:setActive(true)
end
if skillUnlcokStar > star then
self.skillNeedStarNodes[i]:setActive(true)
local nextStar = (skillUnlcokStar - 1)%5 + 1

173
lua/app/ui/shop/box_hero_ui.lua Executable file
View File

@ -0,0 +1,173 @@
local BoxHeroUI = class("BoxHeroUI", BaseUI)
local TITLE_TEXT = {
[GConst.SummonConst.SUMMON_TYPE.LV_1] = I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_1), -- 普通宝箱
[GConst.SummonConst.SUMMON_TYPE.LV_2] = I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_2), -- 精致宝箱
[GConst.SummonConst.SUMMON_TYPE.LV_3] = I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_3), -- 珍贵宝箱
}
local ICON_NAME = {
[GConst.SummonConst.SUMMON_TYPE.LV_1] = "shop_chest_1",
[GConst.SummonConst.SUMMON_TYPE.LV_2] = "shop_chest_2",
[GConst.SummonConst.SUMMON_TYPE.LV_3] = "shop_chest_3"
}
local MAX_ITEM_NUM = 4
function BoxHeroUI:ctor(params)
params = params or {}
self.summonType = params.type
self.arenaBoxInfo = params.arena
end
function BoxHeroUI:isFullScreen()
return false
end
function BoxHeroUI:onPressBackspace()
self:closeUI()
end
function BoxHeroUI:getPrefabPath()
return "assets/prefabs/ui/shop/box_hero_ui.prefab"
end
function BoxHeroUI:onLoadRootComplete()
self.uiMap = self.root:genAllChildren()
self.uiMap["box_hero_ui.close_btn"]:addClickListener(function()
self:closeUI()
end)
self.titleTx = self.uiMap["box_hero_ui.bg.title"]
self.boxImg = self.uiMap["box_hero_ui.bg.box"]
-- 购买按钮
self.buyBtn = self.uiMap["box_hero_ui.bg.buy_btn"]
self.buyBtnTx = self.uiMap["box_hero_ui.bg.buy_btn.text"]
self.buyBtnIcon = self.uiMap["box_hero_ui.bg.buy_btn.icon"]
-- 视频按钮
self.adBtn = self.uiMap["box_hero_ui.bg.ad_btn"]
self.adBtnTx = self.uiMap["box_hero_ui.bg.ad_btn.tx_ad"]
self.adBtnIcon = self.uiMap["box_hero_ui.bg.ad_btn.img_ad"]
-- tag提示
self.tag = self.uiMap["box_hero_ui.bg.item_node.item_4.tag"]
self.txTag = self.uiMap["box_hero_ui.bg.item_node.item_4.tag.tx_tag"]
self.itemNodeLayout = self.uiMap["box_hero_ui.bg.item_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT)
self.itemNodeList = {}
self.itemCellList = {}
self.itemTextList = {}
self.itemHelpList = {}
for i = 1, MAX_ITEM_NUM do
table.insert(self.itemNodeList, self.uiMap["box_hero_ui.bg.item_" .. i])
table.insert(self.itemCellList, CellManager:addCellComp(self.uiMap["box_hero_ui.bg.item_".. i .. ".item_cell"], GConst.TYPEOF_LUA_CLASS.ITEM_CELL))
table.insert(self.itemTextList, self.uiMap["box_hero_ui.bg.item_".. i .. ".num"])
table.insert(self.itemHelpList, self.uiMap["box_hero_ui.bg.item_" .. i .. ".help"])
end
self.adBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_36))
GFunc.centerImgAndTx(self.adBtnIcon, self.adBtnTx, 5)
-- 奖励界面打开时 关闭此界面
self:addEventListener(EventManager.CUSTOM_EVENT.CLOSE_BOX_HERO_UI, function()
if self.arenaBoxInfo then
self:closeUI()
else
self:onRefresh()
end
end)
end
function BoxHeroUI:onRefresh()
self.buyBtn:setActive(false)
self.adBtn:setActive(false)
self.tag:setActive(false)
if self.summonType then
self:refreshCummonBox()
elseif self.arenaBoxInfo then
self:refreshArenaAdBox()
end
end
-- 刷新商城宝箱
function BoxHeroUI:refreshCummonBox()
self.buyBtn:setActive(true)
self.buyBtn:addClickListener(function()
self:onClickSummon()
end)
self.titleTx:setText(TITLE_TEXT[self.summonType])
self.boxImg:setSprite(GConst.ATLAS_PATH.SHOP, ICON_NAME[self.summonType])
self:showRewards(DataManager.SummonData:getSummonTotalRewardByLv(self.summonType))-- 本次实际奖励
local costItem, cost = DataManager.SummonData:getSummonCost(self.summonType)
if GFunc.checkCost(costItem.id, costItem.num, false) then
self.buyBtnIcon:setSprite(GFunc.getIconRes(costItem.id))
self.buyBtnTx:setText(costItem.num)
else
self.buyBtnIcon:setSprite(GFunc.getIconRes(cost.id))
self.buyBtnTx:setText(cost.num)
end
GFunc.centerImgAndTx(self.buyBtnIcon, self.buyBtnTx, 5)
end
-- 刷新竞技场ad宝箱
function BoxHeroUI:refreshArenaAdBox()
self.adBtn:setActive(true)
self.adBtn:addClickListener(function()
SDKManager:showFullScreenAds(BIReport.ADS_CLICK_TYPE.ARENA_AD_BOX, function ()
ModuleManager.ArenaManager:reqAdBoxReward(self.arenaBoxInfo.isWin)
end)
end)
self.tag:setActive(true)
self.txTag:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_35))
if self.arenaBoxInfo.isWin then
self.titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_33))
self.boxImg:setSprite(GConst.ATLAS_PATH.ARENA, "arena_dec_6")
else
self.titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_34))
self.boxImg:setSprite(GConst.ATLAS_PATH.ARENA, "arena_dec_6")
end
self:showRewards(DataManager.ArenaData:getAdBoxRewards(self.arenaBoxInfo.isWin))
end
function BoxHeroUI:showRewards(rewards)
for i = 1, MAX_ITEM_NUM do
if i <= #rewards then
self.itemNodeList[i]:setActive(true)
self.itemCellList[i]:refreshByCfg(rewards[i].id, 0)
self.itemCellList[i]:setNum("")
self.itemTextList[i]:setText(rewards[i].num)
self.itemCellList[i]:addClickListener(function()
ModuleManager.TipsManager:showRewardTips(rewards[i].id, GConst.REWARD_TYPE.ITEM, self.itemCellList[i]:getBaseObject())
end)
local type = ConfigManager:getConfig("item")[rewards[i].id].type
if type == 3 or type == 6 then
self.itemHelpList[i]:setActive(true)
self.itemHelpList[i]:addClickListener(function()
ModuleManager.TipsManager:showHeroFragmentTips(rewards[i].id)
end)
else
self.itemHelpList[i]:setActive(false)
end
else
self.itemNodeList[i]:setActive(false)
end
end
self.itemNodeLayout:RefreshLayout()
end
function BoxHeroUI:onClickSummon()
local costItem, cost = DataManager.SummonData:getSummonCost(self.summonType)
if GFunc.checkCost(costItem.id, costItem.num, false) then
ModuleManager.SummonManager:summon(self.summonType, 1)
elseif GFunc.checkCost(cost.id, cost.num, true) then
ModuleManager.SummonManager:summon(self.summonType, 2)
end
end
return BoxHeroUI

View File

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

View File

@ -642,8 +642,8 @@ function ArenaData:isGradingMin(id)
return false
end
local GRADING_REWARD_COMMON_SIZE = 220
local GRADING_REWARD_GRADING_SIZE = 460
local GRADING_REWARD_COMMON_SIZE = 200
local GRADING_REWARD_GRADING_SIZE = 442
local GRADING_REWARD_UNLOCK_SIZE = 570
-- 获取段位奖励项的高

View File

@ -665,6 +665,26 @@ function HeroEntity:getRogueSkillList()
return self.rogueSkillList
end
function HeroEntity:getUnlockSkillIdx(checkUp)
if not checkUp then
return
end
local count = 1
while true do
local ids = self.config["rouge_skill_" .. count]
if ids then
for i = #ids, 1, -1 do
if self.data.star == ids[i][1] then
return count
end
end
else
break
end
count = count + 1
end
end
function HeroEntity:getRogueSkillListBattle()
if not self.rogueSkillListBattle then
self.rogueSkillListBattle = {}