Autum cup 2 decider
This commit is contained in:
@@ -40,7 +40,7 @@ window.onload = function() {
|
||||
var joinButton = (lobby.status === "NotStarted()") ? '<button class="btn btn-primary join-as-player" onclick="joinDecider(\''+lobby.lobbyActorName+'\')">' +
|
||||
'<img src="assets/images/buttons/isAuto.png" style="height: 25px;"> Join lobby <img src="assets/images/buttons/isAuto.png" style="height: 25px;">' +
|
||||
'</button>' : "";
|
||||
var observerButton = '<button class="btn btn-success join-as-observer" lobbyId="'+lobby.lobbyActorName+'">' +
|
||||
var observerButton = '<button class="btn btn-success join-as-observer" onclick="observerDecider(\''+lobby.lobbyActorName+'\')">' +
|
||||
'<img src="assets/images/buttons/Ulthwe.png" style="height: 25px;"> Observer <img src="assets/images/buttons/Ulthwe.png" style="height: 25px;">' +
|
||||
'</button>';
|
||||
|
||||
@@ -105,7 +105,7 @@ window.onload = function() {
|
||||
});
|
||||
|
||||
if($.cookie('user')=== undefined){
|
||||
var result = prompt("Введите ник", );
|
||||
var result = prompt("Enter nickname: ", );
|
||||
$.cookie('user', result, { expires: 7 });
|
||||
userName = result;
|
||||
}else{
|
||||
@@ -211,12 +211,13 @@ function renderPlayersAndStats(lobby) {
|
||||
var player2ReadyBtn = "";
|
||||
var readyImg = "<img src='/assets/images/buttons/isAuto.png' class='readyImg'/>";
|
||||
var notReadyImg = "<img src='/assets/images/buttons/isNotAuto.png' class='readyImg'/>";
|
||||
var warningClass = (lobby.user2Info.name !== "") ? "warningButton" : "";
|
||||
|
||||
if(lobby.user1Info.name === userName){
|
||||
if(lobby.user1Info.isReady){
|
||||
player1ReadyBtn = "<button class='btn btn-default' onclick='setNotReady()'>"+readyImg+" Ready "+readyImg+"</button>"
|
||||
}else{
|
||||
player1ReadyBtn = "<button class='btn btn-default' onclick='setReady()'>"+notReadyImg+" Not ready "+notReadyImg+"</button>"
|
||||
player1ReadyBtn = "<button class='btn btn-default "+warningClass+"' onclick='setReady()'>"+notReadyImg+" Not ready "+notReadyImg+"</button>"
|
||||
}
|
||||
}else{
|
||||
if(lobby.user1Info.isReady){
|
||||
@@ -230,7 +231,7 @@ function renderPlayersAndStats(lobby) {
|
||||
if(lobby.user2Info.isReady){
|
||||
player2ReadyBtn = "<button class='btn btn-default' onclick='setNotReady()'>"+readyImg+" Ready "+readyImg+"</button>"
|
||||
}else{
|
||||
player2ReadyBtn = "<button class='btn btn-default' onclick='setReady()'>"+notReadyImg+" Not ready "+notReadyImg+"</button>"
|
||||
player2ReadyBtn = "<button class='btn btn-default "+warningClass+"' onclick='setReady()'>"+notReadyImg+" Not ready "+notReadyImg+"</button>"
|
||||
}
|
||||
} else {
|
||||
if(lobby.user2Info.isReady){
|
||||
@@ -290,13 +291,19 @@ function setNotReady(){
|
||||
}
|
||||
|
||||
function joinDecider(actorName){
|
||||
console.log(actorName);
|
||||
ws.send(JSON.stringify({
|
||||
type: "joinDecider",
|
||||
lobbyActorName: actorName
|
||||
}));
|
||||
}
|
||||
|
||||
function observerDecider(actorName){
|
||||
ws.send(JSON.stringify({
|
||||
type: "observerDecider",
|
||||
lobbyActorName: actorName
|
||||
}));
|
||||
}
|
||||
|
||||
function kickSecondPlayer(){
|
||||
ws.send(JSON.stringify({
|
||||
type: "kickSecondPlayer"
|
||||
|
||||
Reference in New Issue
Block a user