use username for multi games
This commit is contained in:
4 files changed
+21
-26
No files matched your search
@@ -231,17 +231,6 @@ const GameType = Object.freeze({ 'SINGLE': 0, 'MULTI': 1, 'CHALLENGE': 2 });
|
||||
|
||||
prepare: function () {
|
||||
var data = new FormData();
|
||||
var userNames;
|
||||
|
||||
if (roomId) {
|
||||
var userNames = localStorage.userNames ? JSON.parse(localStorage.userNames) : {};
|
||||
if (!userNames.hasOwnProperty(roomId)) {
|
||||
userNames[roomId] = prompt('Your name: ');
|
||||
localStorage.userNames = JSON.stringify(userNames);
|
||||
}
|
||||
|
||||
data.append('userName', userNames[roomId]);
|
||||
}
|
||||
|
||||
document.getElementById('loading').style.visibility = 'visible';
|
||||
var url = Game.getGameIdentifier() + '/prepare.json';
|
||||
@@ -618,7 +607,7 @@ const GameType = Object.freeze({ 'SINGLE': 0, 'MULTI': 1, 'CHALLENGE': 2 });
|
||||
break;
|
||||
|
||||
case 'anonymous_user':
|
||||
MapGuesser.showModalWithContent('Error', 'You have to login to join a challenge!');
|
||||
MapGuesser.showModalWithContent('Error', 'You have to login to join this game!');
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -131,11 +131,13 @@
|
||||
}, formData);
|
||||
};
|
||||
|
||||
document.getElementById('multiButton').onclick = function () {
|
||||
MapGuesser.showModal('multi');
|
||||
document.getElementById('createNewRoomButton').href = '/multiGame/new/' + this.dataset.mapId;
|
||||
document.getElementById('multiForm').elements.roomId.select();
|
||||
document.getElementById('playMode').style.visibility = 'hidden';
|
||||
if (document.getElementById('multiButton')) {
|
||||
document.getElementById('multiButton').onclick = function () {
|
||||
MapGuesser.showModal('multi');
|
||||
document.getElementById('createNewRoomButton').href = '/multiGame/new/' + this.dataset.mapId;
|
||||
document.getElementById('multiForm').elements.roomId.select();
|
||||
document.getElementById('playMode').style.visibility = 'hidden';
|
||||
}
|
||||
}
|
||||
|
||||
if (document.getElementById('challengeButton')) {
|
||||
|
||||
Reference in new issue
Block a user