mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-06-13 13:04:03 +00:00
Fix achievements not working
This commit is contained in:
parent
12c79370e4
commit
1f22327679
@ -74,20 +74,8 @@ function createWindow() {
|
||||
win.on("closed", () => {
|
||||
console.log("Window closed");
|
||||
win = null;
|
||||
app.quit();
|
||||
});
|
||||
|
||||
function handleWindowBeforeunload(event) {
|
||||
const confirmed = dialog.showMessageBox(remote.getCurrentWindow(), options) === 1;
|
||||
if (confirmed) {
|
||||
remote.getCurrentWindow().close();
|
||||
} else {
|
||||
event.returnValue = false;
|
||||
}
|
||||
}
|
||||
|
||||
win.on("", handleWindowBeforeunload);
|
||||
|
||||
if (isDev) {
|
||||
menu = new Menu();
|
||||
|
||||
|
@ -10,10 +10,10 @@
|
||||
"start": "electron --disable-direct-composition --in-process-gpu ."
|
||||
},
|
||||
"devDependencies": {
|
||||
"electron": "10.4.0"
|
||||
"electron": "10.4.3"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"shapez.io-private-artifacts": "github:tobspr/shapez.io-private-artifacts#abi-v85"
|
||||
"shapez.io-private-artifacts": "github:tobspr/shapez.io-private-artifacts#abi-v82"
|
||||
},
|
||||
"dependencies": {
|
||||
"async-lock": "^1.2.8"
|
||||
|
@ -1,5 +1,5 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const { ipcMain } = require("electron");
|
||||
|
||||
let greenworks = null;
|
||||
@ -11,10 +11,10 @@ try {
|
||||
appId = parseInt(fs.readFileSync(path.join(__dirname, "steam_appid.txt"), "utf8"));
|
||||
} catch (err) {
|
||||
// greenworks is not installed
|
||||
// throw err;
|
||||
console.warn("Failed to load steam api:", err);
|
||||
}
|
||||
|
||||
function init (isDev) {
|
||||
function init(isDev) {
|
||||
if (!greenworks) {
|
||||
return;
|
||||
}
|
||||
@ -34,11 +34,16 @@ function init (isDev) {
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
function listen () {
|
||||
function listen() {
|
||||
ipcMain.handle("steam:is-initialized", isInitialized);
|
||||
|
||||
if (!greenworks || !initialized) {
|
||||
console.log("Ignoring Steam IPC events");
|
||||
if (!initialized) {
|
||||
console.warn("Steam not initialized, won't be able to listen");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!greenworks) {
|
||||
console.warn("Greenworks not loaded, won't be able to listen");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -53,7 +58,7 @@ function isInitialized(event) {
|
||||
function getAchievementNames(event) {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
const achievements = greenworks.getAchievementNames()
|
||||
const achievements = greenworks.getAchievementNames();
|
||||
resolve(achievements);
|
||||
} catch (err) {
|
||||
reject(err);
|
||||
@ -63,11 +68,15 @@ function getAchievementNames(event) {
|
||||
|
||||
function activateAchievement(event, id) {
|
||||
return new Promise((resolve, reject) => {
|
||||
greenworks.activateAchievement(id, () => resolve(), err => reject(err))
|
||||
greenworks.activateAchievement(
|
||||
id,
|
||||
() => resolve(),
|
||||
err => reject(err)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
init,
|
||||
listen
|
||||
listen,
|
||||
};
|
||||
|
@ -146,10 +146,10 @@ duplexer3@^0.1.4:
|
||||
resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2"
|
||||
integrity sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=
|
||||
|
||||
electron@10.4.0:
|
||||
version "10.4.0"
|
||||
resolved "https://registry.yarnpkg.com/electron/-/electron-10.4.0.tgz#018385914474b56110a5a43087a53c114b67c08d"
|
||||
integrity sha512-qK8OOCWuNvEFWThmjkukkqDwIpBqULlDuMXVC9MC/2P4UaWJEjIYvBmBuTyxtFcKoE3kWvcWyeRDUuvzVxxXjA==
|
||||
electron@10.4.3:
|
||||
version "10.4.3"
|
||||
resolved "https://registry.yarnpkg.com/electron/-/electron-10.4.3.tgz#8d1c0f5e562d1b78dcec8074c0d59e58137fd508"
|
||||
integrity sha512-qL8XZBII9KQHr1+YmVMj1AqyTR2I8/lxozvKEWoKKSkF8Hl6GzzxrLXRfISP7aDAvsJEyyhc6b2/42ME8hG5JA==
|
||||
dependencies:
|
||||
"@electron/get" "^1.0.1"
|
||||
"@types/node" "^12.0.12"
|
||||
@ -503,9 +503,9 @@ serialize-error@^7.0.1:
|
||||
dependencies:
|
||||
type-fest "^0.13.1"
|
||||
|
||||
"shapez.io-private-artifacts@github:tobspr/shapez.io-private-artifacts#abi-v85":
|
||||
"shapez.io-private-artifacts@github:tobspr/shapez.io-private-artifacts#abi-v82":
|
||||
version "0.1.0"
|
||||
resolved "git+ssh://git@github.com/tobspr/shapez.io-private-artifacts.git#63adf7e0ea4b90c2a29053ce1f0ec9d573b3ac0a"
|
||||
resolved "git+ssh://git@github.com/tobspr/shapez.io-private-artifacts.git#8aa3bfd3b569eb5695fc8a585a3f2ee3ed2db290"
|
||||
|
||||
sprintf-js@^1.1.2:
|
||||
version "1.1.2"
|
||||
|
Loading…
Reference in New Issue
Block a user