PGRData/Resources/Scripts/XUi/XUiDraw/XUiDrawTools/XUiDrawBox.lua
2022-12-26 14:06:01 +05:30

28 lines
No EOL
601 B
Lua

local boxAnim
local animOpen = "BoxBegan"
local animReset = "BoxReset"
local animLength --ms
local Init = function(panelAnim)
local box = panelAnim:GetChild(0)
boxAnim = box:GetComponent("Animation")
local clip = boxAnim:GetClip(animOpen)
animLength = math.floor(clip.length * 1000)
end
local OpenBox = function(cb)
boxAnim:Play(animOpen)
XScheduleManager.ScheduleOnce(cb, animLength)
end
local ResetBox = function()
boxAnim:Play(animReset)
end
local XUiDrawBox = {}
XUiDrawBox.Init = Init
XUiDrawBox.OpenBox = OpenBox
XUiDrawBox.ResetBox = ResetBox
return XUiDrawBox