帮助界面

This commit is contained in:
xiekaidong 2023-09-16 20:17:13 +08:00
parent b60db0e3ef
commit e41a9b0b1a
5 changed files with 138 additions and 4 deletions

View File

@ -3,6 +3,9 @@ local LocalizationGlobalConst =
["ACT_PVP_DESC_19"] = "ACT_PVP_DESC_19", ["ACT_PVP_DESC_19"] = "ACT_PVP_DESC_19",
["ACT_PVP_DESC_20"] = "ACT_PVP_DESC_20", ["ACT_PVP_DESC_20"] = "ACT_PVP_DESC_20",
["ACT_PVP_DESC_21"] = "ACT_PVP_DESC_21",
["ACT_PVP_DESC_22"] = "ACT_PVP_DESC_22",
["ACT_PVP_DESC_23"] = "ACT_PVP_DESC_23",
["ACT_PVP_TALK_DESC_1"] ="ACT_PVP_TALK_DESC_1", ["ACT_PVP_TALK_DESC_1"] ="ACT_PVP_TALK_DESC_1",
["ACT_PVP_TALK_DESC_2"] ="ACT_PVP_TALK_DESC_2", ["ACT_PVP_TALK_DESC_2"] ="ACT_PVP_TALK_DESC_2",
["ACT_PVP_TALK_DESC_3"] ="ACT_PVP_TALK_DESC_3", ["ACT_PVP_TALK_DESC_3"] ="ACT_PVP_TALK_DESC_3",

View File

@ -602,14 +602,14 @@ local localization_global =
["ACT_PVP_DESC_19"] = "胜:{0}", ["ACT_PVP_DESC_19"] = "胜:{0}",
["ACT_PVP_DESC_20"] = "负:{0}", ["ACT_PVP_DESC_20"] = "负:{0}",
["ACT_PVP_DESC_21"] = "帮助文本1",
["ACT_PVP_DESC_22"] = "帮助文本2",
["ACT_PVP_DESC_23"] = "帮助文本3",
["ACT_PVP_TALK_DESC_1"] =" 梦魇随机对话1", ["ACT_PVP_TALK_DESC_1"] =" 梦魇随机对话1",
["ACT_PVP_TALK_DESC_2"] =" 梦魇随机对话2", ["ACT_PVP_TALK_DESC_2"] =" 梦魇随机对话2",
["ACT_PVP_TALK_DESC_3"] =" 梦魇随机对话3", ["ACT_PVP_TALK_DESC_3"] =" 梦魇随机对话3",
["ACT_PVP_TALK_DESC_4"] =" 梦魇随机对话4", ["ACT_PVP_TALK_DESC_4"] =" 梦魇随机对话4",
["ACT_PVP_TALK_DESC_5"] =" 梦魇随机对话5", ["ACT_PVP_TALK_DESC_5"] =" 梦魇随机对话5",
["ACT_PVP_TALK_DESC_6"] ="梦魇随机对话胜利1", ["ACT_PVP_TALK_DESC_6"] ="梦魇随机对话胜利1",
["ACT_PVP_TALK_DESC_7"] ="梦魇随机对话胜利2", ["ACT_PVP_TALK_DESC_7"] ="梦魇随机对话胜利2",
["ACT_PVP_TALK_DESC_8"] ="梦魇随机对话失败1", ["ACT_PVP_TALK_DESC_8"] ="梦魇随机对话失败1",

View File

@ -38,7 +38,7 @@ function ActPvpManager:showMatchResultUI()
end end
function ActPvpManager:showHelpUI() function ActPvpManager:showHelpUI()
UIManager:showUI("app/ui/activity/act_pvp/act_pvp_help_ui")
end end
function ActPvpManager:showSelectUI() function ActPvpManager:showSelectUI()

View File

@ -0,0 +1,121 @@
local ActPvpHelpUI = class("ActPvpHelpUI", BaseUI)
-- 响应安卓后退事件
function ActPvpHelpUI:onPressBackspace()
self:closeUI()
end
function ActPvpHelpUI:isFullScreen()
return false
end
function ActPvpHelpUI:showCommonBG()
return false
end
function ActPvpHelpUI:getPrefabPath()
return "assets/prefabs/ui/activity/act_pvp/act_pvp_help_ui.prefab"
end
function ActPvpHelpUI:ctor()
end
function ActPvpHelpUI:onClose()
self:unloadRenderTexture()
end
function ActPvpHelpUI:onLoadRootComplete()
self:_display()
self:_addListeners()
end
function ActPvpHelpUI:_display()
local uiMap = self.root:genAllChildren()
self.videoNode = uiMap["act_pvp_help_ui.skill_node.video_node"]
uiMap["act_pvp_help_ui.skill_node.title"]:setText(I18N:getGlobalText(I18N.GlobalConst.COLLECTION_DESC_11))
uiMap["act_pvp_help_ui.skill_node.last_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_BATTLE_DESC_9))
uiMap["act_pvp_help_ui.skill_node.next_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_BATTLE_DESC_10))
self:loadRenderTexture()
self.curIndex = 1
self:showArenaTips()
end
function ActPvpHelpUI:_addListeners()
local uiMap = self.root:genAllChildren()
uiMap["act_pvp_help_ui.close_btn"]:addClickListener(function()
self:closeUI()
end)
uiMap["act_pvp_help_ui.skill_node.last_btn"]:addClickListener(function()
self.curIndex = math.max(1, self.curIndex - 1)
self:showArenaTips()
end)
uiMap["act_pvp_help_ui.skill_node.next_btn"]:addClickListener(function()
self.curIndex = math.min(3, self.curIndex + 1)
self:showArenaTips()
end)
end
function ActPvpHelpUI:showArenaTips()
local uiMap = self.root:genAllChildren()
for i = 1, 3 do
local obj = uiMap["act_pvp_help_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["act_pvp_help_ui.skill_node.last_btn"]
local nextBtn = uiMap["act_pvp_help_ui.skill_node.next_btn"]
local str
if self.curIndex == 1 then
str = I18N:getGlobalText(I18N.GlobalConst.ACT_PVP_DESC_21)
lastBtn:setActive(false)
nextBtn:setActive(true)
nextBtn:setAnchoredPositionX(0)
elseif self.curIndex == 2 then
str = I18N:getGlobalText(I18N.GlobalConst.ACT_PVP_DESC_22)
lastBtn:setActive(true)
nextBtn:setActive(true)
lastBtn:setAnchoredPositionX(-137.5)
nextBtn:setAnchoredPositionX(137.5)
else
str = I18N:getGlobalText(I18N.GlobalConst.ACT_PVP_DESC_23)
lastBtn:setActive(true)
nextBtn:setActive(false)
lastBtn:setAnchoredPositionX(0)
end
local descObj = uiMap["act_pvp_help_ui.skill_node.scrollrect.viewport.desc"]
descObj:setText(str)
descObj:setSizeDeltaY(descObj:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).preferredHeight)
descObj:setAnchoredPositionY(0)
self.videoNode:setVisible(true)
end
function ActPvpHelpUI: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 ActPvpHelpUI:unloadRenderTexture()
if self.renderTexture then
CS.UnityEngine.RenderTexture.ReleaseTemporary(self.renderTexture)
self.renderTexture = nil
end
end
return ActPvpHelpUI

View File

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