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 a995d6010..cc280e7b9 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
@@ -32,12 +32,13 @@ var GempLotrGameUI = Class.extend({
selectionFunction: null,
- swipeOptions: null,
-
chatBoxDiv: null,
chatBox: null,
communication: null,
+ settingsAutoPass: false,
+ settingsAutoAccept: false,
+
init: function(communication) {
log("ui initialized");
this.communication = communication;
@@ -710,13 +711,17 @@ var GempLotrGameUI = Class.extend({
.dialog("option", "width", "600")
.dialog("option", "height", "300");
+ var finishChoice = function() {
+ that.dialogInstance.dialog("close");
+ $("#arbitraryChoice").html("");
+ that.clearSelection();
+ that.decisionFunction(id, "" + selectedCardIds);
+ };
+
if (min == 0) {
this.dialogInstance.dialog("option", "buttons", {
"DONE": function() {
- $(this).dialog("close");
- $("#arbitraryChoice").html("");
- that.clearSelection();
- that.decisionFunction(id, "" + selectedCardIds);
+ finishChoice();
}
});
}
@@ -741,17 +746,18 @@ var GempLotrGameUI = Class.extend({
if (selectedCardIds.length == min) {
this.dialogInstance.dialog("option", "buttons", {
"DONE": function() {
- $(this).dialog("close");
- $("#arbitraryChoice").html("");
- that.clearSelection();
- that.decisionFunction(id, "" + selectedCardIds);
+ finishChoice();
}
});
}
if (selectedCardIds.length == max) {
- that.clearSelection();
- $(".card:cardId(" + cardId + ")").addClass("selectedCard");
+ if (that.settingsAutoAccept) {
+ finishChoice();
+ } else {
+ that.clearSelection();
+ $(".card:cardId(" + cardId + ")").addClass("selectedCard");
+ }
} else {
$(".card:cardId(" + cardId + ")").removeClass("selectableCard").addClass("selectedCard");
}
@@ -775,13 +781,22 @@ var GempLotrGameUI = Class.extend({
var that = this;
+ if (cardIds.length == 0 && this.settingsAutoPass) {
+ that.decisionFunction(id, "");
+ return;
+ }
+
var selectedCardIds = new Array();
- this.alert.html(text + "
");
- $("#DONE").button().click(function() {
+ var finishChoice = function() {
that.alert.html("");
that.clearSelection();
that.decisionFunction(id, "" + selectedCardIds);
+ };
+
+ this.alert.html(text + "
");
+ $("#DONE").button().click(function() {
+ finishChoice();
});
for (var i = 0; i < cardIds.length; i++) {
@@ -805,7 +820,12 @@ var GempLotrGameUI = Class.extend({
if (actions.length == 1) {
var action = actions[0];
selectedCardIds.push(action.actionId);
- that.clearSelection();
+ if (this.settingsAutoAccept) {
+ finishChoice();
+ } else {
+ that.clearSelection();
+ $(".card:cardId(" + cardId + ")").addClass("selectedCard");
+ }
}
};
@@ -822,6 +842,8 @@ var GempLotrGameUI = Class.extend({
var that = this;
+ var selectedActionIds = new Array();
+
this.dialogInstance
.html("