Scaling tokens according to card size.

This commit is contained in:
marcins78@gmail.com
2011-09-16 12:29:11 +00:00
parent 3efc330cb6
commit 1bca7ff4f5
2 changed files with 8 additions and 5 deletions

View File

@@ -46,6 +46,9 @@ var CardGroup = Class.extend({
var borderOverlay = $(".borderOverlay", cardElem);
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 tokens = cardElem.data("card").tokens;
if (tokens != null) {
var tokenTypesCount = 0;
@@ -57,11 +60,11 @@ var CardGroup = Class.extend({
var tokenIndex = 1;
for (var token in tokens)
if (tokens.hasOwnProperty(token) && tokens[token] > 0) {
var tokenX = (tokenIndex * (width / (tokenTypesCount + 1))) - 11;
var tokenX = (tokenIndex * (width / (tokenTypesCount + 1))) - (tokenSize / 2);
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: 15 * (1 + i) + "px"});
var tokenElem = $("<img src='images/" + token.toLowerCase() + ".png'></img>").css({position: "absolute", left: tokenX + "px", top: (tokenSize / 2) * (1 + i) + "px"});
tokenOverlay.append(tokenElem);
}
tokenIndex ++;
@@ -98,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.
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.
@@ -39,3 +37,5 @@ with Filters.sameCard(...) filter.
9. Add checkbox option to auto-pass if there is no actions to be played.
8. Add checkbox option to auto-accept choices on the client, also allow to cancel selection to reset to none-selected
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.