diff options
author | Alystrasz <contact@remyraes.com> | 2022-01-10 20:18:57 +0100 |
---|---|---|
committer | Alystrasz <contact@remyraes.com> | 2022-01-10 20:18:57 +0100 |
commit | 06d67801dc94d0b9fb359213d95ec5fba3e0c6ba (patch) | |
tree | 4f5514be3d82dca962cd5fed67dd2f422da0c6a1 /src | |
parent | 3d96636bb0bbdc271d49999f7a10216690a19157 (diff) | |
parent | 9dbf85ca6655d8b14c8f0ad090a9b30e1ec951cf (diff) | |
download | Viper-06d67801dc94d0b9fb359213d95ec5fba3e0c6ba.tar.gz Viper-06d67801dc94d0b9fb359213d95ec5fba3e0c6ba.zip |
Merge branch 'main' into feat/northstar-auto-update
Diffstat (limited to 'src')
-rw-r--r-- | src/app/index.html | 2 | ||||
-rw-r--r-- | src/app/main.css | 2 | ||||
-rw-r--r-- | src/app/main.js | 21 | ||||
-rw-r--r-- | src/index.js | 9 | ||||
-rw-r--r-- | src/lang/en.json | 1 | ||||
-rw-r--r-- | src/lang/fr.json | 1 |
6 files changed, 29 insertions, 7 deletions
diff --git a/src/app/index.html b/src/app/index.html index 88d5a17..d9db79b 100644 --- a/src/app/index.html +++ b/src/app/index.html @@ -15,7 +15,7 @@ </div> <div class="buttons"> <button id="exit" onclick="exit()">%%gui.exit%%</button> - <button id="update" onclick="update()">%%gui.update%%</button> + <button id="updateBtn" onclick="update()">%%gui.update%%</button> <button id="setpath" onclick="setpath()">%%gui.setpath%%</button> </div> </div> diff --git a/src/app/main.css b/src/app/main.css index 56f17b2..69b10ad 100644 --- a/src/app/main.css +++ b/src/app/main.css @@ -110,7 +110,7 @@ button:active { #setpath {background: #5E81AC} #vanilla, #exit {background: #656E7F} -#update, #installmod {background: var(--blue)} +#updateBtn, #installmod {background: var(--blue)} #togglemod, #toggleall {background: var(--yellow)} #northstar, #removeall, #removemod {background: var(--red)} button:disabled {background: var(--disabled) !important; opacity: 0.5} diff --git a/src/app/main.js b/src/app/main.js index 1678b86..c365cf4 100644 --- a/src/app/main.js +++ b/src/app/main.js @@ -3,6 +3,7 @@ const path = require("path"); const { ipcRenderer } = require("electron"); const lang = require("../lang"); +let shouldInstallNorthstar = false; var settings = { gamepath: "", @@ -43,7 +44,14 @@ function setpath(value = false) { ipcRenderer.send("setpath", value); } -function launch() {ipcRenderer.send("launch")} +function launch() { + if (shouldInstallNorthstar) { + update(); + shouldInstallNorthstar = false; + } else { + ipcRenderer.send("launch"); + } +} function launchVanilla() {ipcRenderer.send("launchVanilla")} function log(msg) { @@ -110,7 +118,11 @@ function installmod() { ipcRenderer.send("installmod") } -ipcRenderer.on("ns-updated", () => {setButtons(true)}) +ipcRenderer.on("ns-updated", () => { + setButtons(true); + northstar.disabled = false; + updateBtn.innerText = lang("gui.update"); +}) ipcRenderer.on("ns-updating", () => {setButtons(false)}) ipcRenderer.on("newpath", (event, newpath) => { @@ -150,6 +162,11 @@ ipcRenderer.on("version", (event, versions) => { for (let i = 0; i < buttons.length; i++) { buttons[i].disabled = true; } + + // Since Northstar is not installed, we cannot launch it + northstar.disabled = true; + shouldInstallNorthstar = true; + updateBtn.innerText = lang("gui.installnorthstar"); } }); ipcRenderer.send("getversion"); diff --git a/src/index.js b/src/index.js index 09aa626..1b594ad 100644 --- a/src/index.js +++ b/src/index.js @@ -77,7 +77,7 @@ ipcMain.on("update", (event) => {utils.update()}) ipcMain.on("setpathcli", (event) => {utils.setpath()}); ipcMain.on("setpath", (event, value) => { if (!value) { - utils.setpath(win) + utils.setpath(win); } else if (!win.isVisible()) { win.show(); } @@ -87,6 +87,7 @@ ipcMain.on("newpath", (event, newpath) => { if (newpath === false && !win.isVisible()) { win.webContents.send("nopathselected"); } else { + _sendVersionsInfo(); if (!win.isVisible()) { win.show(); } @@ -95,12 +96,14 @@ ipcMain.on("newpath", (event, newpath) => { win.webContents.send("wrongpath"); }); -ipcMain.on("getversion", () => { +function _sendVersionsInfo() { win.webContents.send("version", { ns: utils.getNSVersion(), vp: "v" + require("../package.json").version }); -}); +} + +ipcMain.on("getversion", () => _sendVersionsInfo()); ipcMain.on("versioncli", () => { console.log("Viper: v" + require("../package.json").version); diff --git a/src/lang/en.json b/src/lang/en.json index 61a8545..68d46c7 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -61,6 +61,7 @@ "gui.launch": "Launch", "gui.launchvanilla": "Vanilla", "gui.launchnorthstar": "Northstar", + "gui.installnorthstar": "Install", "gui.selectpath": "Please select the path!", "gui.gamepath.must": "The game path must be set to start Viper.", diff --git a/src/lang/fr.json b/src/lang/fr.json index 58302e9..22afa9a 100644 --- a/src/lang/fr.json +++ b/src/lang/fr.json @@ -61,6 +61,7 @@ "gui.launch": "Jouer", "gui.launchvanilla": "Vanilla", "gui.launchnorthstar": "Northstar", + "gui.installnorthstar": "Installer", "gui.selectpath": "Veuillez sélectionner le dossier où se trouve le client Titanfall 2.", "gui.gamepath.must": "Vous devez sélectionner le chemin du dossier du jeu Titanfall 2 pour pouvoir lancer Viper.", |