Working on integration of the woka-list with the new admin endpoint.

This commit is contained in:
David Négrier
2022-02-24 21:09:19 +01:00
parent 0543232bc3
commit da469b64d2
14 changed files with 79 additions and 68 deletions
+24 -9
View File
@@ -340,8 +340,21 @@ export class RoomConnection implements RoomConnection {
this.userId = roomJoinedMessage.currentUserId;
this.tags = roomJoinedMessage.tag;
this._userRoomToken = roomJoinedMessage.userRoomToken;
// If one of the URLs sent to us does not exist, let's go to the Woka selection screen.
for (const characterLayer of roomJoinedMessage.characterLayer) {
if (!characterLayer.url) {
this.goToSelectYourWokaScene();
this.closed = true;
break;
}
}
if (this.closed) {
break;
}
const characterLayers = roomJoinedMessage.characterLayer.map(
this.mapCharactgerLayerToBodyResourceDescription.bind(this)
this.mapCharacterLayerToBodyResourceDescription.bind(this)
);
this._roomJoinedMessageStream.next({
@@ -360,10 +373,7 @@ export class RoomConnection implements RoomConnection {
break;
}
case "invalidTextureMessage": {
menuVisiblilityStore.set(false);
menuIconVisiblilityStore.set(false);
selectCharacterSceneVisibleStore.set(true);
gameManager.leaveGame(SelectCharacterSceneName, new SelectCharacterScene());
this.goToSelectYourWokaScene();
this.closed = true;
break;
@@ -608,7 +618,7 @@ export class RoomConnection implements RoomConnection {
});
}*/
private mapCharactgerLayerToBodyResourceDescription(
private mapCharacterLayerToBodyResourceDescription(
characterLayer: CharacterLayerMessage
): BodyResourceDescriptionInterface {
return {
@@ -624,9 +634,7 @@ export class RoomConnection implements RoomConnection {
throw new Error("Invalid JOIN_ROOM message");
}
const characterLayers = message.characterLayers.map(
this.mapCharactgerLayerToBodyResourceDescription.bind(this)
);
const characterLayers = message.characterLayers.map(this.mapCharacterLayerToBodyResourceDescription.bind(this));
const companion = message.companion;
@@ -886,4 +894,11 @@ export class RoomConnection implements RoomConnection {
public get userRoomToken(): string | undefined {
return this._userRoomToken;
}
private goToSelectYourWokaScene(): void {
menuVisiblilityStore.set(false);
menuIconVisiblilityStore.set(false);
selectCharacterSceneVisibleStore.set(true);
gameManager.leaveGame(SelectCharacterSceneName, new SelectCharacterScene());
}
}
+1 -1
View File
@@ -1535,7 +1535,7 @@ ${escapedMessage}
this.messageSubscription?.unsubscribe();
this.userInputManager.destroy();
this.pinchManager?.destroy();
this.emoteManager.destroy();
this.emoteManager?.destroy();
this.cameraManager.destroy();
this.peerStoreUnsubscribe();
this.emoteUnsubscribe();
+15 -2
View File
@@ -43,9 +43,22 @@ export class SelectCharacterScene extends AbstractCharacterScene {
}
preload() {
const wokaMetadataKey = "woka-list";
const wokaMetadataKey = "woka/list";
this.cache.json.remove(wokaMetadataKey);
this.load.json(wokaMetadataKey, `${PUSHER_URL}/${wokaMetadataKey}`);
// FIXME: window.location.href is wrong. We need the URL of the main room (so we need to apply any redirect before!)
this.load.json(
wokaMetadataKey,
`${PUSHER_URL}/${wokaMetadataKey}/` + encodeURIComponent(window.location.href),
undefined,
{
responseType: "text",
headers: {
Authorization: localUserStore.getAuthToken() ?? "",
},
withCredentials: true,
}
);
this.load.once(`filecomplete-json-${wokaMetadataKey}`, () => {
this.playerTextures.loadPlayerTexturesMetadata(this.cache.json.get(wokaMetadataKey));
this.loadSelectSceneCharacters()