Better format information.

This commit is contained in:
marcins78@gmail.com
2012-04-02 12:43:46 +00:00
parent 6c260070cf
commit a8a146f41f
3 changed files with 59 additions and 9 deletions

View File

@@ -55,7 +55,11 @@ public class GameUtils {
public static String getCardLink(PhysicalCard card) {
LotroCardBlueprint blueprint = card.getBlueprint();
return "<div class='cardHint' value='" + card.getBlueprintId() + "'>" + (blueprint.isUnique() ? "" : "") + GameUtils.getFullName(blueprint) + "</div>";
return getCardLink(card.getBlueprintId(), blueprint);
}
public static String getCardLink(String blueprintId, LotroCardBlueprint blueprint) {
return "<div class='cardHint' value='" + blueprintId + "'>" + (blueprint.isUnique() ? "" : "") + GameUtils.getFullName(blueprint) + "</div>";
}
public static String getAppendedTextNames(Collection<PhysicalCard> cards) {

View File

@@ -57,18 +57,14 @@ public class HallResource extends AbstractResource {
result.append("<li>sites from block: " + lotroFormat.getSiteBlock().getHumanReadable() + "</li>");
result.append("<li>Ring-bearer skirmish can be cancelled: " + (lotroFormat.canCancelRingBearerSkirmish() ? "yes" : "no") + "</li>");
result.append("<li>X-listed: ");
for (String blueprintId : lotroFormat.getBannedCards()) {
String fullName = GameUtils.getFullName(_library.getLotroCardBlueprint(blueprintId));
result.append("<i>" + fullName + "</i>, ");
}
for (String blueprintId : lotroFormat.getBannedCards())
result.append(GameUtils.getCardLink(blueprintId, _library.getLotroCardBlueprint(blueprintId)) + ", ");
if (lotroFormat.getBannedCards().size() == 0)
result.append("none,");
result.append("</li>");
result.append("<li>R-listed: ");
for (String blueprintId : lotroFormat.getRestrictedCards()) {
String fullName = GameUtils.getFullName(_library.getLotroCardBlueprint(blueprintId));
result.append("<i>" + fullName + "</i>, ");
}
for (String blueprintId : lotroFormat.getRestrictedCards())
result.append(GameUtils.getCardLink(blueprintId, _library.getLotroCardBlueprint(blueprintId)) + ", ");
if (lotroFormat.getRestrictedCards().size() == 0)
result.append("none,");
result.append("</li>");

View File

@@ -20,6 +20,12 @@
opacity: 0.2;
}
.cardHint {
display: inline;
color: #6f6fff;
cursor: pointer;
}
.pocket {
background-color: #000000;
border: 1px solid #ffffff;
@@ -194,6 +200,50 @@
});
resizeHall();
var infoDialog = $("<div></div>")
.dialog({
autoOpen: false,
closeOnEscape: true,
resizable: false,
title: "Card information"
});
$("body").click(
function (event) {
var tar = $(event.target);
if (tar.hasClass("cardHint")) {
var blueprintId = tar.attr("value");
var card = new Card(blueprintId, "SPECIAL", "hint", "");
infoDialog.html("");
infoDialog.html("<div style='scroll: auto'></div>");
var floatCardDiv = $("<div style='float: left;'></div>");
floatCardDiv.append(createFullCardDiv(card.imageUrl, card.foil, card.horizontal));
infoDialog.append(floatCardDiv);
var windowWidth = $(window).width();
var windowHeight = $(window).height();
var horSpace = 30;
var vertSpace = 45;
if (card.horizontal) {
// 500x360
infoDialog.dialog({width: Math.min(500 + horSpace, windowWidth), height: Math.min(360 + vertSpace, windowHeight)});
} else {
// 360x500
infoDialog.dialog({width: Math.min(360 + horSpace, windowWidth), height: Math.min(500 + vertSpace, windowHeight)});
}
infoDialog.dialog("open");
event.stopPropagation();
return false;
}
return true;
});
});
function resizeHall() {