From b193dec39f3cc575a7ad0e4a5fb06984345516af Mon Sep 17 00:00:00 2001 From: "marcins78@gmail.com" Date: Wed, 7 Mar 2012 10:14:34 +0000 Subject: [PATCH] Maybe fixing some Game UI issues. --- .../src/main/webapp/js/gameAnimations.js | 7 +- .../src/main/webapp/js/gameUi.js | 80 ++++++++++--------- 2 files changed, 45 insertions(+), 42 deletions(-) diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gameAnimations.js b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gameAnimations.js index c961bf2af..e48f8bf98 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gameAnimations.js +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gameAnimations.js @@ -543,9 +543,10 @@ var GameAnimations = Class.extend({ var cardId = element.getAttribute("cardId"); var opposingCardIds = element.getAttribute("otherCardIds").split(","); - $(".card:cardId(" + opposingCardIds + ")").each(function() { - $(this).data("card").skirmish = true; - }); + if (opposingCardIds.length > 0) + $(".card:cardId(" + opposingCardIds + ")").each(function() { + $(this).data("card").skirmish = true; + }); if (cardId != null) $(".card:cardId(" + cardId + ")").each(function() { diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gameUi.js b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gameUi.js index f5865d7c4..716f8025e 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gameUi.js +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gameUi.js @@ -651,21 +651,21 @@ var GempLotrGameUI = Class.extend({ initializeDialogs: function() { this.smallDialog = $("
") .dialog({ - autoOpen: false, - closeOnEscape: false, - resizable: false, - width: 400, - height: 200 - }); + autoOpen: false, + closeOnEscape: false, + resizable: false, + width: 400, + height: 200 + }); this.cardActionDialog = $("
") .dialog({ - autoOpen: false, - closeOnEscape: false, - resizable: true, - width: 600, - height: 300 - }); + autoOpen: false, + closeOnEscape: false, + resizable: true, + width: 600, + height: 300 + }); var that = this; @@ -680,11 +680,11 @@ var GempLotrGameUI = Class.extend({ this.infoDialog = $("
") .dialog({ - autoOpen: false, - closeOnEscape: true, - resizable: false, - title: "Card information" - }); + autoOpen: false, + closeOnEscape: true, + resizable: false, + title: "Card information" + }); var swipeOptions = { threshold: 20, @@ -1165,12 +1165,12 @@ var GempLotrGameUI = Class.extend({ if (!this.replayMode) { this.smallDialog.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', @@ -1208,12 +1208,12 @@ var GempLotrGameUI = Class.extend({ if (!this.replayMode) { this.smallDialog.dialog("option", "buttons", - { - "OK": function() { - that.smallDialog.dialog("close"); - that.decisionFunction(id, $("#multipleChoiceDecision").val()); - } - }); + { + "OK": function() { + that.smallDialog.dialog("close"); + that.decisionFunction(id, $("#multipleChoiceDecision").val()); + } + }); } } else { this.smallDialog.append("
"); @@ -1421,7 +1421,8 @@ var GempLotrGameUI = Class.extend({ return; } else { that.clearSelection(); - $(".card:cardId(" + selectedCardIds + ")").addClass("selectedCard"); + if (selectedCardIds.length > 0) + $(".card:cardId(" + selectedCardIds + ")").addClass("selectedCard"); } } else { $(".card:cardId(" + cardId + ")").removeClass("selectableCard").addClass("selectedCard"); @@ -1600,8 +1601,8 @@ var GempLotrGameUI = Class.extend({ $(div).find('LI.hover').removeClass('hover'); $(this).parent().addClass('hover'); }).mouseout(function() { - $(div).find('LI.hover').removeClass('hover'); - }); + $(div).find('LI.hover').removeClass('hover'); + }); var getRidOfContextMenu = function() { $(div).remove(); @@ -1765,7 +1766,8 @@ var GempLotrGameUI = Class.extend({ return; } else { that.clearSelection(); - $(".card:cardId(" + selectedCardIds + ")").addClass("selectedCard"); + if (selectedCardIds.length > 0) + $(".card:cardId(" + selectedCardIds + ")").addClass("selectedCard"); } } else { $(".card:cardId(" + cardId + ")").removeClass("selectableCard").addClass("selectedCard"); @@ -1803,12 +1805,12 @@ var GempLotrGameUI = Class.extend({ for (var i = 0; i < freeCharacters.length; i++) { assignmentMap[freeCharacters[i]] = freeCharacters[i]; } - - $(".card:cardId(" + minions + ")").each(function() { - var card = $(this).data("card"); - if (card.assign != null) - assignmentMap[card.assign] += " " + card.cardId; - }); + if (minions.length > 0) + $(".card:cardId(" + minions + ")").each(function() { + var card = $(this).data("card"); + if (card.assign != null) + assignmentMap[card.assign] += " " + card.cardId; + }); var assignmentArray = new Array(); for (var i = 0; i < freeCharacters.length; i++) {