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.maximize();
win.loadFile("index.html"); win.loadFile("index.html");
win.show(); win.show();
// win.webContents.openDevTools();
} }
app.whenReady().then(() => { 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 --save-dev
# npm install electron-packager --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 index.html .package
cp electron/* .package cp electron/* .package
cp dist/engine.bundle.js .package/dist # The css files
cp dist/engineStyle.css .package/dist
cp dist/vendor.css .package/dist cp dist/vendor.css .package/dist
cp dist/engineStyle.bundle.js .package/dist cp main.css .package/main.css
cp dist/vendor.bundle.js .package/dist
# 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 npm run package-electron

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