mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
GameLog uses a common observable
This commit is contained in:
@@ -20,11 +20,11 @@ package forge;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Observable;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import forge.game.event.IGameEventVisitor;
|
import forge.game.event.IGameEventVisitor;
|
||||||
import forge.game.phase.Combat;
|
import forge.game.phase.Combat;
|
||||||
import forge.util.MyObservable;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -34,7 +34,7 @@ import forge.util.MyObservable;
|
|||||||
* @author Forge
|
* @author Forge
|
||||||
* @version $Id: GameLog.java 12297 2011-11-28 19:56:47Z slapshot5 $
|
* @version $Id: GameLog.java 12297 2011-11-28 19:56:47Z slapshot5 $
|
||||||
*/
|
*/
|
||||||
public class GameLog extends MyObservable {
|
public class GameLog extends Observable {
|
||||||
private List<GameLogEntry> log = new ArrayList<GameLogEntry>();
|
private List<GameLogEntry> log = new ArrayList<GameLogEntry>();
|
||||||
|
|
||||||
private GameLogFormatter formatter = new GameLogFormatter(this);
|
private GameLogFormatter formatter = new GameLogFormatter(this);
|
||||||
@@ -63,13 +63,13 @@ public class GameLog extends MyObservable {
|
|||||||
* @param type the level
|
* @param type the level
|
||||||
*/
|
*/
|
||||||
public void add(final GameLogEntryType type, final String message) {
|
public void add(final GameLogEntryType type, final String message) {
|
||||||
log.add(new GameLogEntry(type, message));
|
add(new GameLogEntry(type, message));
|
||||||
this.updateObservers();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void add(GameLogEntry entry) {
|
void add(GameLogEntry entry) {
|
||||||
log.add(entry);
|
log.add(entry);
|
||||||
this.updateObservers();
|
this.setChanged();
|
||||||
|
this.notifyObservers();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLogText(final GameLogEntryType logLevel) {
|
public String getLogText(final GameLogEntryType logLevel) {
|
||||||
|
|||||||
@@ -34,9 +34,7 @@ import forge.util.MyObservable;
|
|||||||
* @author Forge
|
* @author Forge
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class InputQueue extends MyObservable implements java.io.Serializable {
|
public class InputQueue extends MyObservable {
|
||||||
/** Constant <code>serialVersionUID=3955194449319994301L</code>. */
|
|
||||||
private static final long serialVersionUID = 3955194449319994301L;
|
|
||||||
|
|
||||||
private final BlockingDeque<InputSynchronized> inputStack = new LinkedBlockingDeque<InputSynchronized>();
|
private final BlockingDeque<InputSynchronized> inputStack = new LinkedBlockingDeque<InputSynchronized>();
|
||||||
private final InputLockUI inputLock;
|
private final InputLockUI inputLock;
|
||||||
@@ -50,14 +48,6 @@ public class InputQueue extends MyObservable implements java.io.Serializable {
|
|||||||
return inputStack.isEmpty() ? null : this.inputStack.peek();
|
return inputStack.isEmpty() ? null : this.inputStack.peek();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* resetInput.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param update
|
|
||||||
* a boolean.
|
|
||||||
*/
|
|
||||||
public final void removeInput(Input inp) {
|
public final void removeInput(Input inp) {
|
||||||
Input topMostInput = inputStack.isEmpty() ? null : inputStack.pop();
|
Input topMostInput = inputStack.isEmpty() ? null : inputStack.pop();
|
||||||
|
|
||||||
|
|||||||
@@ -430,7 +430,6 @@ public final class GuiDisplayUtil {
|
|||||||
// Human player is choosing targets for an ability controlled by chosen player.
|
// Human player is choosing targets for an ability controlled by chosen player.
|
||||||
sa.setActivatingPlayer(p);
|
sa.setActivatingPlayer(p);
|
||||||
HumanPlay.playSaWithoutPayingManaCost(game, sa);
|
HumanPlay.playSaWithoutPayingManaCost(game, sa);
|
||||||
Singletons.getControl().getInputQueue().updateObservers(); // priority can be on AI side, need this update for that case
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user