The listeners from MediaManager and SimplePeer were never removed, leading to a huge amount of listeners all over the applications when switching regularly of scene.
Most of the refactoring issues we are seeing are probably due to the fact that we are trying to manipulate a ScenePlugin out of a Scene (the GameManager is not a Scene and holds a reference to a ScenePlugin coming from a Scene that might get invalidated by Phaser 3).
Furthermore, if we want in the future to be able to scale, scenes could be hosted on different servers. Therefore, it makes no sense to have one connexion for the whole application.
Instead, we should have one connexion for each scene.
In the case the reconnect event was triggered on "wake-up", the disconnect event was not sent. But because of a bug in the way we handle the setTimeout, the reconnection to the GameScene never happened after we forced the disconnect scene.
This fixes the issue.
Callbacks for socket.io events were registered each time a disconnect was called, leading to message being dispatched plenty of times if there was several disconnections.
In case we suspend a laptop and resume it, the RECONNECT event is called by socket.io without any error being thrown (so without us being redirected to the Reconnect Scene).
This fix makes sure we go to the reconnect scene before going back to the main scene.
This is an important change.
So far, the project was labelled as licensed under the "AGPL" (improperly since no version of the AGPL was specified)
This commit changes the license to "AGPL + Commons Clause"
The [common clause](https://commonsclause.com/) is an additional restriction forbidding companies from taking WorkAdventure of the shelf, and reselling WorkAdventure.
This license does not forbid anyone from installing and using WorkAdventure, it only targets resellers (so SAAS exploitation of WorkAdventure is limited to TheCodingMachine).
This effectively makes WorkAdventure non open-source, but the source-code remains available for anyone to see and modify.
I put a connecting spinner around the user name when the user is connecting.
Also, if an error occurs, we will see a blinking red circle around the player name.
Most of the time, sending a disconnect event to one of the players is enough (the player will close the connection
which will be shut for the other player).
However! In the rare case where the WebRTC connection is not yet established, if we close the connection on one of the player,
the other player will try connecting until a timeout happens (during this time, the circle with the name is displayed for nothing).
So now, we send disconnection event to every body (not only the people in the group, but also to the person leaving the group)
If more than one tile was set in the "start" layer, the last tile would be selected.
Now, the tile is selected at random among available tiles.
Also, a message is issued if no tiles have been put on the "start" layer.