change electron so it works.

This commit is contained in:
Olivier Gagnon 2021-09-20 22:30:11 -04:00
parent 9e62438b43
commit 8b7723338b
6 changed files with 51 additions and 45 deletions

38
dist/vendor.bundle.js vendored

File diff suppressed because one or more lines are too long

@ -12,6 +12,7 @@ function createWindow() {
win.maximize();
win.loadFile("index.html");
win.show();
// win.webContents.openDevTools();
}
app.whenReady().then(() => {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,14 +1,19 @@
# npm install electron --save-dev
# npm install electron-packager --save-dev
mkdir -p .package/dist || true
mkdir -p .package/dist/src/ThirdParty || true
mkdir -p .package/src/ThirdParty || true
cp index.html .package
cp electron/* .package
cp dist/engine.bundle.js .package/dist
cp dist/engineStyle.css .package/dist
# The css files
cp dist/vendor.css .package/dist
cp dist/engineStyle.bundle.js .package/dist
cp dist/vendor.bundle.js .package/dist
cp main.css .package/main.css
# The js files.
cp dist/vendor.bundle.js .package/dist/vendor.bundle.js
cp main.bundle.js .package/main.bundle.js
cp src/ThirdParty/raphael.min.js .package/src/ThirdParty/raphael.min.js
npm run package-electron

@ -224,19 +224,19 @@ function loadGame(saveString) {
} else {
Settings.init();
}
if (saveObj.hasOwnProperty("FconfSettingsSave")) {
try {
loadFconf(saveObj.FconfSettingsSave);
} catch (e) {
console.error("ERROR: Failed to parse .fconf Settings.");
}
}
// if (saveObj.hasOwnProperty("FconfSettingsSave")) {
// try {
// loadFconf(saveObj.FconfSettingsSave);
// } catch (e) {
// console.error("ERROR: Failed to parse .fconf Settings.");
// }
// }
if (saveObj.hasOwnProperty("LastExportBonus")) {
try {
ExportBonus.setLastExportBonus(JSON.parse(saveObj.LastExportBonus));
} catch (err) {
ExportBonus.setLastExportBonus(new Date().getTime());
console.error("ERROR: Failed to parse .fconf Settings " + err);
console.error("ERROR: Failed to parse last export bonus Settings " + err);
}
}
if (saveObj.hasOwnProperty("VersionSave")) {
@ -319,10 +319,10 @@ function loadImportedGame(saveObj, saveString) {
}
if (saveObj.hasOwnProperty("LastExportBonus")) {
try {
ExportBonus.setLastExportBonus(JSON.parse(saveObj.LastExportBonus));
if (saveObj.LastExportBonus) ExportBonus.setLastExportBonus(JSON.parse(saveObj.LastExportBonus));
} catch (err) {
ExportBonus.setLastExportBonus(new Date().getTime());
console.error("ERROR: Failed to parse .fconf Settings " + err);
console.error("ERROR: Failed to parse last export bonus Settings " + err);
}
}
if (tempSaveObj.hasOwnProperty("VersionSave")) {
@ -401,13 +401,13 @@ function loadImportedGame(saveObj, saveString) {
} else {
Settings.init();
}
if (saveObj.hasOwnProperty("FconfSettingsSave")) {
try {
loadFconf(saveObj.FconfSettingsSave);
} catch (e) {
console.error("ERROR: Failed to load .fconf settings when importing");
}
}
// if (saveObj.hasOwnProperty("FconfSettingsSave")) {
// try {
// loadFconf(saveObj.FconfSettingsSave);
// } catch (e) {
// console.error("ERROR: Failed to load .fconf settings when importing");
// }
// }
if (saveObj.hasOwnProperty("VersionSave")) {
try {
var ver = JSON.parse(saveObj.VersionSave, Reviver);
@ -430,7 +430,7 @@ function loadImportedGame(saveObj, saveString) {
}
}
saveObject.saveGame(Engine.indexedDb);
location.reload();
setTimeout(() => location.reload(), 1000);
return true;
}