4
0
mirror of https://github.com/AltarikMC/Launcher synced 2024-11-22 06:19:50 +01:00

added possibility to change memory allocated values + added notification when mc stopped with a non zero exit + added material-icons locally

This commit is contained in:
Quentin Legot 2020-12-09 11:46:11 +01:00 committed by Quentin Legot
parent 54b32045e9
commit ee2d5b43a6
7 changed files with 51 additions and 13 deletions

View File

@ -2,6 +2,6 @@
## Dependencies ## Dependencies
<https://www.npmjs.com/package/electron> - <https://www.npmjs.com/package/electron>
<https://www.npmjs.com/package/minecraft-launcher-core> - <https://www.npmjs.com/package/minecraft-launcher-core>
- <https://github.com/nwutils/create-desktop-shortcuts>

View File

@ -1,6 +1,3 @@
minMem= "2G"
maxMem = "4G"
let launchBtn = document.querySelector('#launch-btn'); let launchBtn = document.querySelector('#launch-btn');
let fullProgressBar = document.querySelector('#fullprogressbar') let fullProgressBar = document.querySelector('#fullprogressbar')
let progressBar = document.querySelector('#progressbar') let progressBar = document.querySelector('#progressbar')
@ -17,10 +14,14 @@ launchBtn.addEventListener("click", e => {
fullProgressBar.classList.remove('hidden'); fullProgressBar.classList.remove('hidden');
loadingMessage.classList.remove('hidden'); loadingMessage.classList.remove('hidden');
ipcRenderer.send('launch', { ipcRenderer.send('launch', {
minMem: minMem, minMem: document.querySelector('#minMem').value,
maxMem: maxMem maxMem: document.querySelector('#maxMem').value
}) })
launchBtn.disabled = true launchBtn.disabled = true
if(document.querySelector('#minMem').value.trim() && document.querySelector('#maxMem').value.trim()){
localStorage.setItem("minMem", document.querySelector('#minMem').value.trim())
localStorage.setItem("maxMem", document.querySelector('#maxMem').value.trim())
}
}) })
ipcRenderer.on("progress", (e, args) => { ipcRenderer.on("progress", (e, args) => {
@ -40,3 +41,8 @@ ipcRenderer.on("close", (e, args) => {
disconnectBtn.addEventListener('click', e => { disconnectBtn.addEventListener('click', e => {
ipcRenderer.send('disconnect') ipcRenderer.send('disconnect')
}) })
window.addEventListener("DOMContentLoaded", () => {
document.querySelector('#minMem').value = localStorage.getItem("minMem") != null ? localStorage.getItem("minMem") : "2G"
document.querySelector('#maxMem').value = localStorage.getItem("maxMem") != null ? localStorage.getItem("maxMem") : "4G"
})

View File

@ -0,0 +1,23 @@
/* fallback */
@font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: url(material-icons.woff2) format('woff2');
}
.material-icons {
font-family: 'Material Icons';
font-weight: normal;
font-style: normal;
font-size: 24px;
line-height: 1;
letter-spacing: normal;
text-transform: none;
display: inline-block;
white-space: nowrap;
word-wrap: normal;
direction: ltr;
-webkit-font-feature-settings: 'liga';
-webkit-font-smoothing: antialiased;
}

Binary file not shown.

View File

@ -6,7 +6,7 @@
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" /> <meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
<link href="include/index.css" rel="stylesheet" /> <link href="include/index.css" rel="stylesheet" />
<link href="include/menubar.css" rel="stylesheet" /> <link href="include/menubar.css" rel="stylesheet" />
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> <link href="include/material-icons.css" rel="stylesheet">
</head> </head>
<body> <body>
<div id="menubar"> <div id="menubar">
@ -25,7 +25,11 @@
<button id="disconnect-btn">Se déconnecter</button> <button id="disconnect-btn">Se déconnecter</button>
<h3>Modifier la configuration</h3> <h3>Modifier la configuration</h3>
<hr> <hr>
Contenu <h4>Allocation mémoire</h4>
<label for="minMem">mémoire minimale</label>
<input type="text" id="minMem" value="2G">
<label for="minMem">mémoire maximale</label>
<input type="text" id="maxMem" value="4G">
</div> </div>
<div id="main"> <div id="main">
<img id="main-img" src="include/maxresdefault.jpg"> <img id="main-img" src="include/maxresdefault.jpg">

View File

@ -6,7 +6,7 @@
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" /> <meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
<link href="include/login.css" rel="stylesheet" /> <link href="include/login.css" rel="stylesheet" />
<link href="include/menubar.css" rel="stylesheet" /> <link href="include/menubar.css" rel="stylesheet" />
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> <link href="include/material-icons.css" rel="stylesheet">
</head> </head>
<body> <body>
<div id="menubar"> <div id="menubar">

View File

@ -89,10 +89,15 @@ ipcMain.on("launch", (event, args) => {
} }
} }
launcher.launch(opts) launcher.launch(opts)
launcher.on('debug', (e) => console.log("debug", e)); // launcher.on('debug', (e) => console.log("debug", e));
launcher.on('data', (e) => console.log("data", e)); launcher.on('data', (e) => console.log("data", e));
launcher.on('progress', (e) => event.sender.send("progress", e)); launcher.on('progress', (e) => event.sender.send("progress", e));
launcher.on('close', (e) => event.sender.send("close", e)); launcher.on('close', (e) => {
event.sender.send("close", e)
if(e !== 0){
showNotification("Une erreur est suvenue", "Minecraft ne s'est pas fermé correctement")
}
});
}) })