sync
This commit is contained in:
parent
1a31e419cc
commit
d6fa5b69ce
@ -11,6 +11,14 @@ body {
|
|||||||
background-color: #262626;
|
background-color: #262626;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
main {
|
||||||
|
app-region: drag;
|
||||||
|
}
|
||||||
|
|
||||||
|
main > * {
|
||||||
|
app-region: no-drag;
|
||||||
|
}
|
||||||
|
|
||||||
main > article > section > img {
|
main > article > section > img {
|
||||||
width: 150px;
|
width: 150px;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,8 @@
|
|||||||
* {
|
* {
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
|
outline: none;
|
||||||
|
user-select: none;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
font-family: "Roboto", sans-serif;
|
font-family: "Roboto", sans-serif;
|
||||||
}
|
}
|
||||||
@ -16,6 +18,11 @@ body {
|
|||||||
background-attachment: fixed;
|
background-attachment: fixed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
app-region: drag;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
main {
|
main {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0px;
|
top: 0px;
|
||||||
@ -24,6 +31,11 @@ main {
|
|||||||
bottom: 0px;
|
bottom: 0px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
app-region: drag;
|
||||||
|
}
|
||||||
|
|
||||||
|
main > * {
|
||||||
|
app-region: no-drag;
|
||||||
}
|
}
|
||||||
|
|
||||||
main > nav {
|
main > nav {
|
||||||
@ -372,25 +384,43 @@ div.checkboxes > input[type="checkbox"] {
|
|||||||
font-size: small;
|
font-size: small;
|
||||||
}
|
}
|
||||||
|
|
||||||
button.load {
|
div.loader {
|
||||||
content: "";
|
overflow: hidden;
|
||||||
transition: background-color 0.3s;
|
position: absolute;
|
||||||
|
left: 0px;
|
||||||
|
right: 0px;
|
||||||
|
bottom: 0px;
|
||||||
|
width: 100%;
|
||||||
|
height: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.loader > div.full {
|
||||||
|
height: 10px;
|
||||||
|
width: 100%;
|
||||||
|
background-color: #3e3e3ee6;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.loader > div.full > div.progress,
|
||||||
|
div.loader > div.full > div.loading {
|
||||||
|
height: 10px;
|
||||||
|
width: 50%;
|
||||||
|
transition: 1s width;
|
||||||
|
background-color: #39aa6d;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.loader > div.full > div.loading {
|
||||||
|
animation: animateLoadingEffect 1s linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
[hidden] {
|
[hidden] {
|
||||||
display: none;
|
display: none;
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
}
|
}
|
||||||
@keyframes backgroundAnimation {
|
@keyframes animateLoadingEffect {
|
||||||
0% {
|
0% {
|
||||||
background-position: 0% 50%;
|
transform: translateX(-100%);
|
||||||
}
|
|
||||||
50% {
|
|
||||||
background-position: 100% 50%;
|
|
||||||
}
|
}
|
||||||
100% {
|
100% {
|
||||||
background-position: 0% 50%;
|
transform: translateX(200%);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,18 +58,32 @@ function toggleAudio(element) {
|
|||||||
|
|
||||||
function toggleMusic(element) {
|
function toggleMusic(element) {
|
||||||
if (element.getAttribute("state") == 0) {
|
if (element.getAttribute("state") == 0) {
|
||||||
system.call("audio::mute")
|
audio.pause()
|
||||||
element.setAttribute("state", 1)
|
element.setAttribute("state", 1)
|
||||||
element.children[0].classList.replace("fa-pause", "fa-play")
|
element.children[0].classList.replace("fa-pause", "fa-play")
|
||||||
element.children[1].innerText = "Reprendre"
|
element.children[1].innerText = "Reprendre"
|
||||||
} else {
|
} else {
|
||||||
system.call("audio::unmute")
|
audio.play()
|
||||||
element.setAttribute("state", 0)
|
element.setAttribute("state", 0)
|
||||||
element.children[0].classList.replace("fa-play", "fa-pause")
|
element.children[0].classList.replace("fa-play", "fa-pause")
|
||||||
element.children[1].innerText = "Pause"
|
element.children[1].innerText = "Pause"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toggleMusicVolume(element) {
|
||||||
|
if (element.getAttribute("state") == 0) {
|
||||||
|
system.call("audio::mute")
|
||||||
|
element.setAttribute("state", 1)
|
||||||
|
element.children[0].classList.replace("fa-volume", "fa-volume-slash")
|
||||||
|
element.children[1].innerText = "Activer le son"
|
||||||
|
} else {
|
||||||
|
system.call("audio::unmute")
|
||||||
|
element.setAttribute("state", 0)
|
||||||
|
element.children[0].classList.replace("fa-volume-slash", "fa-volume")
|
||||||
|
element.children[1].innerText = "Couper le son"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function updateVolume(value) {
|
function updateVolume(value) {
|
||||||
audio.volume = value / 100
|
audio.volume = value / 100
|
||||||
audioPourcentageLabel.innerText = `${value}%`
|
audioPourcentageLabel.innerText = `${value}%`
|
||||||
@ -86,7 +100,7 @@ system.result("server::ping", pong => {
|
|||||||
|
|
||||||
function handleOptionsChanges(key, value) {
|
function handleOptionsChanges(key, value) {
|
||||||
system.call("game::optionSet", { key, value })
|
system.call("game::optionSet", { key, value })
|
||||||
const span = document.querySelector(`span#${key}`)
|
const span = document.querySelector(`span#current${key.replace(/./, c => c.toUpperCase())}`)
|
||||||
if (span) {
|
if (span) {
|
||||||
span.innerText = Math.floor(value)
|
span.innerText = Math.floor(value)
|
||||||
}
|
}
|
||||||
@ -100,16 +114,66 @@ function handleSettingsChanges(key, value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setLoadingType(type) {
|
||||||
|
const loader = document.querySelector(".loader")
|
||||||
|
switch (type) {
|
||||||
|
case "continuous":
|
||||||
|
loader.children[0].children[0].classList.remove("progress")
|
||||||
|
loader.children[0].children[0].classList.add("loading")
|
||||||
|
break
|
||||||
|
case "progress":
|
||||||
|
loader.children[0].children[0].classList.remove("loading")
|
||||||
|
loader.children[0].children[0].classList.add("progress")
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setLoadingProgress(pourcentage) {
|
||||||
|
const loader = document.querySelector(".loader")
|
||||||
|
const progress = loader.querySelector(".progress")
|
||||||
|
if (progress) {
|
||||||
|
progress.setAttribute("style", `width: ${pourcentage}%`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleLoadingBar() {
|
||||||
|
const loader = document.querySelector(".loader")
|
||||||
|
if (loader.hasAttribute("hidden")) {
|
||||||
|
loader.removeAttribute("hidden")
|
||||||
|
} else {
|
||||||
|
loader.setAttribute("hidden", "")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function showLoadingBar() {
|
||||||
|
const loader = document.querySelector(".loader")
|
||||||
|
if (loader.hasAttribute("hidden")) {
|
||||||
|
loader.removeAttribute("hidden")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function hideLoadingBar() {
|
||||||
|
const loader = document.querySelector(".loader")
|
||||||
|
if (!loader.hasAttribute("hidden")) {
|
||||||
|
loader.setAttribute("hidden", "")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
system.result("game::parseOptions", options => {
|
system.result("game::parseOptions", options => {
|
||||||
gamma.checked = options.gamma == 1 ? true : false
|
gamma.checked = options.gamma == 1 ? true : false
|
||||||
renderClouds.checked = options.renderrenderClouds == false ? false : true
|
renderClouds.checked = options.renderrenderClouds == false ? false : true
|
||||||
guiScale.value = options.guiScale
|
guiScale.value = options.guiScale
|
||||||
|
currentGuiScale.innerText = options.guiScale
|
||||||
graphicsMode.checked = options.graphicsMode == 0 ? true : false
|
graphicsMode.checked = options.graphicsMode == 0 ? true : false
|
||||||
renderDistance.value = options.renderDistance
|
renderDistance.value = options.renderDistance
|
||||||
|
currentRenderDistance.innerText = options.renderDistance
|
||||||
})
|
})
|
||||||
|
|
||||||
system.result("settings::read", settings => {
|
system.result("settings::read", settings => {
|
||||||
ram.value = settings.ram.max
|
ram.value = settings.ram.max
|
||||||
|
currentRam.innerText = `${Math.floor(settings.ram.max / 1024)} G`
|
||||||
})
|
})
|
||||||
|
|
||||||
system.result("hardware::ramInformation", $ram => {
|
system.result("hardware::ramInformation", $ram => {
|
||||||
@ -120,11 +184,17 @@ system.result("hardware::ramInformation", $ram => {
|
|||||||
system.result("game::launch", info => {
|
system.result("game::launch", info => {
|
||||||
if (info.disablePlayButton) {
|
if (info.disablePlayButton) {
|
||||||
playButton.removeAttribute("hidden")
|
playButton.removeAttribute("hidden")
|
||||||
|
hideLoadingBar()
|
||||||
} else {
|
} else {
|
||||||
playButton.setAttribute("hidden", "")
|
playButton.setAttribute("hidden", "")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
system.result("game::launched", info => {
|
||||||
|
muteAudio()
|
||||||
|
hideLoadingBar()
|
||||||
|
})
|
||||||
|
|
||||||
system.result("player::profile", playerProfile => {
|
system.result("player::profile", playerProfile => {
|
||||||
console.log(playerProfile)
|
console.log(playerProfile)
|
||||||
})
|
})
|
||||||
@ -133,6 +203,26 @@ system.result("oculus::getdefaultshaderset", boolean => {
|
|||||||
sildurs_shader.checked = boolean
|
sildurs_shader.checked = boolean
|
||||||
})
|
})
|
||||||
|
|
||||||
|
system.result("progress::update", info => {
|
||||||
|
showLoadingBar()
|
||||||
|
setLoadingType(info.type)
|
||||||
|
if (info.type == "progress" && typeof info.pourcentage == "number") {
|
||||||
|
setLoadingProgress(info.pourcentage)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
system.result("progress::hide", () => {
|
||||||
|
hideLoadingBar()
|
||||||
|
})
|
||||||
|
|
||||||
|
system.result("izitoast::error", info => {
|
||||||
|
iziToast.error(info)
|
||||||
|
})
|
||||||
|
|
||||||
|
system.result("progress::info", info => {
|
||||||
|
iziToast.error(info)
|
||||||
|
})
|
||||||
|
|
||||||
window.onload = () => {
|
window.onload = () => {
|
||||||
system.call("hardware::ramInformation")
|
system.call("hardware::ramInformation")
|
||||||
system.call("game::parseOptions")
|
system.call("game::parseOptions")
|
||||||
@ -140,5 +230,6 @@ window.onload = () => {
|
|||||||
system.call("player::profile")
|
system.call("player::profile")
|
||||||
system.call("settings::read")
|
system.call("settings::read")
|
||||||
system.call("oculus::getdefaultshaderset")
|
system.call("oculus::getdefaultshaderset")
|
||||||
|
hideLoadingBar()
|
||||||
startAudio()
|
startAudio()
|
||||||
}
|
}
|
||||||
@ -3,6 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/izitoast/1.4.0/css/iziToast.css">
|
||||||
<link rel="stylesheet" href="./assets/css/index.css">
|
<link rel="stylesheet" href="./assets/css/index.css">
|
||||||
<title>NyanLauncher</title>
|
<title>NyanLauncher</title>
|
||||||
</head>
|
</head>
|
||||||
@ -11,6 +12,9 @@
|
|||||||
<button class="close" onclick="system.call('window::close')">
|
<button class="close" onclick="system.call('window::close')">
|
||||||
<i class="fas fa-times"></i>
|
<i class="fas fa-times"></i>
|
||||||
</button>
|
</button>
|
||||||
|
<button class="close" onclick="system.call('window::reduce')">
|
||||||
|
<i class="fas fa-minus"></i>
|
||||||
|
</button>
|
||||||
<nav hidden>
|
<nav hidden>
|
||||||
<button class="close" onclick="hideNavBar()">
|
<button class="close" onclick="hideNavBar()">
|
||||||
<i class="fas fa-times"></i>
|
<i class="fas fa-times"></i>
|
||||||
@ -59,7 +63,7 @@
|
|||||||
Distance de rendu
|
Distance de rendu
|
||||||
</label>
|
</label>
|
||||||
<div class="ranges">
|
<div class="ranges">
|
||||||
<span id="renderDistance">
|
<span id="currentRenderDistance">
|
||||||
4
|
4
|
||||||
</span>
|
</span>
|
||||||
<input type="range" name="renderDistance" min="4" max="32" id="renderDistance" onchange="handleOptionsChanges(this.name, this.value)">
|
<input type="range" name="renderDistance" min="4" max="32" id="renderDistance" onchange="handleOptionsChanges(this.name, this.value)">
|
||||||
@ -72,7 +76,7 @@
|
|||||||
Taille de l'interface
|
Taille de l'interface
|
||||||
</label>
|
</label>
|
||||||
<div class="ranges">
|
<div class="ranges">
|
||||||
<span id="guiScale">
|
<span id="currentGuiScale">
|
||||||
1
|
1
|
||||||
</span>
|
</span>
|
||||||
<input type="range" name="guiScale" min="1" max="4" id="guiScale" onchange="handleOptionsChanges(this.name, this.value)">
|
<input type="range" name="guiScale" min="1" max="4" id="guiScale" onchange="handleOptionsChanges(this.name, this.value)">
|
||||||
@ -125,6 +129,12 @@
|
|||||||
100%
|
100%
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<button class="classic" onclick="toggleMusicVolume(this)" state="0">
|
||||||
|
<i class="fas fa-volume"></i>
|
||||||
|
<span>
|
||||||
|
Couper le son
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
<button class="classic" onclick="toggleMusic(this)" state="0">
|
<button class="classic" onclick="toggleMusic(this)" state="0">
|
||||||
<i class="fas fa-pause"></i>
|
<i class="fas fa-pause"></i>
|
||||||
<span>
|
<span>
|
||||||
@ -213,8 +223,15 @@
|
|||||||
<img class="mascot" src="./assets/img/sulli.png" alt="">
|
<img class="mascot" src="./assets/img/sulli.png" alt="">
|
||||||
</section>
|
</section>
|
||||||
</footer>
|
</footer>
|
||||||
|
<div class="loader">
|
||||||
|
<div class="full">
|
||||||
|
<div class="loading">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/izitoast/1.4.0/js/iziToast.min.js"></script>
|
||||||
<script src="./assets/js/index.js"></script>
|
<script src="./assets/js/index.js"></script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@ -12,6 +12,9 @@
|
|||||||
<button class="close" onclick="system.call('window::close')">
|
<button class="close" onclick="system.call('window::close')">
|
||||||
<i class="fas fa-times"></i>
|
<i class="fas fa-times"></i>
|
||||||
</button>
|
</button>
|
||||||
|
<button class="close" onclick="system.call('window::reduce')">
|
||||||
|
<i class="fas fa-minus"></i>
|
||||||
|
</button>
|
||||||
<article class="loginchoice">
|
<article class="loginchoice">
|
||||||
<div frame="select">
|
<div frame="select">
|
||||||
<h2>
|
<h2>
|
||||||
|
|||||||
17
main.js
17
main.js
@ -47,7 +47,7 @@ async function createLauncherWindow() {
|
|||||||
contextIsolation: true,
|
contextIsolation: true,
|
||||||
preload: path.join(__dirname, "modules", "preload.js"),
|
preload: path.join(__dirname, "modules", "preload.js"),
|
||||||
webviewTag: true,
|
webviewTag: true,
|
||||||
devTools: false
|
devTools: true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (os.platform() == "darwin") {
|
if (os.platform() == "darwin") {
|
||||||
@ -160,6 +160,9 @@ ipcMain.on("call", async (event, data) => {
|
|||||||
launcherWindow.close()
|
launcherWindow.close()
|
||||||
app.quit()
|
app.quit()
|
||||||
break
|
break
|
||||||
|
case "window::reduce":
|
||||||
|
launcherWindow.minimize()
|
||||||
|
break
|
||||||
case "skin::set":
|
case "skin::set":
|
||||||
const file = await dialog.showOpenDialog(launcherWindow, {
|
const file = await dialog.showOpenDialog(launcherWindow, {
|
||||||
filters: [
|
filters: [
|
||||||
@ -277,6 +280,7 @@ ipcMain.on("call", async (event, data) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
async function launchGame(restartGame) {
|
async function launchGame(restartGame) {
|
||||||
|
let sendToRenderer = true
|
||||||
launcherWindow.webContents.send("Response<game::launch>", { disablePlayButton: false })
|
launcherWindow.webContents.send("Response<game::launch>", { disablePlayButton: false })
|
||||||
const downloadQueue = []
|
const downloadQueue = []
|
||||||
const remoteFiles = await fileManager.getRemoteFiles()
|
const remoteFiles = await fileManager.getRemoteFiles()
|
||||||
@ -313,11 +317,13 @@ async function launchGame(restartGame) {
|
|||||||
try {
|
try {
|
||||||
await download(url, path.join(app.getPath("appData"), ".catboat", path.dirname(item)))
|
await download(url, path.join(app.getPath("appData"), ".catboat", path.dirname(item)))
|
||||||
if (launcherWindow instanceof BrowserWindow) {
|
if (launcherWindow instanceof BrowserWindow) {
|
||||||
launcherWindow.webContents.send("Response<progress::update>", { type: "landing" })
|
launcherWindow.webContents.send("Response<izitoast::info>", { title: "Lancement du jeu", message: "Ce processus peut être plus ou moins long selon votre configuration." })
|
||||||
|
launcherWindow.webContents.send("Response<progress::update>", { type: "continuous" })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (launcherWindow instanceof BrowserWindow) {
|
if (launcherWindow instanceof BrowserWindow) {
|
||||||
launcherWindow.webContents.send("Response<progress::error>", { type: "landing" })
|
launcherWindow.webContents.send("Response<progress::hide>")
|
||||||
|
launcherWindow.webContents.send("Response<izitoast::error>", { title: "Erreur", message: new String(error) })
|
||||||
}
|
}
|
||||||
dialog.showErrorBox("Erreur lors du téléchargement des fichiers", error.toString())
|
dialog.showErrorBox("Erreur lors du téléchargement des fichiers", error.toString())
|
||||||
continue
|
continue
|
||||||
@ -332,6 +338,11 @@ async function launchGame(restartGame) {
|
|||||||
console.log(log)
|
console.log(log)
|
||||||
})
|
})
|
||||||
launcher.on("data", (log) => {
|
launcher.on("data", (log) => {
|
||||||
|
if (sendToRenderer) {
|
||||||
|
console.log("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
|
||||||
|
launcherWindow.webContents.send("Response<game::launched>")
|
||||||
|
sendToRenderer = false
|
||||||
|
}
|
||||||
console.log(log)
|
console.log(log)
|
||||||
})
|
})
|
||||||
launcher.on("data", (log) => {
|
launcher.on("data", (log) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user