Phases being visible and showing Fierce/Extra Assignments and Skirmishes.

This commit is contained in:
marcins78@gmail.com
2012-03-15 01:19:54 +00:00
parent 0c5a6bc2a6
commit 47d38e1345
9 changed files with 52 additions and 63 deletions

View File

@@ -1,7 +1,7 @@
package com.gempukku.lotro.common;
public enum Phase {
PUT_RING_BEARER(null), PLAY_STARTING_FELLOWSHIP(null), FELLOWSHIP("Fellowship"), SHADOW("Shadow"), MANEUVER("Maneuver"), ARCHERY("Archery"), ASSIGNMENT("Assignment"), SKIRMISH("Skirmish"), REGROUP("Regroup"), BETWEEN_TURNS(null);
PUT_RING_BEARER("Put Ring-bearer"), PLAY_STARTING_FELLOWSHIP("Play starting fellowship"), FELLOWSHIP("Fellowship"), SHADOW("Shadow"), MANEUVER("Maneuver"), ARCHERY("Archery"), ASSIGNMENT("Assignment"), SKIRMISH("Skirmish"), REGROUP("Regroup"), BETWEEN_TURNS("Between turns");
private String _humanReadable;

View File

@@ -1,6 +1,5 @@
package com.gempukku.lotro.communication;
import com.gempukku.lotro.common.Phase;
import com.gempukku.lotro.common.Token;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.logic.decisions.AwaitingDecision;
@@ -25,7 +24,7 @@ public interface GameStateListener {
public void setCurrentPlayerId(String playerId);
public void setCurrentPhase(Phase currentPhase);
public void setCurrentPhase(String currentPhase);
public void addAssignment(PhysicalCard fp, Set<PhysicalCard> minions);

View File

@@ -34,7 +34,7 @@ public class EventSerializer {
eventElem.setAttribute("allParticipantIds", sb.toString());
}
if (gameEvent.getPhase() != null)
eventElem.setAttribute("phase", gameEvent.getPhase().name());
eventElem.setAttribute("phase", gameEvent.getPhase());
if (gameEvent.getTargetCardId() != null)
eventElem.setAttribute("targetCardId", gameEvent.getTargetCardId().toString());
if (gameEvent.getZone() != null)

View File

@@ -1,7 +1,6 @@
package com.gempukku.lotro.game.state;
import com.gempukku.lotro.common.CardType;
import com.gempukku.lotro.common.Phase;
import com.gempukku.lotro.common.Token;
import com.gempukku.lotro.common.Zone;
import com.gempukku.lotro.game.PhysicalCard;
@@ -33,7 +32,7 @@ public class GameEvent {
private String _blueprintId;
private Integer _cardId;
private Integer _targetCardId;
private Phase _phase;
private String _phase;
private Integer _count;
private Token _token;
private int[] _otherCardIds;
@@ -198,11 +197,11 @@ public class GameEvent {
return this;
}
public Phase getPhase() {
public String getPhase() {
return _phase;
}
public GameEvent phase(Phase phase) {
public GameEvent phase(String phase) {
_phase = phase;
return this;
}

View File

@@ -146,13 +146,21 @@ public class GameState {
return Collections.unmodifiableSet(_gameStateListeners);
}
private String getPhaseString() {
if (isFierceSkirmishes())
return "Fierce " + _currentPhase.getHumanReadable();
if (isExtraSkirmishes())
return "Extra " + _currentPhase.getHumanReadable();
return _currentPhase.getHumanReadable();
}
private void sendStateToPlayer(String playerId, GameStateListener listener, GameStats gameStats) {
if (_playerOrder != null) {
listener.setPlayerOrder(_playerOrder.getAllPlayers());
if (_currentPlayerId != null)
listener.setCurrentPlayerId(_currentPlayerId);
if (_currentPhase != null)
listener.setCurrentPhase(_currentPhase);
listener.setCurrentPhase(getPhaseString());
listener.setTwilight(_twilightPool);
for (Map.Entry<String, Integer> stringIntegerEntry : _playerPosition.entrySet())
listener.setPlayerPosition(stringIntegerEntry.getKey(), stringIntegerEntry.getValue());
@@ -887,7 +895,7 @@ public class GameState {
public void setCurrentPhase(Phase phase) {
_currentPhase = phase;
for (GameStateListener listener : getAllGameStateListeners())
listener.setCurrentPhase(_currentPhase);
listener.setCurrentPhase(getPhaseString());
}
public Phase getCurrentPhase() {

View File

@@ -1,16 +1,14 @@
package com.gempukku.lotro.game.state;
import com.gempukku.lotro.common.Phase;
import com.gempukku.lotro.common.Token;
import com.gempukku.lotro.communication.GameStateListener;
import com.gempukku.lotro.game.PhysicalCard;
import static com.gempukku.lotro.game.state.GameEvent.Type.*;
import com.gempukku.lotro.logic.decisions.AwaitingDecision;
import com.gempukku.lotro.logic.timing.GameStats;
import java.util.*;
import static com.gempukku.lotro.game.state.GameEvent.Type.*;
public class GatheringParticipantCommunicationChannel implements GameStateListener {
private List<GameEvent> _events = new LinkedList<GameEvent>();
private String _self;
@@ -72,7 +70,7 @@ public class GatheringParticipantCommunicationChannel implements GameStateListen
}
@Override
public void setCurrentPhase(Phase phase) {
public void setCurrentPhase(String phase) {
_events.add(new GameEvent(GPC).phase(phase));
}

View File

@@ -186,16 +186,8 @@ body {
}
.phase {
display: inline-table;
padding: 2px;
color: #ffffff;
}
.phase.current {
display: inline-table;
padding: 2px;
background-color: #ffffff;
color: #000000;
font-size: 120%;
}
.twilightPool {

View File

@@ -443,8 +443,7 @@ var GameAnimations = Class.extend({
function(next) {
var phase = element.getAttribute("phase");
$(".phase").removeClass("current");
$(".phase#" + phase).addClass("current");
$(".phase").text(phase);
next();
});

View File

@@ -267,13 +267,7 @@ var GempLotrGameUI = Class.extend({
}
this.gameStateElem.append("<div class='twilightPool'>0</div>");
this.gameStateElem.append("<div class='phase' id='FELLOWSHIP'>Fel</div>");
this.gameStateElem.append("<div class='phase' id='SHADOW'>Sh</div>");
this.gameStateElem.append("<div class='phase' id='MANEUVER'>Man</div>");
this.gameStateElem.append("<div class='phase' id='ARCHERY'>Arc</div>");
this.gameStateElem.append("<div class='phase' id='ASSIGNMENT'>As</div>");
this.gameStateElem.append("<div class='phase' id='SKIRMISH'>Sk</div>");
this.gameStateElem.append("<div class='phase' id='REGROUP'>Re</div>");
this.gameStateElem.append("<div class='phase'></div>");
$("#main").append(this.gameStateElem);
@@ -651,21 +645,21 @@ var GempLotrGameUI = Class.extend({
initializeDialogs: function() {
this.smallDialog = $("<div></div>")
.dialog({
autoOpen: false,
closeOnEscape: false,
resizable: false,
width: 400,
height: 200
});
autoOpen: false,
closeOnEscape: false,
resizable: false,
width: 400,
height: 200
});
this.cardActionDialog = $("<div></div>")
.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 +674,11 @@ var GempLotrGameUI = Class.extend({
this.infoDialog = $("<div></div>")
.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 +1159,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 +1202,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("<br />");
@@ -1601,8 +1595,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();