Skirmish strength for both sides, "chess-clock"s and tokens scale with cards.

This commit is contained in:
marcins78@gmail.com
2011-09-16 19:18:13 +00:00
parent 1a69fb8a83
commit 16555e24b2
4 changed files with 66 additions and 62 deletions

View File

@@ -58,11 +58,13 @@
}
.fpStrength, .shadowStrength {
border-radius: 6px;
text-align: center;
vertical-align: middle;
background-color: #ffffff;
opacity: 0.5;
opacity: 0.7;
color: #000000;
font-size: 300%;
}
#chatBox {
@@ -91,7 +93,7 @@
.clock {
float: right;
font-size: 70%;
font-size: 100%;
}
.ui-button-text-only .ui-button-text {

View File

@@ -205,21 +205,21 @@ var GempLotrGameUI = Class.extend({
initializeDialogs: function() {
this.smallDialog = $("<div></div>")
.dialog({
autoOpen: false,
closeOnEscape: false,
resizable: false,
width: 400,
height: 200
});
autoOpen: false,
closeOnEscape: false,
resizable: false,
width: 400,
height: 200
});
this.cardActionDialog = $("<div></div>")
.dialog({
autoOpen: false,
closeOnEscape: false,
resizable: true,
width: 600,
height: 300
});
autoOpen: false,
closeOnEscape: false,
resizable: true,
width: 600,
height: 300
});
var that = this;
@@ -231,15 +231,15 @@ var GempLotrGameUI = Class.extend({
this.infoDialog = $("<div></div>")
.dialog({
autoOpen: false,
closeOnEscape: true,
resizable: true,
title: "Card information",
minHeight: 80,
minWidth: 200,
width: 600,
height: 300
});
autoOpen: false,
closeOnEscape: true,
resizable: true,
title: "Card information",
minHeight: 80,
minWidth: 200,
width: 600,
height: 300
});
var swipeOptions = {
threshold: 20,
@@ -311,13 +311,13 @@ var GempLotrGameUI = Class.extend({
if (currentPlayerTurn) {
this.skirmishShadowGroup.setBounds(x + 3, y + 3, groupWidth - 6, heightScales[2] * heightPerScale - 6);
this.skirmishFellowshipGroup.setBounds(x + 3, y + heightScales[2] * heightPerScale + padding + 3, groupWidth - 6, heightScales[3] * heightPerScale - 6);
this.fpStrengthDiv.css({position: "relative", left: 2 + "px", top: groupHeight - strengthBoxSize - 2 + "px", width: strengthBoxSize, height: strengthBoxSize, "z-index": 50});
this.shadowStrengthDiv.css({position: "relative", left: 2 + "px", top: 2 + "px", width: strengthBoxSize, height: strengthBoxSize, "z-index": 50});
this.fpStrengthDiv.css({position: "absolute", left: groupWidth - strengthBoxSize - 2 + "px", top: groupHeight - strengthBoxSize - 2 + "px", width: strengthBoxSize, height: strengthBoxSize, "z-index": 50});
this.shadowStrengthDiv.css({position: "absolute", left: groupWidth - strengthBoxSize - 2 + "px", top: 2 + "px", width: strengthBoxSize, height: strengthBoxSize, "z-index": 50});
} else {
this.skirmishFellowshipGroup.setBounds(x + 3, y + 3, groupWidth - 6, heightScales[1] * heightPerScale - 6);
this.skirmishShadowGroup.setBounds(x + 3, y + heightScales[1] * heightPerScale + padding + 3, groupWidth - 6, heightScales[2] * heightPerScale - 6);
this.shadowStrengthDiv.css({position: "relative", left: 2 + "px", top: groupHeight - strengthBoxSize - 2 + "px", width: strengthBoxSize, height: strengthBoxSize, "z-index": 50});
this.fpStrengthDiv.css({position: "relative", left: 2 + "px", top: 2 + "px", width: strengthBoxSize, height: strengthBoxSize, "z-index": 50});
this.shadowStrengthDiv.css({position: "absolute", left: groupWidth - strengthBoxSize - 2 + "px", top: groupHeight - strengthBoxSize - 2 + "px", width: strengthBoxSize, height: strengthBoxSize, "z-index": 50});
this.fpStrengthDiv.css({position: "absolute", left: groupWidth - strengthBoxSize - 2 + "px", top: 2 + "px", width: strengthBoxSize, height: strengthBoxSize, "z-index": 50});
}
i++;
}
@@ -436,23 +436,25 @@ var GempLotrGameUI = Class.extend({
this.shadowStrengthDiv.text(skirmish[0].getAttribute("shadowStrength"));
}
var clocks = element.getElementsByTagName("clocks")[0].getElementsByTagName("clock");
for (var i = 0; i < clocks.length; i++) {
var clock = clocks[i];
var participantId = clock.getAttribute("participantId");
var index = -1;
for (var plId = 0; plId < this.allPlayerIds.length; plId++)
if (this.allPlayerIds[plId] == participantId)
index = plId;
if (this.allPlayerIds != null) {
var clocks = element.getElementsByTagName("clocks")[0].getElementsByTagName("clock");
for (var i = 0; i < clocks.length; i++) {
var clock = clocks[i];
var participantId = clock.getAttribute("participantId");
var index = -1;
for (var plId = 0; plId < this.allPlayerIds.length; plId++)
if (this.allPlayerIds[plId] == participantId)
index = plId;
var value = parseInt(clock.childNodes[0].nodeValue);
var value = parseInt(clock.childNodes[0].nodeValue);
var sign = (value < 0) ? "-" : "";
value = Math.abs(value);
var minutes = Math.floor(value / 60);
var seconds = value % 60;
var sign = (value < 0) ? "-" : "";
value = Math.abs(value);
var minutes = Math.floor(value / 60);
var seconds = value % 60;
$("#clock" + index).text(sign + minutes + ":" + seconds);
$("#clock" + index).text(sign + minutes + ":" + seconds);
}
}
if (gameEvents.length > 0)
@@ -641,7 +643,7 @@ var GempLotrGameUI = Class.extend({
if (index != -1)
cardData.attachedCards.splice(index, 1);
}
);
);
var card = $(".card:cardId(" + cardId + ")");
var cardData = card.data("card");
@@ -704,7 +706,7 @@ var GempLotrGameUI = Class.extend({
if (index != -1)
cardData.attachedCards.splice(index, 1);
}
);
);
}
card.remove();
@@ -771,13 +773,13 @@ var GempLotrGameUI = Class.extend({
this.smallDialog
.html(text + "<br /><input id='integerDecision' type='text' value='0'>")
.dialog("option", "buttons",
{
"OK": function() {
$(this).dialog("close");
that.decisionFunction(id, $("#integerDecision").val());
}
}
);
{
"OK": function() {
$(this).dialog("close");
that.decisionFunction(id, $("#integerDecision").val());
}
}
);
$("#integerDecision").SpinnerControl({ type: 'range',
typedata: {
@@ -808,13 +810,13 @@ var GempLotrGameUI = Class.extend({
this.smallDialog
.html(html)
.dialog("option", "buttons",
{
"OK": function() {
$(this).dialog("close");
that.decisionFunction(id, $("#multipleChoiceDecision").val());
}
}
);
{
"OK": function() {
$(this).dialog("close");
that.decisionFunction(id, $("#multipleChoiceDecision").val());
}
}
);
this.smallDialog.dialog("open");
},

View File

@@ -47,7 +47,7 @@ var CardGroup = Class.extend({
borderOverlay.css({position: "absolute", left: 0 + "px", top: 0 + "px", width: width - 4, height: height - 4});
var maxDimension = Math.max(width, height);
var tokenSize = Math.floor(maxDimension / 20) * 2;
var tokenSize = Math.floor(maxDimension / 12) * 2;
var tokens = cardElem.data("card").tokens;
if (tokens != null) {
@@ -64,7 +64,7 @@ var CardGroup = Class.extend({
var tokenCount = tokens[token];
for (var i = 0; i < tokenCount; i++) {
var tokenElem = $("<img src='images/" + token.toLowerCase() + ".png'></img>").css({position: "absolute", left: tokenX + "px", top: (tokenSize / 2) * (1 + i) + "px"});
var tokenElem = $("<img src='images/" + token.toLowerCase() + ".png' width='" + tokenSize + "' height='" + tokenSize + "'></img>").css({position: "absolute", left: tokenX + "px", top: (1 * tokenSize / 2) * (1 + i) + "px"});
tokenOverlay.append(tokenElem);
}
tokenIndex ++;
@@ -101,7 +101,7 @@ var AdvPathCardGroup = CardGroup.extend({
function(first, second) {
return (first.data("card").siteNumber - second.data("card").siteNumber);
}
);
);
var cardCount = cardsToLayout.length;
var totalHeight = 0;

View File

@@ -1,8 +1,6 @@
TO DO:
Before release:
15. Add join game screen, where players can choose to play and get paired automatically when a pair becomes available.
22. If skirmish is in progress, the total strength of each side should be displayed.
20. Display "chess-clock" for each player.
Next priority:
13. Add dead/discard pile displays.
@@ -39,3 +37,5 @@ with Filters.sameCard(...) filter.
and go with different selection.
18. Add display of site where player is on adventure path.
21. Scale wounds, burdens, other tokens with the card size.
22. If skirmish is in progress, the total strength of each side should be displayed.
20. Display "chess-clock" for each player.