From d033b78c582e98ad5b77c29c9f057e3e8c6b0ca0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?gr=C3=A9goire=20parant?= Date: Tue, 21 Sep 2021 16:07:57 +0200 Subject: [PATCH 1/7] Update Youtube link markdown (#1477) Signed-off-by: Gregoire Parant --- docs/maps/entry-exit.md | 2 +- docs/maps/index.md | 2 +- docs/maps/meeting-rooms.md | 2 +- docs/maps/opening-a-website.md | 2 +- docs/maps/special-zones.md | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) 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/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. From ce262942505ef8faed39cf1f14ed382b9a8b14a8 Mon Sep 17 00:00:00 2001 From: Kharhamel Date: Fri, 24 Sep 2021 11:48:38 +0200 Subject: [PATCH 2/7] FIX: initPositionFromLayerName will now prioritize its target layer rather than the start layer --- .../Phaser/Game/StartPositionCalculator.ts | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/front/src/Phaser/Game/StartPositionCalculator.ts b/front/src/Phaser/Game/StartPositionCalculator.ts index 0827b623..b9802662 100644 --- a/front/src/Phaser/Game/StartPositionCalculator.ts +++ b/front/src/Phaser/Game/StartPositionCalculator.ts @@ -51,19 +51,25 @@ export class StartPositionCalculator { if (!selectedOrDefaultLayer) { selectedOrDefaultLayer = defaultStartLayerName; } + let foundLayer: ITiledMapLayer | null = null; for (const layer of this.gameMap.flatLayers) { - if ( - (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, - }; + if (layer.type !== "tilelayer") continue; + //we want to prioritize the selectedLayer other the start layer + if (selectedOrDefaultLayer === layer.name || layer.name.endsWith("/" + selectedOrDefaultLayer)) { + foundLayer = layer; + break; + } else if (selectedOrDefaultLayer === defaultStartLayerName || this.isStartLayer(layer)) { + 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 { From b8996d5abba1800032376d75f2f2ab7e975ab65c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Mon, 27 Sep 2021 11:13:35 +0200 Subject: [PATCH 3/7] Fixing links in the documentation --- docs/maps/menu.php | 4 ++-- front/src/Components/Menu/CreateMapSubMenu.svelte | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/maps/menu.php b/docs/maps/menu.php index 9fb3428f..fb5b8256 100644 --- a/docs/maps/menu.php +++ b/docs/maps/menu.php @@ -5,12 +5,12 @@ $extraUtilsMenu = require __DIR__.'/../../scripting_api_extra_doc/menu_functions return [ [ 'title' => 'Getting started', - 'url' => '/map-building', + 'url' => '/map-building/', 'markdown' => 'maps.index' ], [ 'title' => 'WorkAdventure maps', - 'url' => '/map-building/wa-maps', + 'url' => '/map-building/wa-maps.md', 'markdown' => 'maps.wa-maps' ], [ diff --git a/front/src/Components/Menu/CreateMapSubMenu.svelte b/front/src/Components/Menu/CreateMapSubMenu.svelte index 6cce71ac..53399681 100644 --- a/front/src/Components/Menu/CreateMapSubMenu.svelte +++ b/front/src/Components/Menu/CreateMapSubMenu.svelte @@ -6,7 +6,7 @@ } function goToBuildingMap() { - const sparkHost = "https://workadventu.re/map-building"; + const sparkHost = "https://workadventu.re/map-building/"; window.open(sparkHost, "_blank"); } @@ -48,4 +48,4 @@ } } - \ No newline at end of file + From ad5489c102c2849e3001bbd06a0869a5f6c7bf9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Mon, 27 Sep 2021 11:32:57 +0200 Subject: [PATCH 4/7] Adding edit URLs to allow people to directly propose changes --- docs/maps/menu.php | 43 ++++++++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/docs/maps/menu.php b/docs/maps/menu.php index fb5b8256..ca758a0e 100644 --- a/docs/maps/menu.php +++ b/docs/maps/menu.php @@ -6,52 +6,62 @@ return [ [ 'title' => 'Getting started', 'url' => '/map-building/', - 'markdown' => 'maps.index' + 'markdown' => 'maps.index', + 'editUrl' => 'https://github.com/thecodingmachine/workadventure/edit/develop/docs/maps/index.md', ], [ 'title' => 'WorkAdventure maps', 'url' => '/map-building/wa-maps.md', - 'markdown' => 'maps.wa-maps' + '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, [ @@ -62,7 +72,8 @@ return [ [ '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', ], ] ], From 7d758af90042e7551af714393dd69ab5e9aee0ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Mon, 27 Sep 2021 12:01:40 +0200 Subject: [PATCH 5/7] Fixing .md link --- docs/maps/menu.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/maps/menu.php b/docs/maps/menu.php index ca758a0e..0bf0a7f9 100644 --- a/docs/maps/menu.php +++ b/docs/maps/menu.php @@ -66,7 +66,7 @@ return [ $extraMenu, [ 'title' => 'Scripting maps', - 'url' => '/map-building/scripting', + 'url' => '/map-building/scripting.md', 'markdown' => 'maps.scripting', 'children' => [ [ From 908b78fddad27b71a1f3270467605c290dbaee35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?gr=C3=A9goire=20parant?= Date: Tue, 5 Oct 2021 18:59:26 +0200 Subject: [PATCH 6/7] HotFix mandatory login with ADMIN openid connexion (#1503) Before anonymous connexion, we must get the details of the map and permit to check mandatory connexion and redirect user to login page. Signed-off-by: Gregoire Parant --- front/src/Connexion/ConnectionManager.ts | 25 +++++++++++++----------- front/src/Phaser/Login/LoginScene.ts | 2 +- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/front/src/Connexion/ConnectionManager.ts b/front/src/Connexion/ConnectionManager.ts index dc094a06..87efc804 100644 --- a/front/src/Connexion/ConnectionManager.ts +++ b/front/src/Connexion/ConnectionManager.ts @@ -137,17 +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); - } - } - this.localUser = localUserStore.getLocalUser() as LocalUser; //if authToken exist in localStorage then localUser cannot be null let roomPath: string; if (connexionType === GameConnexionTypes.empty) { @@ -172,7 +161,21 @@ class ConnectionManager { } //get detail map for anonymous login and set texture in local storage + //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); + } + } + 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) { diff --git a/front/src/Phaser/Login/LoginScene.ts b/front/src/Phaser/Login/LoginScene.ts index 7421934d..6bba0290 100644 --- a/front/src/Phaser/Login/LoginScene.ts +++ b/front/src/Phaser/Login/LoginScene.ts @@ -25,7 +25,7 @@ export class LoginScene extends ResizableScene { if ( localUserStore.getAuthToken() == undefined && gameManager.currentStartedRoom && - gameManager.currentStartedRoom?.authenticationMandatory + gameManager.currentStartedRoom.authenticationMandatory ) { connectionManager.loadOpenIDScreen(); loginSceneVisibleIframeStore.set(true); From 358d9a79d31fc22c6b616a35bff733218cd2de05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?gr=C3=A9goire=20parant?= Date: Tue, 5 Oct 2021 23:34:18 +0200 Subject: [PATCH 7/7] Add condition Hash for start layer (#1506) Signed-off-by: Gregoire Parant --- .../Phaser/Game/StartPositionCalculator.ts | 11 +- maps/tests/index.html | 8 + maps/tests/start-tile-teleport.json | 166 ++++++++++++++++++ 3 files changed, 181 insertions(+), 4 deletions(-) create mode 100644 maps/tests/start-tile-teleport.json diff --git a/front/src/Phaser/Game/StartPositionCalculator.ts b/front/src/Phaser/Game/StartPositionCalculator.ts index b9802662..a5f96314 100644 --- a/front/src/Phaser/Game/StartPositionCalculator.ts +++ b/front/src/Phaser/Game/StartPositionCalculator.ts @@ -55,10 +55,13 @@ export class StartPositionCalculator { 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)) { - foundLayer = layer; - break; - } else if (selectedOrDefaultLayer === defaultStartLayerName || this.isStartLayer(layer)) { + if ( + (selectedOrDefaultLayer === layer.name || + selectedOrDefaultLayer === `#${layer.name}` || + layer.name.endsWith("/" + selectedOrDefaultLayer)) && + layer.type === "tilelayer" && + (selectedOrDefaultLayer === defaultStartLayerName || this.isStartLayer(layer)) + ) { foundLayer = layer; break; } 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) + + + Success Failure Pending + + + Test teleport into the map + + Success Failure Pending diff --git a/maps/tests/start-tile-teleport.json b/maps/tests/start-tile-teleport.json new file mode 100644 index 00000000..269d5ebc --- /dev/null +++ b/maps/tests/start-tile-teleport.json @@ -0,0 +1,166 @@ +{ "compressionlevel":-1, + "height":5, + "infinite":false, + "layers":[ + { + "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + "height":5, + "id":1, + "name":"start", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":5, + "x":0, + "y":0 + }, + { + "data":[4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4], + "height":5, + "id":4, + "name":"background", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":5, + "x":0, + "y":0 + }, + { + "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0], + "height":5, + "id":7, + "name":"S2", + "opacity":1, + "properties":[ + { + "name":"startLayer", + "type":"bool", + "value":true + }], + "type":"tilelayer", + "visible":true, + "width":5, + "x":0, + "y":0 + }, + { + "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + "height":5, + "id":8, + "name":"S1", + "opacity":1, + "properties":[ + { + "name":"startLayer", + "type":"bool", + "value":true + }], + "type":"tilelayer", + "visible":true, + "width":5, + "x":0, + "y":0 + }, + { + "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + "height":5, + "id":5, + "name":"floor", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":5, + "x":0, + "y":0 + }, + { + "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], + "height":5, + "id":6, + "name":"exitLayer-toS2", + "opacity":1, + "properties":[ + { + "name":"exitUrl", + "type":"string", + "value":".\/start-tile-teleport.json#S2" + }], + "type":"tilelayer", + "visible":true, + "width":5, + "x":0, + "y":0 + }, + { + "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2], + "height":5, + "id":9, + "name":"exitLayer-toS1", + "opacity":1, + "properties":[ + { + "name":"exitUrl", + "type":"string", + "value":".\/start-tile-teleport.json#S1" + }], + "type":"tilelayer", + "visible":true, + "width":5, + "x":0, + "y":0 + }, + { + "draworder":"topdown", + "id":3, + "name":"floorLayer", + "objects":[ + { + "height":66.6666666666667, + "id":1, + "name":"", + "rotation":0, + "text": + { + "fontfamily":"Sans Serif", + "pixelsize":11, + "text":"Go to X above S1 and teleport on S2\nGo to X above S2 and teleport on S1", + "wrap":true + }, + "type":"", + "visible":true, + "width":155.104166666667, + "x":3.28125, + "y":2.5 + }], + "opacity":1, + "type":"objectgroup", + "visible":true, + "x":0, + "y":0 + }], + "nextlayerid":10, + "nextobjectid":2, + "orientation":"orthogonal", + "renderorder":"right-down", + "tiledversion":"1.7.2", + "tileheight":32, + "tilesets":[ + { + "columns":2, + "firstgid":1, + "image":"function_tiles.png", + "imageheight":64, + "imagewidth":64, + "margin":0, + "name":"function_tiles", + "spacing":0, + "tilecount":4, + "tileheight":32, + "tilewidth":32 + }], + "tilewidth":32, + "type":"map", + "version":"1.6", + "width":5 +} \ No newline at end of file