Files
Endfield-Data/LuaScripts/UI/Panels/DialogTimelineMask/DialogTimelineMaskCtrl.lua
2025-12-02 20:37:18 +07:00

75 lines
1.6 KiB
Lua

local uiCtrl = require_ex('UI/Panels/Base/UICtrl')
local PANEL_ID = PanelId.DialogTimelineMask
DialogTimelineMaskCtrl = HL.Class('DialogTimelineMaskCtrl', uiCtrl.UICtrl)
DialogTimelineMaskCtrl.s_messages = HL.StaticField(HL.Table) << {
}
DialogTimelineMaskCtrl.OnCreate = HL.Override(HL.Any) << function(self, arg)
end
DialogTimelineMaskCtrl._InitBorderMask = HL.Method() << function(self, arg)
local useBlack = true
if GameWorld.dialogManager.dialogTree then
local dialogType = GameWorld.dialogManager.dialogTree.dialogType
local normal = dialogType == Const.DialogType.Normal
if normal then
useBlack = false
end
else
useBlack = false
end
if useBlack then
local screenWidth = Screen.width
local screenHeight = Screen.height
local maxScreenWidth = FMVUtils.MAX_FMV_ASPECT_RATIO * screenHeight
local borderSize = (screenWidth - maxScreenWidth) / 2
local ratio = self.view.transform.rect.width / Screen.width
self.view.leftBorder.gameObject:SetActive(true)
self.view.rightBorder.gameObject:SetActive(true)
self.view.leftBorder.transform.sizeDelta = Vector2(borderSize, screenHeight) * ratio
self.view.rightBorder.transform.sizeDelta = Vector2(borderSize, screenHeight) * ratio
else
self.view.leftBorder.gameObject:SetActive(false)
self.view.rightBorder.gameObject:SetActive(false)
end
end
DialogTimelineMaskCtrl.OnShow = HL.Override() << function(self)
self:_InitBorderMask()
end
HL.Commit(DialogTimelineMaskCtrl)