File size: 3,048 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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
DefineClass.SplashScreen = {
__parents = {"XDialog"},
Background = RGB(0, 0, 0),
HandleMouse = true,
MouseCursor = const.DefaultMouseCursor,
}
function SplashScreen:Init()
XAspectWindow:new({
Id = "idContent",
Fit = "FitInSafeArea",
}, self)
end
function SplashScreen:OnMouseButtonDown(pt, button)
if button == "L" then
self:Close()
end
return "break"
end
function SplashScreen:OnShortcut(shortcut, source, ...)
if shortcut == "ButtonB" or shortcut == "Escape" then
self:Close()
return "break"
end
XDialog.OnShortcut(self, shortcut, source, ...)
end
DefineClass.XSplashImage = {
__parents = { "SplashScreen" },
Id = "idXSplashScreenImage",
}
function XSplashImage:Init()
XImage:new({
Id = "idImage",
Image = self.image,
HAlign = "center",
VAlign = "center",
ImageFit = "smallest",
FadeInTime = self.fadeInTime,
FadeOutTime = self.fadeOutTime,
}, self.idContent)
self:CreateThread("wait", function()
Sleep(self.fadeInTime)
Sleep(self.time)
self.idImage:Close()
Sleep(self.fadeOutTime)
self:Close()
end)
end
DefineClass.XSplashMovie = {
__parents = {"SplashScreen"},
Id = "idXSplashScreenMovie",
}
function XSplashMovie:Init()
local video = XVideo:new({
Id = "idMovie",
ZOrder = -1,
FileName = self.movie,
Sound = self.movie,
}, self.idContent)
video:SetAutoPlay(true)
video.OnEnd = function()
self:Close()
end
end
function SplashImage(image, fadeInTime, fadeOutTime, time, aspect)
local dlg = XSplashImage:new({
image = image,
fadeInTime = fadeInTime,
fadeOutTime = fadeOutTime,
time = time,
aspect = aspect,
}, terminal.desktop)
dlg:Open()
return dlg
end
function SplashMovie(movie, aspect)
local dlg = XSplashMovie:new({movie = movie, aspect = aspect}, terminal.desktop)
dlg:Open()
return dlg
end
DefineClass.XSplashText = {
__parents = { "SplashScreen" },
Id = "idXSplashScreenText",
}
function XSplashText:Init()
XText:new({
Id = "idText",
Text = self.text,
TextStyle = self.style,
Translate = true,
TextHAlign = "center",
HAlign = "center",
VAlign = "center",
Margins = box(300, 0, 300, 0),
FadeInTime = self.fadeInTime,
FadeOutTime = self.fadeOutTime,
}, self.idContent)
XText:new({
Id = "idGamepad",
TextStyle = self.style,
Translate = true,
HAlign = "right",
VAlign = "bottom",
Margins = box(0, 0, 80, 80),
ContextUpdateOnOpen = true,
OnContextUpdate = function(self)
self:SetVisible(GetUIStyleGamepad())
end,
}, self.idContent, "GamepadUIStyleChanged")
self.idGamepad:SetText(T(296331304655, "<style SkipHint><ButtonB> Skip</style>"))
self:CreateThread("wait", function()
Sleep(self.fadeInTime)
Sleep(self.time)
self.idGamepad:Close()
self.idText:Close()
Sleep(self.fadeOutTime)
self:Close()
end)
end
function SplashText(text, style, fadeInTime, fadeOutTime, time)
local dlg = XSplashText:new({
style = style,
fadeInTime = fadeInTime,
fadeOutTime = fadeOutTime,
time = time,
}, terminal.desktop)
dlg:Open()
dlg.idText:SetText(text)
return dlg
end |