File size: 670 Bytes
b6a38d7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
DefineClass.XSubtitles =
{
__parents = { "XDialog" },
}
function XSubtitles:SetSubtitles(text)
self.idText:SetText(text)
end
-----------------------------------------------------
MapVar("g_SubtitlesThread", false)
function ShowSubtitles(text, duration, delay)
if g_SubtitlesThread then HideSubtitles() end
local dlg = OpenDialog("XSubtitles")
g_SubtitlesThread = CreateMapRealTimeThread(function()
if delay then
Sleep(delay)
end
dlg:SetSubtitles(text)
Sleep(duration)
CloseDialog("XSubtitles")
g_SubtitlesThread = false
end)
end
function HideSubtitles()
DeleteThread(g_SubtitlesThread)
g_SubtitlesThread = false
CloseDialog("XSubtitles")
end |