diff --git a/.gitignore b/.gitignore index 66b8fc9..de34272 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ node_modules/ - -out/ \ No newline at end of file +game +out/ diff --git a/index.css b/include/index.css similarity index 75% rename from index.css rename to include/index.css index e64840d..8eac1bc 100644 --- a/index.css +++ b/include/index.css @@ -66,4 +66,30 @@ h3 { background-color: green; border: 1px solid black; border-radius: 3px; +} + +.hidden{ + display:none; +} + +#fullprogressbar{ + position:relative; + margin: 0 auto; + width:80%; + height:25px; + background-color:gray; +} + +#progressbar{ + background-color: green; + height:100%; + width:0; +} + +#loading-message{ + width:80%; + position:relative; + margin: 0 auto; + height:28px; + color:white; } \ No newline at end of file diff --git a/include/index.js b/include/index.js index cae95f5..88b5531 100644 --- a/include/index.js +++ b/include/index.js @@ -1,16 +1,37 @@ minMem= "2G" maxMem = "4G" +let launchBtn = document.querySelector('#launch-btn'); +let fullProgressBar = document.querySelector('#fullprogressbar') +let progressBar = document.querySelector('#progressbar') +let loadingMessage = document.querySelector('#loading-message') ipcRenderer.on("nick", (event, args) => { console.log(args) document.querySelector("#nick-span").innerHTML = args.name }) -document.querySelector('#launch-btn').addEventListener("click", e => { +launchBtn.addEventListener("click", e => { + launchBtn.classList.add('hidden'); + fullProgressBar.classList.remove('hidden'); + loadingMessage.classList.remove('hidden'); ipcRenderer.send('launch', { minMem: minMem, maxMem: maxMem }) - document.querySelector('#launch-btn').disabled = true + launchBtn.disabled = true +}) + +ipcRenderer.on("progress", (e, args) => { + progressBar.style.width = (args.task / args.total) * 100 + "%" + loadingMessage.innerHTML = "Téléchargement de " + args.type + ": " + args.task + " sur " + args.total; +}) + +ipcRenderer.on("close", (e, args) => { + launchBtn.classList.remove('hidden'); + fullProgressBar.classList.add('hidden'); + loadingMessage.classList.add('hidden'); + loadingMessage.innerHTML = "Téléchargement de Minecraft en cours..." + progressBar.style.width = "0" + launchBtn.disabled = false }) \ No newline at end of file diff --git a/login.css b/include/login.css similarity index 100% rename from login.css rename to include/login.css diff --git a/maxresdefault.jpg b/include/maxresdefault.jpg similarity index 100% rename from maxresdefault.jpg rename to include/maxresdefault.jpg diff --git a/menubar.css b/include/menubar.css similarity index 100% rename from menubar.css rename to include/menubar.css diff --git a/script.js b/include/script.js similarity index 100% rename from script.js rename to include/script.js diff --git a/index.html b/index.html index f3f2ab5..ee82946 100644 --- a/index.html +++ b/index.html @@ -4,8 +4,8 @@