Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/gui/pregame/mainmenu.js
Show All 27 Lines | function init(initData, hotloadData) | ||||
// Only show splash screen(s) once at startup, but not again after hotloading | // Only show splash screen(s) once at startup, but not again after hotloading | ||||
g_ShowSplashScreens = hotloadData ? hotloadData.showSplashScreens : initData && initData.isStartup; | g_ShowSplashScreens = hotloadData ? hotloadData.showSplashScreens : initData && initData.isStartup; | ||||
// Pick a random background and initialise it | // Pick a random background and initialise it | ||||
g_BackgroundLayerset = pickRandom(g_BackgroundLayerData); | g_BackgroundLayerset = pickRandom(g_BackgroundLayerData); | ||||
for (let i = 0; i < g_BackgroundLayerset.length; ++i) | for (let i = 0; i < g_BackgroundLayerset.length; ++i) | ||||
{ | { | ||||
let guiObj = Engine.GetGUIObjectByName("background["+i+"]"); | let guiObj = Engine.GetGUIObjectByName("background[" + i + "]"); | ||||
guiObj.hidden = false; | guiObj.hidden = false; | ||||
guiObj.sprite = g_BackgroundLayerset[i].sprite; | guiObj.sprite = g_BackgroundLayerset[i].sprite; | ||||
guiObj.z = i; | guiObj.z = i; | ||||
} | } | ||||
} | } | ||||
function getHotloadData() | function getHotloadData() | ||||
{ | { | ||||
return { "showSplashScreens": g_ShowSplashScreens }; | return { "showSplashScreens": g_ShowSplashScreens }; | ||||
} | } | ||||
function scrollBackgrounds() | function scrollBackgrounds() | ||||
{ | { | ||||
for (let i = 0; i < g_BackgroundLayerset.length; ++i) | for (let i = 0; i < g_BackgroundLayerset.length; ++i) | ||||
{ | { | ||||
let guiObj = Engine.GetGUIObjectByName("background["+i+"]"); | let guiObj = Engine.GetGUIObjectByName("background[" + i + "]"); | ||||
let screen = guiObj.parent.getComputedSize(); | let screen = guiObj.parent.getComputedSize(); | ||||
let h = screen.bottom - screen.top; | let h = screen.bottom - screen.top; | ||||
let w = h * 16/9; | let w = h * 16/9; | ||||
let iw = h * 2; | let iw = h * 2; | ||||
let offset = g_BackgroundLayerset[i].offset((Date.now() - g_T0) / 1000, w); | let offset = g_BackgroundLayerset[i].offset((Date.now() - g_T0) / 1000, w); | ||||
Show All 30 Lines | function formatUserReportStatus(status) | ||||
if (d[0] == "sending") | if (d[0] == "sending") | ||||
return sprintf(translate("uploading (%f%%)"), Math.floor(100 * d[1])); | return sprintf(translate("uploading (%f%%)"), Math.floor(100 * d[1])); | ||||
if (d[0] == "completed") | if (d[0] == "completed") | ||||
{ | { | ||||
let httpCode = d[1]; | let httpCode = d[1]; | ||||
if (httpCode == 200) | if (httpCode == 200) | ||||
return translate("upload succeeded"); | return translate("upload succeeded"); | ||||
else | |||||
return sprintf(translate("upload failed (%(errorCode)s)"), { "errorCode": httpCode }); | return sprintf(translate("upload failed (%(errorCode)s)"), { "errorCode": httpCode }); | ||||
} | } | ||||
if (d[0] == "failed") | if (d[0] == "failed") | ||||
return sprintf(translate("upload failed (%(errorMessage)s)"), { "errorMessage": d[2] }); | return sprintf(translate("upload failed (%(errorMessage)s)"), { "errorMessage": d[2] }); | ||||
return translate("unknown"); | return translate("unknown"); | ||||
} | } | ||||
Show All 17 Lines | function onTick() | ||||
// Show splash screens here, so we don't interfere with main menu hotloading | // Show splash screens here, so we don't interfere with main menu hotloading | ||||
if (g_ShowSplashScreens) | if (g_ShowSplashScreens) | ||||
{ | { | ||||
g_ShowSplashScreens = false; | g_ShowSplashScreens = false; | ||||
if (Engine.ConfigDB_GetValue("user", "gui.splashscreen.enable") === "true" || | if (Engine.ConfigDB_GetValue("user", "gui.splashscreen.enable") === "true" || | ||||
Engine.ConfigDB_GetValue("user", "gui.splashscreen.version") < Engine.GetFileMTime("gui/splashscreen/splashscreen.txt")) | Engine.ConfigDB_GetValue("user", "gui.splashscreen.version") < Engine.GetFileMTime("gui/splashscreen/splashscreen.txt")) | ||||
Engine.PushGuiPage("page_splashscreen.xml", { "page": "splashscreen", callback : "SplashScreenClosedCallback" } ); | Engine.PushGuiPage("page_splashscreen.xml", { "page": "splashscreen", "callback": "SplashScreenClosedCallback" }); | ||||
else | else | ||||
ShowRenderPathMessage(); | ShowRenderPathMessage(); | ||||
} | } | ||||
} | } | ||||
function ShowRenderPathMessage() | function ShowRenderPathMessage() | ||||
{ | { | ||||
// Warn about removing fixed render path | // Warn about removing fixed render path | ||||
▲ Show 20 Lines • Show All 144 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator