Change lost connection page to the new one (#2161)

* Change lost connection page to the new one
This commit is contained in:
César Cardinale
2022-05-04 10:13:18 +02:00
committed by GitHub
parent fb9f8adb21
commit d47aad2ead
9 changed files with 67 additions and 29 deletions
+24 -5
View File
@@ -76,6 +76,7 @@ import { contactPageStore } from "../../Stores/MenuStore";
import type { WasCameraUpdatedEvent } from "../../Api/Events/WasCameraUpdatedEvent";
import { audioManagerFileStore } from "../../Stores/AudioManagerStore";
import { currentPlayerGroupLockStateStore } from "../../Stores/CurrentPlayerGroupStore";
import { errorScreenStore } from "../../Stores/ErrorScreenStore";
import EVENT_TYPE = Phaser.Scenes.Events;
import Texture = Phaser.Textures.Texture;
@@ -90,7 +91,7 @@ import FILE_LOAD_ERROR = Phaser.Loader.Events.FILE_LOAD_ERROR;
import { MapStore } from "../../Stores/Utils/MapStore";
import { followUsersColorStore } from "../../Stores/FollowStore";
import { GameSceneUserInputHandler } from "../UserInput/GameSceneUserInputHandler";
import { locale } from "../../i18n/i18n-svelte";
import LL, { locale } from "../../i18n/i18n-svelte";
import { availabilityStatusStore, localVolumeStore } from "../../Stores/MediaStore";
import { StringUtils } from "../../Utils/StringUtils";
import { startLayerNamesStore } from "../../Stores/StartLayerNamesStore";
@@ -100,7 +101,7 @@ import type { CoWebsite } from "../../WebRtc/CoWebsite/CoWesbite";
import CancelablePromise from "cancelable-promise";
import { Deferred } from "ts-deferred";
import { SuperLoaderPlugin } from "../Services/SuperLoaderPlugin";
import { PlayerDetailsUpdatedMessage } from "../../Messages/ts-proto-generated/protos/messages";
import { ErrorScreenMessage, PlayerDetailsUpdatedMessage } from "../../Messages/ts-proto-generated/protos/messages";
export interface GameSceneInitInterface {
initPosition: PointInterface | null;
reconnecting: boolean;
@@ -597,14 +598,30 @@ export class GameScene extends DirtyScene {
if (this.isReconnecting) {
setTimeout(() => {
this.scene.sleep();
this.scene.launch(ReconnectingSceneName);
errorScreenStore.setError(
ErrorScreenMessage.fromPartial({
type: "reconnecting",
code: "CONNECTION_LOST",
title: get(LL).warning.connectionLostTitle(),
details: get(LL).warning.connectionLostSubtitle(),
})
);
//this.scene.launch(ReconnectingSceneName);
}, 0);
} else if (this.connection === undefined) {
// Let's wait 1 second before printing the "connecting" screen to avoid blinking
setTimeout(() => {
if (this.connection === undefined) {
this.scene.sleep();
this.scene.launch(ReconnectingSceneName);
errorScreenStore.setError(
ErrorScreenMessage.fromPartial({
type: "reconnecting",
code: "CONNECTION_LOST",
title: get(LL).warning.connectionLostTitle(),
details: get(LL).warning.connectionLostSubtitle(),
})
);
//this.scene.launch(ReconnectingSceneName);
}
}, 1000);
}
@@ -888,7 +905,9 @@ export class GameScene extends DirtyScene {
// Analyze tags to find if we are admin. If yes, show console.
if (this.scene.isSleeping()) {
this.scene.stop(ReconnectingSceneName);
const error = get(errorScreenStore);
if (error && error?.type === "reconnecting") errorScreenStore.delete();
//this.scene.stop(ReconnectingSceneName);
}
//init user position and play trigger to check layers properties