2
* This program is free software; you can redistribute it and/or modify
3
* it under the terms of the GNU General Public License as published by
4
* the Free Software Foundation; either version 2 of the License, or
5
* (at your option) any later version.
6
* This program is distributed in the hope that it will be useful,
7
* but WITHOUT ANY WARRANTY; without even the implied warranty of
8
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9
* GNU General Public License for more details.
10
* You should have received a copy of the GNU General Public License
11
* along with this program; if not, write to the Free Software
12
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14
package games.strategy.triplea.ui.display;
18
import games.strategy.engine.data.*;
19
import games.strategy.engine.display.IDisplayBridge;
20
import games.strategy.net.GUID;
21
import games.strategy.triplea.delegate.DiceRoll;
22
import games.strategy.triplea.ui.TripleAFrame;
28
* @author Sean Bridges
30
public class TripleaDisplay implements ITripleaDisplay
32
private IDisplayBridge m_displayBridge;
33
private final TripleAFrame m_ui;
38
public TripleaDisplay(final TripleAFrame ui)
43
* @see games.strategy.engine.display.IDisplay#initialize(games.strategy.engine.display.IDisplayBridge)
45
public void initialize(IDisplayBridge bridge)
47
m_displayBridge = bridge;
48
m_displayBridge.toString();
52
* @see games.strategy.triplea.ui.display.ITripleaDisplay#showBattle(games.strategy.net.GUID, java.util.List, games.strategy.engine.data.Territory, java.lang.String, java.util.Collection, java.util.Collection)
54
public void showBattle(GUID battleID, Territory location, String battleTitle, Collection<Unit> attackingUnits, Collection<Unit> defendingUnits, Map<Unit, Collection<Unit>> unit_dependents,PlayerID attacker, PlayerID defender)
56
m_ui.getBattlePanel().showBattle(battleID, location, battleTitle, attackingUnits, defendingUnits, unit_dependents, attacker, defender);
60
* @see games.strategy.triplea.ui.display.ITripleaDisplay#listBattleSteps(games.strategy.net.GUID, java.lang.String, java.util.List)
62
public void listBattleSteps(GUID battleID, List steps)
64
m_ui.getBattlePanel().listBattle(battleID, steps);
68
* @see games.strategy.triplea.ui.display.ITripleaDisplay#casualtyNotification(java.lang.String, games.strategy.triplea.delegate.DiceRoll, games.strategy.engine.data.PlayerID, java.util.Collection, java.util.Collection, java.util.Map, boolean)
70
public void casualtyNotification(GUID battleID,
74
Collection<Unit> killed,
75
Collection<Unit> damaged,
76
Map<Unit,Collection<Unit>> dependents)
78
m_ui.getBattlePanel().casualtyNotification(step,dice, player, killed, damaged, dependents);
83
* @see games.strategy.triplea.ui.display.ITripleaDisplay#casualtyNotification(java.lang.String, games.strategy.triplea.delegate.DiceRoll, games.strategy.engine.data.PlayerID, java.util.Collection, java.util.Collection, java.util.Map, boolean)
85
public void deadUnitNotification(GUID battleID,
87
Collection<Unit> killed,
88
Map<Unit,Collection<Unit>> dependents)
90
m_ui.getBattlePanel().deadUnitNotification(player, killed, dependents);
95
* @see games.strategy.triplea.ui.display.ITripleaDisplay#casualtyNotification(java.lang.String, games.strategy.triplea.delegate.DiceRoll, games.strategy.engine.data.PlayerID, java.util.Collection, java.util.Collection, java.util.Map, boolean)
97
public void scrambleNotification(GUID battleID,
100
Collection<Unit> scrambled,
101
Map<Unit,Collection<Unit>> dependents)
103
m_ui.getBattlePanel().scrambleNotification(step, player, scrambled, dependents);
107
* @see games.strategy.triplea.ui.display.ITripleaDisplay#battleEnd(games.strategy.net.GUID, java.lang.String)
109
public void battleEnd(GUID battleID, String message)
111
m_ui.getBattlePanel().battleEndMessage(battleID, message);
114
* @see games.strategy.triplea.ui.display.ITripleaDisplay#bombingResults(games.strategy.net.GUID, int[], int)
116
public void bombingResults(GUID battleID, int[] dice, int cost)
118
m_ui.getBattlePanel().bombingResults(battleID, dice, cost);
121
public void notifyRetreat(String shortMessage, String message, String step, PlayerID retreatingPlayer)
123
//we just told the game to retreat, so we already know
124
if(m_ui.playing(retreatingPlayer))
127
m_ui.getBattlePanel().notifyRetreat(shortMessage, message, step, retreatingPlayer);
130
public void notifyScramble(String shortMessage, String message, String step, PlayerID scramblingPlayer)
132
//we just told the game to scramble, so we already know
133
if(m_ui.playing(scramblingPlayer))
136
m_ui.getBattlePanel().notifyScramble(shortMessage, message, step, scramblingPlayer);
139
* Show dice for the given battle and step
143
* @param the player who must act on the roll, ignore
145
public void notifyDice(GUID battleId, DiceRoll dice, String stepName)
147
m_ui.getBattlePanel().showDice(null, dice, stepName);
150
public void notifyRetreat(GUID battleId, Collection retreating)
152
m_ui.getBattlePanel().notifyRetreat(retreating);
155
public void gotoBattleStep(GUID battleId, String step)
157
m_ui.getBattlePanel().gotoStep(battleId, step);
160
public void shutDown()