diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/includes/changeLog.html b/gemp-lotr/gemp-lotr-web/src/main/webapp/includes/changeLog.html index fe09814ee..12359bca6 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/webapp/includes/changeLog.html +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/includes/changeLog.html @@ -21,6 +21,8 @@ whole card without scrolling window. - Arbitrary multiple card choice now works correctly. - Saruman no longer can be assigned to skirmish. - Adding clickable card names to game chat. +- Improved the speed of deck builder, also eliminated any problems with invalid deck statistics display. +- Split the culture buttons in deck builder into two bars, one for free people, one for shadow cultures. 26 Sept. 2011 - Changed the cost-to-effect actions to follow the "do as much as possible" route, rathern than can/can't do. diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/deckBuildingUi.js b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/deckBuildingUi.js index 8f4c57845..6ca432036 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/deckBuildingUi.js +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/deckBuildingUi.js @@ -24,6 +24,9 @@ var GempLotrDeckBuildingUI = Class.extend({ count: 18, filter: null, + filterDirty: false, + deckDirty: false, + init: function() { var that = this; @@ -43,12 +46,14 @@ var GempLotrDeckBuildingUI = Class.extend({ this.filterDiv = $("
"); - this.filterDiv.append("
" + this.filterDiv.append("
" + "" + "" + "" + "" + "" + + "
"); + this.filterDiv.append("
" + "" + "" + "" @@ -78,7 +83,8 @@ var GempLotrDeckBuildingUI = Class.extend({ this.collectionDiv.append(this.filterDiv); - $("#culture").buttonset(); + $("#culture1").buttonset(); + $("#culture2").buttonset(); var filterOut = function() { that.filter = that.calculateNormalFilter(); @@ -228,10 +234,8 @@ var GempLotrDeckBuildingUI = Class.extend({ that.displayCardInfo(selectedCardElem.data("card")); } else if (selectedCardElem.hasClass("cardInCollection")) { that.selectionFunc(selectedCardElem.data("card").blueprintId, selectedCardElem.data("card").zone); - that.updateDeckStats(); } else if (selectedCardElem.hasClass("cardInDeck")) { that.removeCardFromDeck(selectedCardElem); - that.updateDeckStats(); } return false; } @@ -268,6 +272,8 @@ var GempLotrDeckBuildingUI = Class.extend({ this.comm.getDeck("default", function(xml) { that.setupDeck(xml); }); + + this.checkDeckStatsDirty(); }, displayCardInfo: function(card) { @@ -361,7 +367,12 @@ var GempLotrDeckBuildingUI = Class.extend({ calculateNormalFilter: function() { var cultures = new Array(); - $("label", $("#culture")).each( + $("label", $("#culture1")).each( + function() { + if ($(this).hasClass("ui-state-active")) + cultures.push($(this).prop("id").substring(5)); + }); + $("label", $("#culture2")).each( function() { if ($(this).hasClass("ui-state-active")) cultures.push($(this).prop("id").substring(5)); @@ -400,14 +411,34 @@ var GempLotrDeckBuildingUI = Class.extend({ var div = this.addCardToContainer(blueprintId, side, this.drawDeckDiv) div.addClass("cardInDeck"); } + + this.deckDirty = true; + }, + + checkDeckStatsDirty: function() { + if (this.deckDirty) { + this.deckDirty = false; + this.updateDeckStats(); + } else { + var that = this; + setTimeout( + function() { + that.checkDeckStatsDirty() + }, 100); + } }, updateDeckStats: function() { + var that = this; var deckContents = this.getDeckContents(); if (deckContents != null) this.comm.getDeckStats(deckContents, function(html) { $("#deckStats").html(html); + setTimeout( + function() { + that.checkDeckStatsDirty() + }, 100); }); }, @@ -420,6 +451,8 @@ var GempLotrDeckBuildingUI = Class.extend({ cardDiv.remove(); } this.layoutUI(); + + this.deckDirty = true; }, getCollection: function() { @@ -447,8 +480,6 @@ var GempLotrDeckBuildingUI = Class.extend({ this.layoutUI(); } - this.updateDeckStats(); - this.getCollection(); } },