Merge branch 'develop' of github.com:thecodingmachine/workadventure

This commit is contained in:
_Bastler 2021-10-06 16:02:36 +02:00
commit 51a774fb84
11 changed files with 245 additions and 45 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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',
],
]
],

View File

@ -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

View File

@ -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.

View File

@ -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 {
//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));
} catch (e) {
console.error(e);
localUserStore.setLastRoomUrl(null);
this._currentRoom = null;
//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;

View File

@ -51,20 +51,29 @@ 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);
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 {
return this.getProperty(layer, "startLayer") == true;

View File

@ -55,6 +55,14 @@
<a href="#" class="testLink" data-testmap="start-tile.json#S2" target="_blank">Test start tile (S2)</a>
</td>
</tr>
<tr>
<td>
<input type="radio" name="test-start-tile-s1tos2"> Success <input type="radio" name="test-start-tile-s1tos2"> Failure <input type="radio" name="test-start-tile-s1tos2" checked> Pending
</td>
<td>
<a href="#" class="testLink" data-testmap="start-tile-teleport.json" target="_blank">Test teleport into the map</a>
</td>
</tr>
<tr>
<td>
<input type="radio" name="test-website-objects"> Success <input type="radio" name="test-website-objects"> Failure <input type="radio" name="test-website-objects" checked> Pending

View File

@ -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
}