Merchant look&feel.

This commit is contained in:
marcins78@gmail.com
2012-03-14 12:12:40 +00:00
parent fec1c22509
commit 93b1f9fbc7
3 changed files with 37 additions and 12 deletions

View File

@@ -55,6 +55,23 @@ public class ParametrizedMerchantTest {
} }
} }
// @Test
public void plotPriceEasingFromSetup() {
Date setupDate = new Date(0);
MerchantDAO merchantDao = new MockMerchantDAO();
ParametrizedMerchant merchant = new ParametrizedMerchant(new LotroCardBlueprintLibrary());
merchant.setMerchantDao(merchantDao);
merchant.setMerchantSetupDate(setupDate);
long hour = 1000 * 60 * 60;
for (long time = 0; time < hour * 24 * 35L; time += hour * 2)
System.out.println(time / hour + "," + ((int) merchant.getCardSellPrice("1_1", new Date(time))) + "," + ((int) merchant.getCardBuyPrice("1_1", new Date(time))));
}
private void assertEqualsMoreOrLess(int expected, int given) { private void assertEqualsMoreOrLess(int expected, int given) {
assertTrue("Expected " + expected + " more or less, but received " + given, given <= expected + 1 && given >= expected - 1); assertTrue("Expected " + expected + " more or less, but received " + given, given <= expected + 1 && given >= expected - 1);
} }

View File

@@ -46,20 +46,20 @@ var GempLotrMerchantUI = Class.extend({
this.infoDialog = $("<div></div>") this.infoDialog = $("<div></div>")
.dialog({ .dialog({
autoOpen: false, autoOpen: false,
closeOnEscape: true, closeOnEscape: true,
resizable: false, resizable: false,
title: "Card information" title: "Card information"
}); });
this.questionDialog = $("<div></div>") this.questionDialog = $("<div></div>")
.dialog({ .dialog({
autoOpen: false, autoOpen: false,
closeOnEscape: true, closeOnEscape: true,
resizable: false, resizable: false,
modal: true, modal: true,
title: "Merchant operation" title: "Merchant operation"
}); });
var swipeOptions = { var swipeOptions = {
threshold: 20, threshold: 20,
@@ -230,7 +230,7 @@ var GempLotrMerchantUI = Class.extend({
}); });
cardDiv.append(buyBut); cardDiv.append(buyBut);
} }
if (sellPrice != null && sellPrice <= this.currencyCount) { if (sellPrice != null) {
var formattedSellPrice = this.formatPrice(sellPrice); var formattedSellPrice = this.formatPrice(sellPrice);
var sellBut = $("<div class='sellPrice'>Buy for<br/>" + this.formatPrice(sellPrice) + "</div>").button(); var sellBut = $("<div class='sellPrice'>Buy for<br/>" + this.formatPrice(sellPrice) + "</div>").button();
sellBut.click( sellBut.click(
@@ -242,6 +242,10 @@ var GempLotrMerchantUI = Class.extend({
}); });
}); });
}); });
if (parseInt(sellPrice) > parseInt(this.currencyCount)) {
sellBut.button({disabled: true});
sellBut.css({color: "#ff0000"});
}
cardDiv.append(sellBut); cardDiv.append(sellBut);
} }
if (tradeFoil == "true") { if (tradeFoil == "true") {

View File

@@ -19,6 +19,10 @@
opacity: 0.2; opacity: 0.2;
} }
.buyPrice.ui-state-disabled, .sellPrice.ui-state-disabled, .tradeFoil {
opacity: 0.6;
}
.owned { .owned {
background-color: #000000; background-color: #000000;
border: 1px solid #ffffff; border: 1px solid #ffffff;