帮助界面

This commit is contained in:
xiekaidong 2023-09-18 20:21:41 +08:00
parent eb95400b81
commit 531961e843

View File

@ -21,7 +21,6 @@ function ActPvpHelpUI:ctor()
end
function ActPvpHelpUI:onClose()
self:unloadRenderTexture()
end
function ActPvpHelpUI:onLoadRootComplete()
@ -36,9 +35,8 @@ function ActPvpHelpUI:_display()
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()
self:showTips()
end
function ActPvpHelpUI:_addListeners()
@ -49,28 +47,20 @@ function ActPvpHelpUI:_addListeners()
uiMap["act_pvp_help_ui.skill_node.last_btn"]:addClickListener(function()
self.curIndex = math.max(1, self.curIndex - 1)
self:showArenaTips()
self:showTips()
end)
uiMap["act_pvp_help_ui.skill_node.next_btn"]:addClickListener(function()
self.curIndex = math.min(3, self.curIndex + 1)
self:showArenaTips()
self:showTips()
end)
end
function ActPvpHelpUI:showArenaTips()
function ActPvpHelpUI:showTips()
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
obj:setVisible(i == self.curIndex)
end
local lastBtn = uiMap["act_pvp_help_ui.skill_node.last_btn"]
@ -98,24 +88,6 @@ function ActPvpHelpUI:showArenaTips()
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