diff --git a/docs/maps/entry-exit.md b/docs/maps/entry-exit.md index bd194138..6f98af93 100644 --- a/docs/maps/entry-exit.md +++ b/docs/maps/entry-exit.md @@ -1,7 +1,7 @@ {.section-title.accent.text-primary} # Entries and exits -https://www.youtube.com/watch?v=MuhVgu8H7U0 +[Building your map - Defined entries and exits](https://www.youtube.com/watch?v=MuhVgu8H7U0) ## Defining a default entry point diff --git a/docs/maps/index.md b/docs/maps/index.md index 7f5e7867..d018dd3c 100644 --- a/docs/maps/index.md +++ b/docs/maps/index.md @@ -14,7 +14,7 @@ WorkAdventure comes with a "map starter kit" that we recommend using to start de {.alert.alert-info} If you are looking to host your maps on your own webserver, be sure to read the [Self-hosting your map](hosting.md) guide. -[](https://www.youtube.com/watch?v=lu1IZgBJJD4) +[Building your map - Create your map](https://www.youtube.com/watch?v=lu1IZgBJJD4) ## Getting started diff --git a/docs/maps/meeting-rooms.md b/docs/maps/meeting-rooms.md index 719e0630..88db1621 100644 --- a/docs/maps/meeting-rooms.md +++ b/docs/maps/meeting-rooms.md @@ -1,7 +1,7 @@ {.section-title.accent.text-primary} # Meeting rooms -https://www.youtube.com/watch?v=cN9VMWHN0eo +[Building your map - Meeting room](https://www.youtube.com/watch?v=cN9VMWHN0eo) ## Opening a Jitsi meet when walking on the map diff --git a/docs/maps/menu.php b/docs/maps/menu.php index 9fb3428f..0bf0a7f9 100644 --- a/docs/maps/menu.php +++ b/docs/maps/menu.php @@ -5,64 +5,75 @@ $extraUtilsMenu = require __DIR__.'/../../scripting_api_extra_doc/menu_functions return [ [ 'title' => 'Getting started', - 'url' => '/map-building', - 'markdown' => 'maps.index' + 'url' => '/map-building/', + 'markdown' => 'maps.index', + 'editUrl' => 'https://github.com/thecodingmachine/workadventure/edit/develop/docs/maps/index.md', ], [ 'title' => 'WorkAdventure maps', - 'url' => '/map-building/wa-maps', - 'markdown' => 'maps.wa-maps' + 'url' => '/map-building/wa-maps.md', + 'markdown' => 'maps.wa-maps', + 'editUrl' => 'https://github.com/thecodingmachine/workadventure/edit/develop/docs/maps/wa-maps.md', ], [ 'title' => 'Entries and exits', 'url' => '/map-building/entry-exit.md', - 'markdown' => 'maps.entry-exit' + 'markdown' => 'maps.entry-exit', + 'editUrl' => 'https://github.com/thecodingmachine/workadventure/edit/develop/docs/maps/entry-exit.md', ], [ 'title' => 'Opening a website', 'url' => '/map-building/opening-a-website.md', - 'markdown' => 'maps.opening-a-website' + 'markdown' => 'maps.opening-a-website', + 'editUrl' => 'https://github.com/thecodingmachine/workadventure/edit/develop/docs/maps/opening-a-website.md', ], [ 'title' => 'Meeting rooms', 'url' => '/map-building/meeting-rooms.md', - 'markdown' => 'maps.meeting-rooms' + 'markdown' => 'maps.meeting-rooms', + 'editUrl' => 'https://github.com/thecodingmachine/workadventure/edit/develop/docs/maps/meeting-rooms.md', ], [ 'title' => 'Special zones', 'url' => '/map-building/special-zones.md', - 'markdown' => 'maps.special-zones' + 'markdown' => 'maps.special-zones', + 'editUrl' => 'https://github.com/thecodingmachine/workadventure/edit/develop/docs/maps/special-zones.md', ], [ 'title' => 'Animations', 'url' => '/map-building/animations.md', - 'markdown' => 'maps.animations' + 'markdown' => 'maps.animations', + 'editUrl' => 'https://github.com/thecodingmachine/workadventure/edit/develop/docs/maps/animations.md', ], [ 'title' => 'Integrated websites', 'url' => '/map-building/website-in-map.md', - 'markdown' => 'maps.website-in-map' + 'markdown' => 'maps.website-in-map', + 'editUrl' => 'https://github.com/thecodingmachine/workadventure/edit/develop/docs/maps/website-in-map.md', ], [ 'title' => 'Variables', 'url' => '/map-building/variables.md', - 'markdown' => 'maps.variables' + 'markdown' => 'maps.variables', + 'editUrl' => 'https://github.com/thecodingmachine/workadventure/edit/develop/docs/maps/variables.md', ], [ 'title' => 'Self-hosting your map', 'url' => '/map-building/hosting.md', - 'markdown' => 'maps.hosting' + 'markdown' => 'maps.hosting', + 'editUrl' => 'https://github.com/thecodingmachine/workadventure/edit/develop/docs/maps/hosting.md', ], $extraMenu, [ 'title' => 'Scripting maps', - 'url' => '/map-building/scripting', + 'url' => '/map-building/scripting.md', 'markdown' => 'maps.scripting', 'children' => [ [ 'title' => 'Using Typescript', 'url' => '/map-building/using-typescript.md', - 'markdown' => 'maps.using-typescript' + 'markdown' => 'maps.using-typescript', + 'editUrl' => 'https://github.com/thecodingmachine/workadventure/edit/develop/docs/maps/using-typescript.md', ], [ 'title' => 'API Reference', @@ -74,51 +85,61 @@ return [ 'title' => 'Initialization', 'url' => '/map-building/api-start.md', 'markdown' => 'maps.api-start', + 'editUrl' => 'https://github.com/thecodingmachine/workadventure/edit/develop/docs/maps/api-start.md', ], [ 'title' => 'Navigation', 'url' => '/map-building/api-nav.md', 'markdown' => 'maps.api-nav', + 'editUrl' => 'https://github.com/thecodingmachine/workadventure/edit/develop/docs/maps/api-nav.md', ], [ 'title' => 'Chat', 'url' => '/map-building/api-chat.md', 'markdown' => 'maps.api-chat', + 'editUrl' => 'https://github.com/thecodingmachine/workadventure/edit/develop/docs/maps/api-chat.md', ], [ 'title' => 'Room', 'url' => '/map-building/api-room.md', 'markdown' => 'maps.api-room', + 'editUrl' => 'https://github.com/thecodingmachine/workadventure/edit/develop/docs/maps/api-room.md', ], [ 'title' => 'State', 'url' => '/map-building/api-state.md', 'markdown' => 'maps.api-state', + 'editUrl' => 'https://github.com/thecodingmachine/workadventure/edit/develop/docs/maps/api-state.md', ], [ 'title' => 'Player', 'url' => '/map-building/api-player.md', 'markdown' => 'maps.api-player', + 'editUrl' => 'https://github.com/thecodingmachine/workadventure/edit/develop/docs/maps/api-player.md', ], [ 'title' => 'UI', 'url' => '/map-building/api-ui.md', 'markdown' => 'maps.api-ui', + 'editUrl' => 'https://github.com/thecodingmachine/workadventure/edit/develop/docs/maps/api-ui.md', ], [ 'title' => 'Sound', 'url' => '/map-building/api-sound.md', 'markdown' => 'maps.api-sound', + 'editUrl' => 'https://github.com/thecodingmachine/workadventure/edit/develop/docs/maps/api-sound.md', ], [ 'title' => 'Controls', 'url' => '/map-building/api-controls.md', 'markdown' => 'maps.api-controls', + 'editUrl' => 'https://github.com/thecodingmachine/workadventure/edit/develop/docs/maps/api-controls.md', ], [ 'title' => 'Deprecated', 'url' => '/map-building/api-deprecated.md', 'markdown' => 'maps.api-deprecated', + 'editUrl' => 'https://github.com/thecodingmachine/workadventure/edit/develop/docs/maps/api-deprecated.md', ], ] ], diff --git a/docs/maps/opening-a-website.md b/docs/maps/opening-a-website.md index 2ca54281..ec6c82d4 100644 --- a/docs/maps/opening-a-website.md +++ b/docs/maps/opening-a-website.md @@ -1,7 +1,7 @@ {.section-title.accent.text-primary} # Opening a website when walking on the map -https://www.youtube.com/watch?v=Me8cu5lLN3A +[Building your map - Opening a website](https://www.youtube.com/watch?v=Me8cu5lLN3A) ## The openWebsite property diff --git a/docs/maps/special-zones.md b/docs/maps/special-zones.md index fff4e730..30ebebab 100644 --- a/docs/maps/special-zones.md +++ b/docs/maps/special-zones.md @@ -3,7 +3,7 @@ ## Making a "silent" zone -https://www.youtube.com/watch?v=z7XLo06o-ow +[Building your map - Special zones](https://www.youtube.com/watch?v=z7XLo06o-ow) On your map, you can define special silent zones where nobody is allowed to talk. In these zones, users will not speak to each others, even if they are next to each others. diff --git a/front/src/Components/Menu/CreateMapSubMenu.svelte b/front/src/Components/Menu/CreateMapSubMenu.svelte index 7f2f58c5..130481b0 100644 --- a/front/src/Components/Menu/CreateMapSubMenu.svelte +++ b/front/src/Components/Menu/CreateMapSubMenu.svelte @@ -35,4 +35,4 @@ } } - \ No newline at end of file + diff --git a/front/src/Connexion/ConnectionManager.ts b/front/src/Connexion/ConnectionManager.ts index 2ee129c2..83c65edc 100644 --- a/front/src/Connexion/ConnectionManager.ts +++ b/front/src/Connexion/ConnectionManager.ts @@ -137,18 +137,6 @@ class ConnectionManager { connexionType === GameConnexionTypes.empty ) { this.authToken = localUserStore.getAuthToken(); - //todo: add here some kind of warning if authToken has expired. - if (!this.authToken) { - await this.anonymousLogin(); - } else { - try { - await this.checkAuthUserConnexion(); - } catch (err) { - console.error(err); - await this.anonymousLogin(); - } - } - this.localUser = localUserStore.getLocalUser() as LocalUser; //if authToken exist in localStorage then localUser cannot be null let roomPath: string; if (connexionType === GameConnexionTypes.empty) { @@ -173,14 +161,22 @@ class ConnectionManager { } //get detail map for anonymous login and set texture in local storage - try { - this._currentRoom = await Room.createRoom(new URL(roomPath)); - } catch (e) { - console.error(e); - localUserStore.setLastRoomUrl(null); - this._currentRoom = null; + //before set token of user we must load room and all information. For example the mandatory authentication could be require on current room + this._currentRoom = await Room.createRoom(new URL(roomPath)); + + //todo: add here some kind of warning if authToken has expired. + if (!this.authToken && !this._currentRoom.authenticationMandatory) { + await this.anonymousLogin(); + } else { + try { + await this.checkAuthUserConnexion(); + } catch (err) { + console.error(err); + } } - if (this._currentRoom != undefined && this._currentRoom.textures != undefined && this._currentRoom.textures.length > 0) { + this.localUser = localUserStore.getLocalUser() as LocalUser; //if authToken exist in localStorage then localUser cannot be null + + if (this._currentRoom.textures != undefined && this._currentRoom.textures.length > 0) { //check if texture was changed if (this.localUser.textures.length === 0) { this.localUser.textures = this._currentRoom.textures; diff --git a/front/src/Phaser/Game/StartPositionCalculator.ts b/front/src/Phaser/Game/StartPositionCalculator.ts index 0827b623..a5f96314 100644 --- a/front/src/Phaser/Game/StartPositionCalculator.ts +++ b/front/src/Phaser/Game/StartPositionCalculator.ts @@ -51,19 +51,28 @@ export class StartPositionCalculator { if (!selectedOrDefaultLayer) { selectedOrDefaultLayer = defaultStartLayerName; } + let foundLayer: ITiledMapLayer | null = null; for (const layer of this.gameMap.flatLayers) { + if (layer.type !== "tilelayer") continue; + //we want to prioritize the selectedLayer other the start layer if ( - (selectedOrDefaultLayer === layer.name || layer.name.endsWith("/" + selectedOrDefaultLayer)) && + (selectedOrDefaultLayer === layer.name || + selectedOrDefaultLayer === `#${layer.name}` || + layer.name.endsWith("/" + selectedOrDefaultLayer)) && layer.type === "tilelayer" && (selectedOrDefaultLayer === defaultStartLayerName || this.isStartLayer(layer)) ) { - const startPosition = this.startUser(layer, selectedLayer); - this.startPosition = { - x: startPosition.x + this.mapFile.tilewidth / 2, - y: startPosition.y + this.mapFile.tileheight / 2, - }; + foundLayer = layer; + break; } } + if (foundLayer) { + const startPosition = this.startUser(foundLayer, selectedLayer); + this.startPosition = { + x: startPosition.x + this.mapFile.tilewidth / 2, + y: startPosition.y + this.mapFile.tileheight / 2, + }; + } } private isStartLayer(layer: ITiledMapLayer): boolean { diff --git a/maps/tests/index.html b/maps/tests/index.html index 3c9538d5..149e2868 100644 --- a/maps/tests/index.html +++ b/maps/tests/index.html @@ -55,6 +55,14 @@ Test start tile (S2) +