mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
Fix app not starting when the savegames were corrupted - there is now a better error message
This commit is contained in:
parent
0521252675
commit
ecbcd02abc
@ -14,13 +14,10 @@ import { Vector } from "./core/vector";
|
||||
import { AdProviderInterface } from "./platform/ad_provider";
|
||||
import { NoAdProvider } from "./platform/ad_providers/no_ad_provider";
|
||||
import { AnalyticsInterface } from "./platform/analytics";
|
||||
import { ShapezGameAnalytics } from "./platform/browser/game_analytics";
|
||||
import { GoogleAnalyticsImpl } from "./platform/browser/google_analytics";
|
||||
import { NoGameAnalytics } from "./platform/browser/no_game_analytics";
|
||||
import { SoundImplBrowser } from "./platform/browser/sound";
|
||||
import { StorageImplBrowser } from "./platform/browser/storage";
|
||||
import { StorageImplBrowserIndexedDB } from "./platform/browser/storage_indexed_db";
|
||||
import { PlatformWrapperImplBrowser } from "./platform/browser/wrapper";
|
||||
import { StorageImplElectron } from "./platform/electron/storage";
|
||||
import { PlatformWrapperImplElectron } from "./platform/electron/wrapper";
|
||||
import { GameAnalyticsInterface } from "./platform/game_analytics";
|
||||
import { SoundInterface } from "./platform/sound";
|
||||
@ -36,7 +33,6 @@ import { MainMenuState } from "./states/main_menu";
|
||||
import { MobileWarningState } from "./states/mobile_warning";
|
||||
import { PreloadState } from "./states/preload";
|
||||
import { SettingsState } from "./states/settings";
|
||||
import { NoGameAnalytics } from "./platform/browser/no_game_analytics";
|
||||
|
||||
const logger = createLogger("application");
|
||||
|
||||
|
@ -9,6 +9,7 @@ export const CHANGELOG = [
|
||||
"You can now configure the camera movement speed when using WASD (by mini-bomba)",
|
||||
"Selecting an area now is relative to the world and thus does not move when moving the screen (by Dimava)",
|
||||
"Fix bug regarding number rounding",
|
||||
"Fix app not starting when the savegames were corrupted - there is now a better error message",
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -366,10 +366,18 @@ export class MainMenuState extends GameState {
|
||||
this.app.adProvider.showVideoAd().then(() => {
|
||||
this.app.analytics.trackUiClick("resume_game_adcomplete");
|
||||
const savegame = this.app.savegameMgr.getSavegameById(game.internalId);
|
||||
savegame.readAsync().then(() => {
|
||||
savegame
|
||||
.readAsync()
|
||||
.then(() => {
|
||||
this.moveToState("InGameState", {
|
||||
savegame,
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
this.dialogs.showWarning(
|
||||
T.dialogs.gameLoadFailure.title,
|
||||
T.dialogs.gameLoadFailure.text + "<br><br>" + err
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -138,15 +138,10 @@ export class PreloadState extends GameState {
|
||||
.then(() => {
|
||||
return this.app.savegameMgr.initialize().catch(err => {
|
||||
logger.error("Failed to initialize savegames:", err);
|
||||
return new Promise(resolve => {
|
||||
// const { ok } = this.dialogs.showWarning(
|
||||
// T.preload.savegame_corrupt_dialog.title,
|
||||
// T.preload.savegame_corrupt_dialog.content,
|
||||
// ["ok:good"]
|
||||
// );
|
||||
// ok.add(resolve);
|
||||
alert("Your savegames failed to load. They might not show up. Sorry!");
|
||||
});
|
||||
alert(
|
||||
"Your savegames failed to load, it seems your data files got corrupted. I'm so sorry!\n\n(This can happen if your pc crashed while a game was saved).\n\nYou can try re-importing your savegames."
|
||||
);
|
||||
return this.app.savegameMgr.writeAsync();
|
||||
});
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user