Game replay and changes in playing cards.
This commit is contained in:
@@ -91,7 +91,10 @@ public class PlayEventAction extends AbstractCostToEffectAction {
|
|||||||
if (cost != null)
|
if (cost != null)
|
||||||
return cost;
|
return cost;
|
||||||
|
|
||||||
|
|
||||||
if (!_cardPlayed) {
|
if (!_cardPlayed) {
|
||||||
|
if (_eventPlayed.getZone() != null)
|
||||||
|
game.getGameState().removeCardsFromZone(_eventPlayed.getOwner(), Collections.singleton(_eventPlayed));
|
||||||
_cardPlayed = true;
|
_cardPlayed = true;
|
||||||
return _playCardEffect;
|
return _playCardEffect;
|
||||||
}
|
}
|
||||||
@@ -105,6 +108,8 @@ public class PlayEventAction extends AbstractCostToEffectAction {
|
|||||||
|
|
||||||
if (!_cardDiscarded && !_skipDiscardCard) {
|
if (!_cardDiscarded && !_skipDiscardCard) {
|
||||||
_cardDiscarded = true;
|
_cardDiscarded = true;
|
||||||
|
if (_eventPlayed.getZone() != null)
|
||||||
|
game.getGameState().removeCardsFromZone(_eventPlayed.getOwner(), Collections.singleton(_eventPlayed));
|
||||||
final Zone targetZone = _playCardEffect.getPlayEventResult().getTargetZone();
|
final Zone targetZone = _playCardEffect.getPlayEventResult().getTargetZone();
|
||||||
if (targetZone != null)
|
if (targetZone != null)
|
||||||
game.getGameState().addCardToZone(game, _eventPlayed, targetZone);
|
game.getGameState().addCardToZone(game, _eventPlayed, targetZone);
|
||||||
|
|||||||
@@ -79,6 +79,8 @@ public class PlayPermanentAction extends AbstractCostToEffectAction {
|
|||||||
|
|
||||||
if (!_cardPutIntoPlay) {
|
if (!_cardPutIntoPlay) {
|
||||||
_cardPutIntoPlay = true;
|
_cardPutIntoPlay = true;
|
||||||
|
if (_permanentPlayed.getZone() != null)
|
||||||
|
game.getGameState().removeCardsFromZone(_permanentPlayed.getOwner(), Collections.singleton(_permanentPlayed));
|
||||||
game.getGameState().addCardToZone(game, _permanentPlayed, _zone);
|
game.getGameState().addCardToZone(game, _permanentPlayed, _zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,6 +95,8 @@ public class PlayPermanentAction extends AbstractCostToEffectAction {
|
|||||||
} else {
|
} else {
|
||||||
if (!_cardDiscarded) {
|
if (!_cardDiscarded) {
|
||||||
_cardDiscarded = true;
|
_cardDiscarded = true;
|
||||||
|
if (_permanentPlayed.getZone() != null)
|
||||||
|
game.getGameState().removeCardsFromZone(_permanentPlayed.getOwner(), Collections.singleton(_permanentPlayed));
|
||||||
game.getGameState().addCardToZone(game, _permanentPlayed, Zone.DISCARD);
|
game.getGameState().addCardToZone(game, _permanentPlayed, Zone.DISCARD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ public class GameEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public GameEvent card(PhysicalCard physicalCard) {
|
public GameEvent card(PhysicalCard physicalCard) {
|
||||||
GameEvent gameEvent = cardId(physicalCard.getCardId()).blueprintId(physicalCard.getBlueprintId()).participantId(physicalCard.getOwner()).zone(physicalCard.getZone()).side(physicalCard.getBlueprint().getSide().name());
|
GameEvent gameEvent = cardId(physicalCard.getCardId()).blueprintId(physicalCard.getBlueprintId()).participantId(physicalCard.getOwner()).zone(physicalCard.getZone());
|
||||||
if (physicalCard.getCardController() != null)
|
if (physicalCard.getCardController() != null)
|
||||||
gameEvent = gameEvent.controllerId(physicalCard.getCardController());
|
gameEvent = gameEvent.controllerId(physicalCard.getCardController());
|
||||||
PhysicalCard attachedTo = physicalCard.getAttachedTo();
|
PhysicalCard attachedTo = physicalCard.getAttachedTo();
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ public class PlayCardEffect extends AbstractEffect {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected FullEffectResult playEffectReturningResult(LotroGame game) {
|
protected FullEffectResult playEffectReturningResult(LotroGame game) {
|
||||||
game.getGameState().removeCardsFromZone(_cardPlayed.getOwner(), Collections.singleton(_cardPlayed));
|
|
||||||
return new FullEffectResult(Collections.singleton(new PlayCardResult(_cardPlayed, _attachedToCard)), true, true);
|
return new FullEffectResult(Collections.singleton(new PlayCardResult(_cardPlayed, _attachedToCard)), true, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ public class PlayEventEffect extends PlayCardEffect {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected FullEffectResult playEffectReturningResult(LotroGame game) {
|
protected FullEffectResult playEffectReturningResult(LotroGame game) {
|
||||||
game.getGameState().removeCardsFromZone(_cardPlayed.getOwner(), Collections.singleton(_cardPlayed));
|
|
||||||
return new FullEffectResult(Collections.singleton(_playEventResult), true, true);
|
return new FullEffectResult(Collections.singleton(_playEventResult), true, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,9 +126,16 @@ public class ServerResource {
|
|||||||
public StreamingOutput getReplay(
|
public StreamingOutput getReplay(
|
||||||
@PathParam("replayId") String replayId) throws ParserConfigurationException {
|
@PathParam("replayId") String replayId) throws ParserConfigurationException {
|
||||||
File gameReplayFolder = new File("i:\\gemp-lotr\\replay");
|
File gameReplayFolder = new File("i:\\gemp-lotr\\replay");
|
||||||
|
if (!replayId.contains("$"))
|
||||||
|
sendError(Response.Status.NOT_FOUND);
|
||||||
if (replayId.contains("."))
|
if (replayId.contains("."))
|
||||||
sendError(Response.Status.NOT_FOUND);
|
sendError(Response.Status.NOT_FOUND);
|
||||||
final File replayFile = new File(gameReplayFolder, replayId);
|
|
||||||
|
String[] split = replayId.split("\\$");
|
||||||
|
if (split.length != 2)
|
||||||
|
sendError(Response.Status.NOT_FOUND);
|
||||||
|
|
||||||
|
final File replayFile = new File(new File(gameReplayFolder, split[0]), split[1] + ".xml");
|
||||||
if (!replayFile.exists() || !replayFile.isFile())
|
if (!replayFile.exists() || !replayFile.isFile())
|
||||||
sendError(Response.Status.NOT_FOUND);
|
sendError(Response.Status.NOT_FOUND);
|
||||||
|
|
||||||
@@ -138,8 +145,9 @@ public class ServerResource {
|
|||||||
InputStream is = new FileInputStream(replayFile);
|
InputStream is = new FileInputStream(replayFile);
|
||||||
try {
|
try {
|
||||||
byte[] bytes = new byte[1024];
|
byte[] bytes = new byte[1024];
|
||||||
int count = is.read(bytes);
|
int count;
|
||||||
outputStream.write(bytes, 0, count);
|
while ((count = is.read(bytes)) != -1)
|
||||||
|
outputStream.write(bytes, 0, count);
|
||||||
} finally {
|
} finally {
|
||||||
is.close();
|
is.close();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,7 +75,8 @@ var ChatBoxUI = Class.extend({
|
|||||||
if (this.chatListDiv != null)
|
if (this.chatListDiv != null)
|
||||||
this.chatListDiv.css({ position: "absolute", left: x + width - userListWidth + "px", top: y + "px", width: userListWidth, height: height - this.talkBoxHeight - 3 * talkBoxPadding, overflow: "auto" });
|
this.chatListDiv.css({ position: "absolute", left: x + width - userListWidth + "px", top: y + "px", width: userListWidth, height: height - this.talkBoxHeight - 3 * talkBoxPadding, overflow: "auto" });
|
||||||
this.chatMessagesDiv.css({ position: "absolute", left: x + "px", top: y + "px", width: width - userListWidth, height: height - this.talkBoxHeight - 3 * talkBoxPadding, overflow: "auto" });
|
this.chatMessagesDiv.css({ position: "absolute", left: x + "px", top: y + "px", width: width - userListWidth, height: height - this.talkBoxHeight - 3 * talkBoxPadding, overflow: "auto" });
|
||||||
this.chatTalkDiv.css({ position: "absolute", left: x + talkBoxPadding + "px", top: y - 2 * talkBoxPadding + (height - this.talkBoxHeight) + "px", width: width - 3 * talkBoxPadding , height: this.talkBoxHeight });
|
if (this.chatTalkDiv != null)
|
||||||
|
this.chatTalkDiv.css({ position: "absolute", left: x + talkBoxPadding + "px", top: y - 2 * talkBoxPadding + (height - this.talkBoxHeight) + "px", width: width - 3 * talkBoxPadding , height: this.talkBoxHeight });
|
||||||
},
|
},
|
||||||
|
|
||||||
appendMessage: function(message, msgClass) {
|
appendMessage: function(message, msgClass) {
|
||||||
|
|||||||
@@ -10,6 +10,12 @@ var GameAnimations = Class.extend({
|
|||||||
this.game = gameUI;
|
this.game = gameUI;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getAnimationLength: function(origValue) {
|
||||||
|
if (this.game.replayMode)
|
||||||
|
return origValue * 2;
|
||||||
|
return origValue;
|
||||||
|
},
|
||||||
|
|
||||||
cardActivated: function(element, animate) {
|
cardActivated: function(element, animate) {
|
||||||
if (animate) {
|
if (animate) {
|
||||||
var that = this;
|
var that = this;
|
||||||
@@ -18,19 +24,19 @@ var GameAnimations = Class.extend({
|
|||||||
var cardId = element.getAttribute("cardId");
|
var cardId = element.getAttribute("cardId");
|
||||||
|
|
||||||
// Play-out game event animation only if it's not the player who initiated it
|
// Play-out game event animation only if it's not the player who initiated it
|
||||||
if (this.game.spectatorMode || (participantId != this.game.bottomPlayerId)) {
|
if (this.game.spectatorMode || this.game.replayMode || (participantId != this.game.bottomPlayerId)) {
|
||||||
var cardDiv = $(".card:cardId(" + cardId + ")");
|
var cardDiv = $(".card:cardId(" + cardId + ")");
|
||||||
if (cardDiv != null) {
|
if (cardDiv != null) {
|
||||||
$("#main").queue(
|
$("#main").queue(
|
||||||
function(next) {
|
function(next) {
|
||||||
$(".borderOverlay", cardDiv)
|
$(".borderOverlay", cardDiv)
|
||||||
.switchClass("borderOverlay", "highlightBorderOverlay", that.cardActivatedDuration / 6)
|
.switchClass("borderOverlay", "highlightBorderOverlay", that.getAnimationLength(that.cardActivatedDuration / 6))
|
||||||
.switchClass("highlightBorderOverlay", "borderOverlay", that.cardActivatedDuration / 6)
|
.switchClass("highlightBorderOverlay", "borderOverlay", that.getAnimationLength(that.cardActivatedDuration / 6))
|
||||||
.switchClass("borderOverlay", "highlightBorderOverlay", that.cardActivatedDuration / 6)
|
.switchClass("borderOverlay", "highlightBorderOverlay", that.getAnimationLength(that.cardActivatedDuration / 6))
|
||||||
.switchClass("highlightBorderOverlay", "borderOverlay", that.cardActivatedDuration / 6)
|
.switchClass("highlightBorderOverlay", "borderOverlay", that.getAnimationLength(that.cardActivatedDuration / 6))
|
||||||
.switchClass("borderOverlay", "highlightBorderOverlay", that.cardActivatedDuration / 6)
|
.switchClass("borderOverlay", "highlightBorderOverlay", that.getAnimationLength(that.cardActivatedDuration / 6))
|
||||||
.switchClass("highlightBorderOverlay", "borderOverlay", that.cardActivatedDuration / 6);
|
.switchClass("highlightBorderOverlay", "borderOverlay", that.getAnimationLength(that.cardActivatedDuration / 6));
|
||||||
setTimeout(next, that.cardActivatedDuration);
|
setTimeout(next, that.getAnimationLength(that.cardActivatedDuration));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -45,7 +51,7 @@ var GameAnimations = Class.extend({
|
|||||||
var blueprintId = element.getAttribute("blueprintId");
|
var blueprintId = element.getAttribute("blueprintId");
|
||||||
|
|
||||||
// Play-out game event animation only if it's not the player who initiated it
|
// Play-out game event animation only if it's not the player who initiated it
|
||||||
if (this.game.spectatorMode || (participantId != this.game.bottomPlayerId)) {
|
if (this.game.spectatorMode || this.game.replayMode || (participantId != this.game.bottomPlayerId)) {
|
||||||
var card = new Card(blueprintId, "ANIMATION", "anim", participantId);
|
var card = new Card(blueprintId, "ANIMATION", "anim", participantId);
|
||||||
var cardDiv = createSimpleCardDiv(card.imageUrl);
|
var cardDiv = createSimpleCardDiv(card.imageUrl);
|
||||||
|
|
||||||
@@ -61,40 +67,40 @@ var GameAnimations = Class.extend({
|
|||||||
var cardWidth = card.getWidthForHeight(cardHeight);
|
var cardWidth = card.getWidthForHeight(cardHeight);
|
||||||
|
|
||||||
$(cardDiv).css(
|
$(cardDiv).css(
|
||||||
{
|
{
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
left: (gameWidth / 2 - cardWidth / 4),
|
left: (gameWidth / 2 - cardWidth / 4),
|
||||||
top: gameHeight * (3 / 8),
|
top: gameHeight * (3 / 8),
|
||||||
width: cardWidth / 2,
|
width: cardWidth / 2,
|
||||||
height: cardHeight / 2,
|
height: cardHeight / 2,
|
||||||
"z-index": 100,
|
"z-index": 100,
|
||||||
opacity: 0});
|
opacity: 0});
|
||||||
|
|
||||||
$(cardDiv).animate(
|
$(cardDiv).animate(
|
||||||
{
|
{
|
||||||
left: "-=" + cardWidth / 4,
|
left: "-=" + cardWidth / 4,
|
||||||
top: "-=" + (gameHeight / 8),
|
top: "-=" + (gameHeight / 8),
|
||||||
width: "+=" + (cardWidth / 2),
|
width: "+=" + (cardWidth / 2),
|
||||||
height: "+=" + (cardHeight / 2),
|
height: "+=" + (cardHeight / 2),
|
||||||
opacity: 1},
|
opacity: 1},
|
||||||
{
|
{
|
||||||
duration: that.playEventDuration / 8,
|
duration: that.getAnimationLength(that.playEventDuration / 8),
|
||||||
easing: "linear",
|
easing: "linear",
|
||||||
queue: false,
|
queue: false,
|
||||||
complete: next});
|
complete: next});
|
||||||
}).queue(
|
}).queue(
|
||||||
function(next) {
|
function(next) {
|
||||||
setTimeout(next, that.playEventDuration * (5 / 8));
|
setTimeout(next, that.getAnimationLength(that.playEventDuration * (5 / 8)));
|
||||||
}).queue(
|
}).queue(
|
||||||
function(next) {
|
function(next) {
|
||||||
$(cardDiv).animate(
|
$(cardDiv).animate(
|
||||||
{
|
{
|
||||||
opacity: 0},
|
opacity: 0},
|
||||||
{
|
{
|
||||||
duration: that.playEventDuration / 4,
|
duration: that.getAnimationLength(that.playEventDuration / 4),
|
||||||
easing: "easeOutQuart",
|
easing: "easeOutQuart",
|
||||||
queue: false,
|
queue: false,
|
||||||
complete: next});
|
complete: next});
|
||||||
}).queue(
|
}).queue(
|
||||||
function(next) {
|
function(next) {
|
||||||
$(cardDiv).remove();
|
$(cardDiv).remove();
|
||||||
@@ -113,7 +119,7 @@ var GameAnimations = Class.extend({
|
|||||||
var targetCardIds = element.getAttribute("otherCardIds").split(",");
|
var targetCardIds = element.getAttribute("otherCardIds").split(",");
|
||||||
|
|
||||||
// Play-out card affects card animation only if it's not the player who initiated it
|
// Play-out card affects card animation only if it's not the player who initiated it
|
||||||
if (this.game.spectatorMode || (participantId != this.game.bottomPlayerId)) {
|
if (this.game.spectatorMode || this.game.replayMode || this.game.replayMode || (participantId != this.game.bottomPlayerId)) {
|
||||||
$("#main").queue(
|
$("#main").queue(
|
||||||
function(next) {
|
function(next) {
|
||||||
for (var i = 0; i < targetCardIds.length; i++) {
|
for (var i = 0; i < targetCardIds.length; i++) {
|
||||||
@@ -132,29 +138,29 @@ var GameAnimations = Class.extend({
|
|||||||
var targetCardHeight = $(targetCard).height();
|
var targetCardHeight = $(targetCard).height();
|
||||||
|
|
||||||
$(cardDiv).css(
|
$(cardDiv).css(
|
||||||
{
|
{
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
left: $(targetCard).position().left,
|
left: $(targetCard).position().left,
|
||||||
top: $(targetCard).position().top,
|
top: $(targetCard).position().top,
|
||||||
width: targetCardWidth,
|
width: targetCardWidth,
|
||||||
height: targetCardHeight,
|
height: targetCardHeight,
|
||||||
"z-index": 100,
|
"z-index": 100,
|
||||||
opacity: 1});
|
opacity: 1});
|
||||||
$(cardDiv).animate(
|
$(cardDiv).animate(
|
||||||
{
|
{
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
left: "-=" + (targetCardWidth / 2),
|
left: "-=" + (targetCardWidth / 2),
|
||||||
top: "-=" + (targetCardHeight / 2),
|
top: "-=" + (targetCardHeight / 2),
|
||||||
width: "+=" + targetCardWidth,
|
width: "+=" + targetCardWidth,
|
||||||
height: "+=" + targetCardHeight},
|
height: "+=" + targetCardHeight},
|
||||||
{
|
{
|
||||||
duration: that.cardAffectsCardDuration,
|
duration: that.getAnimationLength(that.cardAffectsCardDuration),
|
||||||
easing: "easeInQuart",
|
easing: "easeInQuart",
|
||||||
queue: false,
|
queue: false,
|
||||||
complete: null});
|
complete: null});
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(next, that.cardAffectsCardDuration);
|
setTimeout(next, that.getAnimationLength(that.cardAffectsCardDuration));
|
||||||
}
|
}
|
||||||
}).queue(
|
}).queue(
|
||||||
function(next) {
|
function(next) {
|
||||||
@@ -165,7 +171,7 @@ var GameAnimations = Class.extend({
|
|||||||
$(this).remove();
|
$(this).remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -217,7 +223,7 @@ var GameAnimations = Class.extend({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (animate && (this.game.spectatorMode || (participantId != this.game.bottomPlayerId))
|
if (animate && (this.game.spectatorMode || this.game.replayMode || (participantId != this.game.bottomPlayerId))
|
||||||
&& zone != "DISCARD" && zone != "DEAD" && zone != "HAND") {
|
&& zone != "DISCARD" && zone != "DEAD" && zone != "HAND") {
|
||||||
var oldValues = {};
|
var oldValues = {};
|
||||||
|
|
||||||
@@ -241,32 +247,32 @@ var GameAnimations = Class.extend({
|
|||||||
var cardWidth = card.getWidthForHeight(cardHeight);
|
var cardWidth = card.getWidthForHeight(cardHeight);
|
||||||
|
|
||||||
$(cardDiv).css(
|
$(cardDiv).css(
|
||||||
{
|
{
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
left: (gameWidth / 2 - cardWidth / 4),
|
left: (gameWidth / 2 - cardWidth / 4),
|
||||||
top: gameHeight * (3 / 8),
|
top: gameHeight * (3 / 8),
|
||||||
width: cardWidth / 2,
|
width: cardWidth / 2,
|
||||||
height: cardHeight / 2,
|
height: cardHeight / 2,
|
||||||
"z-index": 100,
|
"z-index": 100,
|
||||||
opacity: 0});
|
opacity: 0});
|
||||||
|
|
||||||
$(cardDiv).animate(
|
$(cardDiv).animate(
|
||||||
{
|
{
|
||||||
opacity: 1},
|
opacity: 1},
|
||||||
{
|
{
|
||||||
duration: that.putCardIntoPlayDuration / 8,
|
duration: that.getAnimationLength(that.putCardIntoPlayDuration / 8),
|
||||||
easing: "linear",
|
easing: "linear",
|
||||||
step: function(now, fx) {
|
step: function(now, fx) {
|
||||||
layoutCardElem(cardDiv,
|
layoutCardElem(cardDiv,
|
||||||
(gameWidth / 2 - cardWidth / 4) - now * (cardWidth / 4),
|
(gameWidth / 2 - cardWidth / 4) - now * (cardWidth / 4),
|
||||||
gameHeight * (3 / 8) - now * (gameHeight / 8),
|
gameHeight * (3 / 8) - now * (gameHeight / 8),
|
||||||
cardWidth / 2 + now * (cardWidth / 2),
|
cardWidth / 2 + now * (cardWidth / 2),
|
||||||
cardHeight / 2 + now * (cardHeight / 2), 100);
|
cardHeight / 2 + now * (cardHeight / 2), 100);
|
||||||
},
|
},
|
||||||
complete: next});
|
complete: next});
|
||||||
}).queue(
|
}).queue(
|
||||||
function(next) {
|
function(next) {
|
||||||
setTimeout(next, that.putCardIntoPlayDuration * (5 / 8));
|
setTimeout(next, that.getAnimationLength(that.putCardIntoPlayDuration * (5 / 8)));
|
||||||
}).queue(
|
}).queue(
|
||||||
function(next) {
|
function(next) {
|
||||||
var cardDiv = $(".card:cardId(" + cardId + ")");
|
var cardDiv = $(".card:cardId(" + cardId + ")");
|
||||||
@@ -278,20 +284,20 @@ var GameAnimations = Class.extend({
|
|||||||
var startHeight = cardDiv.height();
|
var startHeight = cardDiv.height();
|
||||||
|
|
||||||
$(cardDiv).animate(
|
$(cardDiv).animate(
|
||||||
{
|
{
|
||||||
left: oldValues["left"]},
|
left: oldValues["left"]},
|
||||||
{
|
{
|
||||||
duration: that.putCardIntoPlayDuration / 4,
|
duration: that.getAnimationLength(that.putCardIntoPlayDuration / 4),
|
||||||
easing: "linear",
|
easing: "linear",
|
||||||
step: function(now, fx) {
|
step: function(now, fx) {
|
||||||
var state = fx.state;
|
var state = fx.state;
|
||||||
layoutCardElem(cardDiv,
|
layoutCardElem(cardDiv,
|
||||||
startLeft + (oldValues["left"] - startLeft) * state,
|
startLeft + (oldValues["left"] - startLeft) * state,
|
||||||
startTop + (oldValues["top"] - startTop) * state,
|
startTop + (oldValues["top"] - startTop) * state,
|
||||||
startWidth + (oldValues["width"] - startWidth) * state,
|
startWidth + (oldValues["width"] - startWidth) * state,
|
||||||
startHeight + (oldValues["height"] - startHeight) * state, 100);
|
startHeight + (oldValues["height"] - startHeight) * state, 100);
|
||||||
},
|
},
|
||||||
complete: next});
|
complete: next});
|
||||||
}).queue(
|
}).queue(
|
||||||
function(next) {
|
function(next) {
|
||||||
var cardDiv = $(".card:cardId(" + cardId + ")");
|
var cardDiv = $(".card:cardId(" + cardId + ")");
|
||||||
@@ -327,7 +333,7 @@ var GameAnimations = Class.extend({
|
|||||||
if (index != -1)
|
if (index != -1)
|
||||||
cardData.attachedCards.splice(index, 1);
|
cardData.attachedCards.splice(index, 1);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
var card = $(".card:cardId(" + cardId + ")");
|
var card = $(".card:cardId(" + cardId + ")");
|
||||||
var cardData = card.data("card");
|
var cardData = card.data("card");
|
||||||
@@ -358,18 +364,18 @@ var GameAnimations = Class.extend({
|
|||||||
var cardRemovedIds = element.getAttribute("otherCardIds").split(",");
|
var cardRemovedIds = element.getAttribute("otherCardIds").split(",");
|
||||||
var participantId = element.getAttribute("participantId");
|
var participantId = element.getAttribute("participantId");
|
||||||
|
|
||||||
if (animate && (this.game.spectatorMode || (participantId != this.game.bottomPlayerId))) {
|
if (animate && (this.game.spectatorMode || this.game.replayMode || (participantId != this.game.bottomPlayerId))) {
|
||||||
$("#main").queue(
|
$("#main").queue(
|
||||||
function(next) {
|
function(next) {
|
||||||
$(".card:cardId(" + cardRemovedIds + ")")
|
$(".card:cardId(" + cardRemovedIds + ")")
|
||||||
.animate(
|
.animate(
|
||||||
{
|
{
|
||||||
opacity: 0},
|
opacity: 0},
|
||||||
{
|
{
|
||||||
duration: that.removeCardFromPlayDuration,
|
duration: that.getAnimationLength(that.removeCardFromPlayDuration),
|
||||||
easing: "easeOutQuart",
|
easing: "easeOutQuart",
|
||||||
queue: false});
|
queue: false});
|
||||||
setTimeout(next, that.removeCardFromPlayDuration);
|
setTimeout(next, that.getAnimationLength(that.removeCardFromPlayDuration));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
$("#main").queue(
|
$("#main").queue(
|
||||||
@@ -393,7 +399,7 @@ var GameAnimations = Class.extend({
|
|||||||
if (index != -1)
|
if (index != -1)
|
||||||
cardData.attachedCards.splice(index, 1);
|
cardData.attachedCards.splice(index, 1);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
card.remove();
|
card.remove();
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ var GempLotrGameUI = Class.extend({
|
|||||||
this.displayCard(card);
|
this.displayCard(card);
|
||||||
|
|
||||||
var cardId = card.cardId;
|
var cardId = card.cardId;
|
||||||
if (cardId.length < 4 || cardId.substring(0, 4) != "temp")
|
if (!this.replayMode && (cardId.length < 4 || cardId.substring(0, 4) != "temp"))
|
||||||
this.getCardModifiersFunction(cardId, this.setCardModifiers);
|
this.getCardModifiersFunction(cardId, this.setCardModifiers);
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -292,21 +292,21 @@ var GempLotrGameUI = Class.extend({
|
|||||||
initializeDialogs: function() {
|
initializeDialogs: function() {
|
||||||
this.smallDialog = $("<div></div>")
|
this.smallDialog = $("<div></div>")
|
||||||
.dialog({
|
.dialog({
|
||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
closeOnEscape: false,
|
closeOnEscape: false,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
width: 400,
|
width: 400,
|
||||||
height: 200
|
height: 200
|
||||||
});
|
});
|
||||||
|
|
||||||
this.cardActionDialog = $("<div></div>")
|
this.cardActionDialog = $("<div></div>")
|
||||||
.dialog({
|
.dialog({
|
||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
closeOnEscape: false,
|
closeOnEscape: false,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
width: 600,
|
width: 600,
|
||||||
height: 300
|
height: 300
|
||||||
});
|
});
|
||||||
|
|
||||||
var that = this;
|
var that = this;
|
||||||
|
|
||||||
@@ -321,15 +321,15 @@ var GempLotrGameUI = Class.extend({
|
|||||||
|
|
||||||
this.infoDialog = $("<div></div>")
|
this.infoDialog = $("<div></div>")
|
||||||
.dialog({
|
.dialog({
|
||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
closeOnEscape: true,
|
closeOnEscape: true,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
title: "Card information",
|
title: "Card information",
|
||||||
minHeight: 80,
|
minHeight: 80,
|
||||||
minWidth: 200,
|
minWidth: 200,
|
||||||
width: Math.max(600, width * 0.75),
|
width: Math.max(600, width * 0.75),
|
||||||
height: Math.max(300, height * 0.75)
|
height: Math.max(300, height * 0.75)
|
||||||
});
|
});
|
||||||
|
|
||||||
var swipeOptions = {
|
var swipeOptions = {
|
||||||
threshold: 20,
|
threshold: 20,
|
||||||
@@ -472,7 +472,7 @@ var GempLotrGameUI = Class.extend({
|
|||||||
var that = this;
|
var that = this;
|
||||||
this.communication.getReplay(replayId,
|
this.communication.getReplay(replayId,
|
||||||
function(xml) {
|
function(xml) {
|
||||||
that.processXml(xml, false);
|
that.processXml(xml, true);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -503,7 +503,7 @@ var GempLotrGameUI = Class.extend({
|
|||||||
processXml: function(xml, animate) {
|
processXml: function(xml, animate) {
|
||||||
log(xml);
|
log(xml);
|
||||||
var root = xml.documentElement;
|
var root = xml.documentElement;
|
||||||
if (root.tagName == 'gameState' || root.tagName == 'update')
|
if (root.tagName == 'gameState' || root.tagName == 'update' || root.tagName == 'gameReplay')
|
||||||
this.processGameEventsXml(root, animate);
|
this.processGameEventsXml(root, animate);
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -720,13 +720,13 @@ var GempLotrGameUI = Class.extend({
|
|||||||
this.smallDialog
|
this.smallDialog
|
||||||
.html(text + "<br /><input id='integerDecision' type='text' value='0'>")
|
.html(text + "<br /><input id='integerDecision' type='text' value='0'>")
|
||||||
.dialog("option", "buttons",
|
.dialog("option", "buttons",
|
||||||
{
|
{
|
||||||
"OK": function() {
|
"OK": function() {
|
||||||
$(this).dialog("close");
|
$(this).dialog("close");
|
||||||
that.decisionFunction(id, $("#integerDecision").val());
|
that.decisionFunction(id, $("#integerDecision").val());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
$("#integerDecision").SpinnerControl({ type: 'range',
|
$("#integerDecision").SpinnerControl({ type: 'range',
|
||||||
typedata: {
|
typedata: {
|
||||||
@@ -758,13 +758,13 @@ var GempLotrGameUI = Class.extend({
|
|||||||
this.smallDialog
|
this.smallDialog
|
||||||
.html(html)
|
.html(html)
|
||||||
.dialog("option", "buttons",
|
.dialog("option", "buttons",
|
||||||
{
|
{
|
||||||
"OK": function() {
|
"OK": function() {
|
||||||
$(this).dialog("close");
|
$(this).dialog("close");
|
||||||
that.decisionFunction(id, $("#multipleChoiceDecision").val());
|
that.decisionFunction(id, $("#multipleChoiceDecision").val());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
this.smallDialog.dialog("open");
|
this.smallDialog.dialog("open");
|
||||||
},
|
},
|
||||||
@@ -1013,8 +1013,8 @@ var GempLotrGameUI = Class.extend({
|
|||||||
$(div).find('LI.hover').removeClass('hover');
|
$(div).find('LI.hover').removeClass('hover');
|
||||||
$(this).parent().addClass('hover');
|
$(this).parent().addClass('hover');
|
||||||
}).mouseout(function() {
|
}).mouseout(function() {
|
||||||
$(div).find('LI.hover').removeClass('hover');
|
$(div).find('LI.hover').removeClass('hover');
|
||||||
});
|
});
|
||||||
|
|
||||||
var getRidOfContextMenu = function() {
|
var getRidOfContextMenu = function() {
|
||||||
$(div).remove();
|
$(div).remove();
|
||||||
|
|||||||
Reference in New Issue
Block a user