竞技场暂停界面

This commit is contained in:
xiekaidong 2023-07-04 15:03:37 +08:00
parent 2d9c5b02b8
commit 87cacec30c
6 changed files with 159 additions and 1 deletions

View File

@ -1,5 +1,10 @@
local LocalizationGlobalConst =
{
["ARENA_BATTLE_DESC_6"] = "ARENA_BATTLE_DESC_6",
["ARENA_BATTLE_DESC_7"] = "ARENA_BATTLE_DESC_7",
["ARENA_BATTLE_DESC_8"] = "ARENA_BATTLE_DESC_8",
["ARENA_BATTLE_DESC_9"] = "ARENA_BATTLE_DESC_9",
["ARENA_BATTLE_DESC_10"] = "ARENA_BATTLE_DESC_10",
SHOP_DESC_40 = "SHOP_DESC_40",
MAIN_BTN_1 = "MAIN_BTN_1",
QLT_DESC_1 = "QLT_DESC_1",

View File

@ -310,6 +310,12 @@ local localization_global =
["RATE_DESC_1"] = "您喜欢我们的游戏吗?",
["RATE_DESC_2"] = "稍后再说",
["ARENA_DESC_32"] = "购买入场券",
["ARENA_BATTLE_DESC_6"] = "竞技场暂停描述1",
["ARENA_BATTLE_DESC_7"] = "竞技场暂停描述2",
["ARENA_BATTLE_DESC_8"] = "竞技场暂停描述3",
["ARENA_BATTLE_DESC_9"] = "上一页",
["ARENA_BATTLE_DESC_10"] = "下一页",
}
return localization_global

View File

@ -111,6 +111,7 @@ GConst.TYPEOF_UNITY_CLASS = {
TEXT_ASSET = typeof(CS.UnityEngine.TextAsset),
LINE_RENDERER = typeof(CS.UnityEngine.LineRenderer),
UI_RECT_MASK_2D = typeof(CS.UnityEngine.UI.RectMask2D),
VIDEO_PLAYER = typeof(CS.UnityEngine.Video.VideoPlayer),
-- spine组件
SKELETON_GRAPHIC = typeof(CS.Spine.Unity.SkeletonGraphic),
SKELETON_ANIMATION = typeof(CS.Spine.Unity.SkeletonAnimation),

View File

@ -15,7 +15,11 @@ local BATTLE_CONTROLLER = {
}
function BattleManager:showPauseUI(battleType)
UIManager:showUI("app/ui/battle/battle_pause_ui", {battleType = battleType})
if battleType == BattleConst.BATTLE_TYPE.ARENA then
UIManager:showUI("app/ui/battle/battle_arena_pause_ui", {battleType = battleType})
else
UIManager:showUI("app/ui/battle/battle_pause_ui", {battleType = battleType})
end
end
function BattleManager:showBattleResultUI(battleType, rewards, combatReport, mysteryBoxIdx)

View File

@ -0,0 +1,132 @@
local BattleArenaPauseUI = class("BattleArenaPauseUI", BaseUI)
-- 响应安卓后退事件
function BattleArenaPauseUI:onPressBackspace()
self:closeUI()
end
function BattleArenaPauseUI:isFullScreen()
return false
end
function BattleArenaPauseUI:showCommonBG()
return false
end
function BattleArenaPauseUI:getPrefabPath()
return "assets/prefabs/ui/battle/battle_arena_pause_ui.prefab"
end
function BattleArenaPauseUI:ctor(params)
self.battleType = params.battleType
end
function BattleArenaPauseUI:onClose()
self:unloadRenderTexture()
end
function BattleArenaPauseUI:onLoadRootComplete()
self:_display()
self:_addListeners()
end
function BattleArenaPauseUI:_display()
local uiMap = self.root:genAllChildren()
self.videoNode = uiMap["battle_arena_pause_ui.skill_node.video_node"]
uiMap["battle_arena_pause_ui.skill_node.title"]:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_2))
uiMap["battle_arena_pause_ui.skill_node.last_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_BATTLE_DESC_9))
uiMap["battle_arena_pause_ui.skill_node.next_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_BATTLE_DESC_10))
self:loadRenderTexture()
self.curIndex = 1
self:showArenaTips()
end
function BattleArenaPauseUI:_addListeners()
local uiMap = self.root:genAllChildren()
uiMap["battle_arena_pause_ui.home_btn"]:addClickListener(function()
local params = {
content = I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_1),
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK_CANCEL,
okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK),
cancelText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_CANCEL),
okFunc = function()
ModuleManager.BattleManager:endBattleAndExit(true)
end,
}
GFunc.showMessageBox(params)
end)
uiMap["battle_arena_pause_ui.continue_btn"]:addClickListener(function()
self:closeUI()
end)
uiMap["battle_arena_pause_ui.skill_node.last_btn"]:addClickListener(function()
self.curIndex = math.max(1, self.curIndex - 1)
self:showArenaTips()
end)
uiMap["battle_arena_pause_ui.skill_node.next_btn"]:addClickListener(function()
self.curIndex = math.min(3, self.curIndex + 1)
self:showArenaTips()
end)
end
function BattleArenaPauseUI:showArenaTips()
local uiMap = self.root:genAllChildren()
for i = 1, 3 do
local obj = uiMap["battle_arena_pause_ui.skill_node.video_node.pause_video_0" .. i]
obj:setActive(i == self.curIndex)
local comp = obj:getComponent(GConst.TYPEOF_UNITY_CLASS.VIDEO_PLAYER)
if i == self.curIndex then
comp.targetTexture = self.renderTexture
comp:Play()
else
comp.targetTexture = nil
comp:Stop()
end
end
local lastBtn = uiMap["battle_arena_pause_ui.skill_node.last_btn"]
local nextBtn = uiMap["battle_arena_pause_ui.skill_node.next_btn"]
local str
if self.curIndex == 1 then
str = I18N:getGlobalText(I18N.GlobalConst.ARENA_BATTLE_DESC_6)
lastBtn:setActive(false)
nextBtn:setActive(true)
nextBtn:setAnchoredPositionX(0)
elseif self.curIndex == 2 then
str = I18N:getGlobalText(I18N.GlobalConst.ARENA_BATTLE_DESC_7)
lastBtn:setActive(true)
nextBtn:setActive(true)
lastBtn:setAnchoredPositionX(-137.5)
nextBtn:setAnchoredPositionX(137.5)
else
str = I18N:getGlobalText(I18N.GlobalConst.ARENA_BATTLE_DESC_8)
lastBtn:setActive(true)
nextBtn:setActive(false)
lastBtn:setAnchoredPositionX(0)
end
uiMap["battle_arena_pause_ui.skill_node.desc"]:setText(str)
self.videoNode:setVisible(true)
end
function BattleArenaPauseUI:loadRenderTexture()
if not self.renderTexture then
local descriptor = CS.UnityEngine.RenderTextureDescriptor(589, 522)
descriptor.depthBufferBits = GConst.DEPTH_BUFFER
self.renderTexture = CS.UnityEngine.RenderTexture.GetTemporary(descriptor)
self.renderTexture.antiAliasing = 4
self.videoNode:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_RAW_IMAGE).texture = self.renderTexture
end
end
function BattleArenaPauseUI:unloadRenderTexture()
if self.renderTexture then
CS.UnityEngine.RenderTexture.ReleaseTemporary(self.renderTexture)
self.renderTexture = nil
end
end
return BattleArenaPauseUI

View File

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