Add s/TemplateData/UnityProgress.js
This commit is contained in:
parent
2468f62cac
commit
c67da080c7
1 changed files with 24 additions and 0 deletions
24
s/TemplateData/UnityProgress.js
Normal file
24
s/TemplateData/UnityProgress.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
function UnityProgress(gameInstance, progress) {
|
||||
if (!gameInstance.Module)
|
||||
return;
|
||||
if (!gameInstance.logo) {
|
||||
gameInstance.logo = document.createElement("div");
|
||||
gameInstance.logo.className = "logo " + gameInstance.Module.splashScreenStyle;
|
||||
gameInstance.container.appendChild(gameInstance.logo);
|
||||
}
|
||||
if (!gameInstance.progress) {
|
||||
gameInstance.progress = document.createElement("div");
|
||||
gameInstance.progress.className = "progress " + gameInstance.Module.splashScreenStyle;
|
||||
gameInstance.progress.empty = document.createElement("div");
|
||||
gameInstance.progress.empty.className = "empty";
|
||||
gameInstance.progress.appendChild(gameInstance.progress.empty);
|
||||
gameInstance.progress.full = document.createElement("div");
|
||||
gameInstance.progress.full.className = "full";
|
||||
gameInstance.progress.appendChild(gameInstance.progress.full);
|
||||
gameInstance.container.appendChild(gameInstance.progress);
|
||||
}
|
||||
gameInstance.progress.full.style.width = (100 * progress) + "%";
|
||||
gameInstance.progress.empty.style.width = (100 * (1 - progress)) + "%";
|
||||
if (progress == 1)
|
||||
gameInstance.logo.style.display = gameInstance.progress.style.display = "none";
|
||||
}
|
Loading…
Reference in a new issue