From: Erik V. <ev...@us...> - 2009-02-04 20:36:51
|
Update of /cvsroot/rails/18xx/rails/ui/swing In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv4948/rails/ui/swing Modified Files: ORWindow.java StatusWindow.java GameUIManager.java Log Message: CGR Formation round phase 1: repaying loans. Index: StatusWindow.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/StatusWindow.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** StatusWindow.java 3 Dec 2008 20:17:36 -0000 1.26 --- StatusWindow.java 4 Feb 2009 20:36:40 -0000 1.27 *************** *** 514,517 **** --- 514,520 ---- process(executedAction); } + } else { + // Unknown action, let UIManager catch it + process (executedAction); } } Index: ORWindow.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/ORWindow.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** ORWindow.java 15 Jan 2009 20:53:28 -0000 1.22 --- ORWindow.java 4 Feb 2009 20:36:40 -0000 1.23 *************** *** 25,36 **** public class ORWindow extends JFrame implements ActionPerformer { private static final long serialVersionUID = 1L; ! public GameUIManager gameUIManager; ! private ORUIManager orUIManager; ! private MapPanel mapPanel; ! private ORPanel orPanel; ! private UpgradesPanel upgradePanel; ! private MessagePanel messagePanel; ! private Rectangle lastBounds; protected PossibleActions possibleActions = PossibleActions.getInstance(); --- 25,36 ---- public class ORWindow extends JFrame implements ActionPerformer { private static final long serialVersionUID = 1L; ! protected GameUIManager gameUIManager; ! protected ORUIManager orUIManager; ! protected MapPanel mapPanel; ! protected ORPanel orPanel; ! protected UpgradesPanel upgradePanel; ! protected MessagePanel messagePanel; ! protected Rectangle lastBounds; protected PossibleActions possibleActions = PossibleActions.getInstance(); Index: GameUIManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/GameUIManager.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** GameUIManager.java 23 Dec 2008 20:02:45 -0000 1.15 --- GameUIManager.java 4 Feb 2009 20:36:40 -0000 1.16 *************** *** 95,101 **** updateUI(); ! } ! public boolean processOnServer(PossibleAction action) { --- 95,101 ---- updateUI(); ! } ! public boolean processOnServer(PossibleAction action) { *************** *** 111,115 **** boolean result = gameManager.process(action); log.debug("==Result from server: " + result); ! activeWindow.displayServerMessage(); reportWindow.addLog(); --- 111,115 ---- boolean result = gameManager.process(action); log.debug("==Result from server: " + result); ! if (DisplayBuffer.getAutoDisplay()) activeWindow.displayServerMessage(); reportWindow.addLog(); *************** *** 149,171 **** // Process consequences of a round type change to the UI if (previousRound == null || !previousRound.equals(currentRound)) { ! // Finish the previous round UI aspects ! if (previousRound instanceof StockRound) { ! log.debug("Finishing Stock Round UI"); ! statusWindow.finishRound(); ! } else if (previousRound instanceof StartRound) { ! log.debug("Finishing Start Round UI"); ! if (startRoundWindow != null) { ! startRoundWindow.close(); ! startRoundWindow = null; } - } else if (previousRound instanceof OperatingRound) { - log.debug("Finishing Operating Round UI"); - orUIManager.finish(); } // Start the new round UI aspects ! if (currentRound instanceof StartRound) { log.debug("Entering Start Round UI"); --- 149,182 ---- // Process consequences of a round type change to the UI + Class<? extends RoundI> previousRoundUItype + = previousRound == null ? null : previousRound.getRoundTypeForUI(); + Class<? extends RoundI> currentRoundUItype + = currentRound.getRoundTypeForUI(); + if (previousRound == null || !previousRound.equals(currentRound)) { ! if (previousRound != null) { ! // Finish the previous round UI aspects ! //if (previousRound instanceof StockRound) { ! if (StockRound.class.isAssignableFrom(previousRoundUItype)) { ! log.debug("Finishing Stock Round UI"); ! statusWindow.finishRound(); ! //} else if (previousRound instanceof StartRound) { ! } else if (StartRound.class.isAssignableFrom(previousRoundUItype)) { ! log.debug("Finishing Start Round UI"); ! if (startRoundWindow != null) { ! startRoundWindow.close(); ! startRoundWindow = null; ! } ! //} else if (previousRound instanceof OperatingRound) { ! } else if (OperatingRound.class.isAssignableFrom(previousRoundUItype)) { ! log.debug("Finishing Operating Round UI"); ! orUIManager.finish(); } } // Start the new round UI aspects ! //if (currentRound instanceof StartRound) { ! if (StartRound.class.isAssignableFrom(currentRoundUItype)) { log.debug("Entering Start Round UI"); *************** *** 177,181 **** stockChart.setVisible(false); ! } else if (currentRound instanceof StockRound) { log.debug("Entering Stock Round UI"); --- 188,193 ---- stockChart.setVisible(false); ! //} else if (currentRound instanceof StockRound) { ! } else if (StockRound.class.isAssignableFrom(currentRoundUItype)) { log.debug("Entering Stock Round UI"); *************** *** 183,187 **** statusWindow.setVisible(true); ! } else if (currentRound instanceof OperatingRound) { log.debug("Entering Operating Round UI"); --- 195,200 ---- statusWindow.setVisible(true); ! //} else if (currentRound instanceof OperatingRound) { ! } else if (OperatingRound.class.isAssignableFrom(currentRoundUItype)) { log.debug("Entering Operating Round UI"); *************** *** 192,198 **** statusWindow.setupFor(currentRound); // Update the current round window ! if (currentRound instanceof StartRound) { activeWindow = startRoundWindow; --- 205,213 ---- statusWindow.setupFor(currentRound); + previousRound = currentRound; // Update the current round window ! //if (currentRound instanceof StartRound) { ! if (StartRound.class.isAssignableFrom(currentRoundUItype)) { activeWindow = startRoundWindow; *************** *** 200,216 **** startRoundWindow.setSRPlayerTurn(startRound.getCurrentPlayerIndex()); ! } else if (currentRound instanceof StockRound) { activeWindow = statusWindow; statusWindow.updateStatus(); ! } else if (currentRound instanceof OperatingRound) { activeWindow = orUIManager.getORWindow(); orUIManager.updateStatus(); - } - - previousRound = currentRound; } --- 215,231 ---- startRoundWindow.setSRPlayerTurn(startRound.getCurrentPlayerIndex()); ! //} else if (currentRound instanceof StockRound) { ! } else if (StockRound.class.isAssignableFrom(currentRoundUItype)) { activeWindow = statusWindow; statusWindow.updateStatus(); ! //} else if (currentRound instanceof OperatingRound) { ! } else if (OperatingRound.class.isAssignableFrom(currentRoundUItype)) { activeWindow = orUIManager.getORWindow(); orUIManager.updateStatus(); + } } *************** *** 282,336 **** return gameManager; } ! public RoundI getCurrentRound() { return gameManager.getCurrentRound(); } ! public boolean isGameOver() { return gameManager.isGameOver(); } ! public String getHelp () { return gameManager.getHelp(); } ! public int getNumberOfPlayers() { return gameManager.getNumberOfPlayers(); } ! public List<Player> getPlayers() { return gameManager.getPlayers(); } ! public List<String> getPlayerNames() { return gameManager.getPlayerNames(); } ! public Player getCurrentPlayer() { return gameManager.getCurrentPlayer(); } ! public Player getPriorityPlayer () { return gameManager.getPriorityPlayer(); } ! public PhaseI getCurrentPhase() { return gameManager.getCurrentPhase(); } ! public List<PublicCompanyI> getAllPublicCompanies(){ return gameManager.getAllPublicCompanies(); } ! public String getClassName (Defs.ClassName key) { return gameManager.getClassName(key); } ! public Object getCommonParameter (Defs.Parm key) { return gameManager.getCommonParameter(key); } ! public boolean getCommonParameterAsBoolean (Defs.Parm key) { ! return (Boolean) getCommonParameter(key); } --- 297,351 ---- return gameManager; } ! public RoundI getCurrentRound() { return gameManager.getCurrentRound(); } ! public boolean isGameOver() { return gameManager.isGameOver(); } ! public String getHelp () { return gameManager.getHelp(); } ! public int getNumberOfPlayers() { return gameManager.getNumberOfPlayers(); } ! public List<Player> getPlayers() { return gameManager.getPlayers(); } ! public List<String> getPlayerNames() { return gameManager.getPlayerNames(); } ! public Player getCurrentPlayer() { return gameManager.getCurrentPlayer(); } ! public Player getPriorityPlayer () { return gameManager.getPriorityPlayer(); } ! public PhaseI getCurrentPhase() { return gameManager.getCurrentPhase(); } ! public List<PublicCompanyI> getAllPublicCompanies(){ return gameManager.getAllPublicCompanies(); } ! public String getClassName (Defs.ClassName key) { return gameManager.getClassName(key); } ! public Object getCommonParameter (Defs.Parm key) { return gameManager.getCommonParameter(key); } ! public boolean getCommonParameterAsBoolean (Defs.Parm key) { ! return (Boolean) getCommonParameter(key); } |