Added sound when player is redirected to game from GameHall.

This commit is contained in:
marcins78@gmail.com
2012-08-30 01:20:40 +00:00
parent 77ec355a28
commit 93196b3dfa

View File

@@ -49,15 +49,15 @@ var GempLotrHallUI = Class.extend({
var editDeck = $("<button>Deck builder</button>");
editDeck.button().click(
function () {
location.href = 'deckBuild.html';
});
function () {
location.href = 'deckBuild.html';
});
var merchant = $("<button>Merchant</button>");
merchant.button().click(
function () {
location.href = 'merchant.html';
});
function () {
location.href = 'merchant.html';
});
this.buttonsDiv.append(editDeck);
this.buttonsDiv.append(" | ");
@@ -74,17 +74,17 @@ var GempLotrHallUI = Class.extend({
this.createTableButton = $("<button>Create table</button>");
$(this.createTableButton).button().click(
function () {
that.supportedFormatsSelect.hide();
that.decksSelect.hide();
that.createTableButton.hide();
var format = that.supportedFormatsSelect.val();
var deck = that.decksSelect.val();
if (deck != null)
that.comm.createTable(format, deck, function (xml) {
that.processResponse(xml);
});
});
function () {
that.supportedFormatsSelect.hide();
that.decksSelect.hide();
that.createTableButton.hide();
var format = that.supportedFormatsSelect.val();
var deck = that.decksSelect.val();
if (deck != null)
that.comm.createTable(format, deck, function (xml) {
that.processResponse(xml);
});
});
this.createTableButton.hide();
this.decksSelect = $("<select style='width: 220px'></select>");
@@ -98,10 +98,10 @@ var GempLotrHallUI = Class.extend({
this.leaveTableButton = $("<button>Leave table</button>");
$(this.leaveTableButton).button().click(
function () {
that.leaveTableButton.hide();
that.comm.leaveTable();
});
function () {
that.leaveTableButton.hide();
that.comm.leaveTable();
});
this.leaveTableButton.hide();
this.buttonsDiv.append(this.leaveTableButton);
@@ -210,6 +210,7 @@ var GempLotrHallUI = Class.extend({
}
this.tablesDiv.append(tablesTable);
var skipReload = false;
var games = root.getElementsByTagName("game");
if (games.length > 0) {
var waitingGameId = games[0].getAttribute("id");
@@ -217,7 +218,9 @@ var GempLotrHallUI = Class.extend({
var participantIdAppend = "";
if (participantId != null)
participantIdAppend = "&participantId=" + participantId;
location.href = "/gemp-lotr/game.html?gameId=" + waitingGameId + participantIdAppend;
this.tablesDiv.append("<embed src='/gemp-lotr/fanfare_x.wav' hidden=true autostart=true loop=false>");
skipReload = true;
setTimeout("location.href = '/gemp-lotr/game.html?gameId=" + waitingGameId + participantIdAppend + "'", 3000);
}
if (!this.supportedFormatsInitialized) {
@@ -248,9 +251,11 @@ var GempLotrHallUI = Class.extend({
var that = this;
setTimeout(function () {
that.updateHall();
}, 1000);
if (!skipReload) {
setTimeout(function () {
that.updateHall();
}, 1000);
}
}
},
@@ -268,24 +273,24 @@ var GempLotrHallUI = Class.extend({
if (joined != "true") {
var but = $("<button>Join queue</button>");
$(but).button().click(
function (event) {
var deck = that.decksSelect.val();
if (deck != null)
that.comm.joinQueue(id, deck, function (xml) {
that.processResponse(xml);
});
});
function (event) {
var deck = that.decksSelect.val();
if (deck != null)
that.comm.joinQueue(id, deck, function (xml) {
that.processResponse(xml);
});
});
actionsField.append(but);
} else {
var but = $("<button>Leave queue</button>");
$(but).button().click(
function (event) {
var deck = that.decksSelect.val();
if (deck != null)
that.comm.leaveQueue(id, deck, function (xml) {
that.processResponse(xml);
});
});
function (event) {
var deck = that.decksSelect.val();
if (deck != null)
that.comm.leaveQueue(id, deck, function (xml) {
that.processResponse(xml);
});
});
actionsField.append(but);
}
@@ -320,13 +325,13 @@ var GempLotrHallUI = Class.extend({
if (!waiting) {
var but = $("<button>Join table</button>");
$(but).button().click(
function (event) {
var deck = that.decksSelect.val();
if (deck != null)
that.comm.joinTable(id, deck, function (xml) {
that.processResponse(xml);
});
});
function (event) {
var deck = that.decksSelect.val();
if (deck != null)
that.comm.joinTable(id, deck, function (xml) {
that.processResponse(xml);
});
});
actionsField.append(but);
}
}
@@ -334,13 +339,13 @@ var GempLotrHallUI = Class.extend({
if (watchable == "true") {
var but = $("<button>Watch game</button>");
$(but).button().click(
function (event) {
var participantId = getUrlParam("participantId");
var participantIdAppend = "";
if (participantId != null)
participantIdAppend = "&participantId=" + participantId;
location.href = "/gemp-lotr/game.html?gameId=" + gameId + participantIdAppend;
});
function (event) {
var participantId = getUrlParam("participantId");
var participantIdAppend = "";
if (participantId != null)
participantIdAppend = "&participantId=" + participantId;
location.href = "/gemp-lotr/game.html?gameId=" + gameId + participantIdAppend;
});
actionsField.append(but);
}