mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Some additional info to the game end window.
This commit is contained in:
parent
c953bf6260
commit
57d1dc0f6d
3 changed files with 129 additions and 83 deletions
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JInternalFrameFormInfo">
|
||||
<Form version="1.9" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JInternalFrameFormInfo">
|
||||
<NonVisualComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPanel2">
|
||||
|
||||
|
@ -56,7 +56,7 @@
|
|||
<Component id="tabPane" min="-2" pref="277" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="btnOk" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="37" max="32767" attributes="0"/>
|
||||
<EmptySpace min="0" pref="8" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
|
@ -75,7 +75,9 @@
|
|||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JLayeredPaneSupportLayout"/>
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
|
||||
<Property name="useNullLayout" type="boolean" value="true"/>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JLayeredPane" name="pnlText">
|
||||
<Properties>
|
||||
|
@ -90,38 +92,54 @@
|
|||
<Property name="opaque" type="boolean" value="true"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JLayeredPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JLayeredPaneSupportLayout$JLayeredPaneConstraintsDescription">
|
||||
<JLayeredPaneConstraints x="20" y="150" width="570" height="90" layer="0" position="-1"/>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||
<AbsoluteConstraints x="20" y="150" width="570" height="90"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JLayeredPaneSupportLayout"/>
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
|
||||
<Property name="useNullLayout" type="boolean" value="true"/>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="lblGameInfo">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Tahoma" size="18" style="3"/>
|
||||
</Property>
|
||||
<Property name="horizontalAlignment" type="int" value="0"/>
|
||||
<Property name="text" type="java.lang.String" value="gameInfo"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||
<AbsoluteConstraints x="11" y="1" width="550" height="25"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="lblMatchInfo">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Tahoma" size="24" style="3"/>
|
||||
<Font name="Tahoma" size="18" style="3"/>
|
||||
</Property>
|
||||
<Property name="horizontalAlignment" type="int" value="0"/>
|
||||
<Property name="text" type="java.lang.String" value="matchInfo"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JLayeredPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JLayeredPaneSupportLayout$JLayeredPaneConstraintsDescription">
|
||||
<JLayeredPaneConstraints x="11" y="42" width="550" height="40" layer="0" position="-1"/>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||
<AbsoluteConstraints x="10" y="30" width="550" height="25"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="lblResultText">
|
||||
<Component class="javax.swing.JLabel" name="lblAdditionalInfo">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Tahoma" size="24" style="3"/>
|
||||
<Font name="Tahoma" size="18" style="3"/>
|
||||
</Property>
|
||||
<Property name="horizontalAlignment" type="int" value="0"/>
|
||||
<Property name="text" type="java.lang.String" value="result text"/>
|
||||
<Property name="text" type="java.lang.String" value="additionalInfo"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JLayeredPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JLayeredPaneSupportLayout$JLayeredPaneConstraintsDescription">
|
||||
<JLayeredPaneConstraints x="11" y="1" width="550" height="40" layer="0" position="-1"/>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||
<AbsoluteConstraints x="10" y="60" width="550" height="25"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
|
@ -135,8 +153,8 @@
|
|||
<Property name="horizontalAlignment" type="int" value="0"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JLayeredPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JLayeredPaneSupportLayout$JLayeredPaneConstraintsDescription">
|
||||
<JLayeredPaneConstraints x="0" y="0" width="610" height="250" layer="0" position="-1"/>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||
<AbsoluteConstraints x="0" y="0" width="610" height="250"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
|
|
|
@ -45,13 +45,12 @@ import java.text.DateFormat;
|
|||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JLayeredPane;
|
||||
import javax.swing.JOptionPane;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.game.GamePanel;
|
||||
import mage.client.util.audio.AudioManager;
|
||||
import mage.client.util.Format;
|
||||
import mage.client.util.ImageHelper;
|
||||
import mage.client.util.audio.AudioManager;
|
||||
import mage.client.util.gui.BufferedImageBuilder;
|
||||
import mage.view.GameEndView;
|
||||
import mage.view.PlayerView;
|
||||
|
@ -65,7 +64,8 @@ public class GameEndDialog extends MageDialog {
|
|||
private final DateFormat df = DateFormat.getDateTimeInstance();;
|
||||
|
||||
|
||||
/** Creates new form GameEndDialog */
|
||||
/** Creates new form GameEndDialog
|
||||
* @param gameEndView */
|
||||
public GameEndDialog(GameEndView gameEndView) {
|
||||
|
||||
initComponents();
|
||||
|
@ -80,13 +80,14 @@ public class GameEndDialog extends MageDialog {
|
|||
ImageIcon icon = new ImageIcon(imageResult);
|
||||
lblResultImage.setIcon(icon);
|
||||
|
||||
this.lblResultText.setText(gameEndView.getResultMessage());
|
||||
this.lblGameInfo.setText(gameEndView.getGameInfo());
|
||||
this.lblMatchInfo.setText(gameEndView.getMatchInfo());
|
||||
this.lblAdditionalInfo.setText(gameEndView.getAdditionalInfo());
|
||||
|
||||
String autoSave = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GAME_LOG_AUTO_SAVE, "true");
|
||||
if (autoSave.equals("true")) {
|
||||
this.saveGameLog(gameEndView);
|
||||
}
|
||||
|
||||
|
||||
// game duration
|
||||
txtDurationGame.setText(Format.getDuration(gameEndView.getStartTime(), gameEndView.getEndTime()));
|
||||
|
@ -110,17 +111,6 @@ public class GameEndDialog extends MageDialog {
|
|||
}
|
||||
|
||||
txtMatchScore.setText(gameEndView.getMatchView().getResult());
|
||||
|
||||
if (gameEndView.getNameMatchWinner() != null) {
|
||||
if (gameEndView.getClientPlayer().getName().equals(gameEndView.getNameMatchWinner())) {
|
||||
lblMatchInfo.setText("You won the match!");
|
||||
} else {
|
||||
lblMatchInfo.setText(new StringBuilder(gameEndView.getNameMatchWinner()).append(" won the match!").toString());
|
||||
}
|
||||
} else {
|
||||
int winsNeeded = gameEndView.getWinsNeeded() - gameEndView.getWins();
|
||||
lblMatchInfo.setText(new StringBuilder("You need ").append(winsNeeded == 1 ? "one win ":winsNeeded + " wins ").append("to win the match.").toString());
|
||||
}
|
||||
}
|
||||
|
||||
private void saveGameLog(GameEndView gameEndView) {
|
||||
|
@ -169,8 +159,9 @@ public class GameEndDialog extends MageDialog {
|
|||
tabPane = new javax.swing.JTabbedPane();
|
||||
tabResult = new javax.swing.JLayeredPane();
|
||||
pnlText = new javax.swing.JLayeredPane();
|
||||
lblGameInfo = new javax.swing.JLabel();
|
||||
lblMatchInfo = new javax.swing.JLabel();
|
||||
lblResultText = new javax.swing.JLabel();
|
||||
lblAdditionalInfo = new javax.swing.JLabel();
|
||||
lblResultImage = new javax.swing.JLabel();
|
||||
tabStatistics = new javax.swing.JPanel();
|
||||
lblDurationGame = new javax.swing.JLabel();
|
||||
|
@ -202,25 +193,31 @@ public class GameEndDialog extends MageDialog {
|
|||
pnlText.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
||||
pnlText.setOpaque(true);
|
||||
|
||||
lblMatchInfo.setFont(new java.awt.Font("Tahoma", 3, 24)); // NOI18N
|
||||
lblGameInfo.setFont(new java.awt.Font("Tahoma", 3, 18)); // NOI18N
|
||||
lblGameInfo.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
||||
lblGameInfo.setText("gameInfo");
|
||||
pnlText.add(lblGameInfo);
|
||||
lblGameInfo.setBounds(11, 1, 550, 25);
|
||||
|
||||
lblMatchInfo.setFont(new java.awt.Font("Tahoma", 3, 18)); // NOI18N
|
||||
lblMatchInfo.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
||||
lblMatchInfo.setText("matchInfo");
|
||||
lblMatchInfo.setBounds(11, 42, 550, 40);
|
||||
pnlText.add(lblMatchInfo, javax.swing.JLayeredPane.DEFAULT_LAYER);
|
||||
pnlText.add(lblMatchInfo);
|
||||
lblMatchInfo.setBounds(10, 30, 550, 25);
|
||||
|
||||
lblResultText.setFont(new java.awt.Font("Tahoma", 3, 24)); // NOI18N
|
||||
lblResultText.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
||||
lblResultText.setText("result text");
|
||||
lblResultText.setBounds(11, 1, 550, 40);
|
||||
pnlText.add(lblResultText, javax.swing.JLayeredPane.DEFAULT_LAYER);
|
||||
lblAdditionalInfo.setFont(new java.awt.Font("Tahoma", 3, 18)); // NOI18N
|
||||
lblAdditionalInfo.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
||||
lblAdditionalInfo.setText("additionalInfo");
|
||||
pnlText.add(lblAdditionalInfo);
|
||||
lblAdditionalInfo.setBounds(10, 60, 550, 25);
|
||||
|
||||
tabResult.add(pnlText);
|
||||
pnlText.setBounds(20, 150, 570, 90);
|
||||
tabResult.add(pnlText, javax.swing.JLayeredPane.DEFAULT_LAYER);
|
||||
|
||||
lblResultImage.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
|
||||
lblResultImage.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
||||
tabResult.add(lblResultImage);
|
||||
lblResultImage.setBounds(0, 0, 610, 250);
|
||||
tabResult.add(lblResultImage, javax.swing.JLayeredPane.DEFAULT_LAYER);
|
||||
|
||||
tabPane.addTab("Result", tabResult);
|
||||
|
||||
|
@ -249,22 +246,17 @@ public class GameEndDialog extends MageDialog {
|
|||
tabStatisticsLayout.setHorizontalGroup(
|
||||
tabStatisticsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(tabStatisticsLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(tabStatisticsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(tabStatisticsLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(tabStatisticsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(lblPlayerInfo, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblDurationMatch, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblMatchScore, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addGroup(tabStatisticsLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(tabStatisticsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(lblDurationGame, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblLife, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE))))
|
||||
.addComponent(lblPlayerInfo, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblDurationMatch, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblMatchScore, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblDurationGame, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblLife, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(tabStatisticsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(txtPlayerInfo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(txtDurationGame, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 489, Short.MAX_VALUE)
|
||||
.addComponent(txtDurationGame, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 494, Short.MAX_VALUE)
|
||||
.addComponent(txtLife, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 489, Short.MAX_VALUE)
|
||||
.addComponent(txtDurationMatch, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 489, Short.MAX_VALUE)
|
||||
.addComponent(txtMatchScore, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 489, Short.MAX_VALUE))
|
||||
|
@ -292,7 +284,7 @@ public class GameEndDialog extends MageDialog {
|
|||
.addGroup(tabStatisticsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblPlayerInfo, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(txtPlayerInfo, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap(99, Short.MAX_VALUE))
|
||||
.addContainerGap(105, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
tabPane.addTab("Statistics", tabStatistics);
|
||||
|
@ -322,7 +314,7 @@ public class GameEndDialog extends MageDialog {
|
|||
.addComponent(tabPane, javax.swing.GroupLayout.PREFERRED_SIZE, 277, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnOk)
|
||||
.addGap(0, 25, Short.MAX_VALUE))
|
||||
.addGap(0, 8, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
pack();
|
||||
|
@ -335,14 +327,15 @@ public class GameEndDialog extends MageDialog {
|
|||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton btnOk;
|
||||
private javax.swing.JPanel jPanel2;
|
||||
private javax.swing.JLabel lblAdditionalInfo;
|
||||
private javax.swing.JLabel lblDurationGame;
|
||||
private javax.swing.JLabel lblDurationMatch;
|
||||
private javax.swing.JLabel lblGameInfo;
|
||||
private javax.swing.JLabel lblLife;
|
||||
private javax.swing.JLabel lblMatchInfo;
|
||||
private javax.swing.JLabel lblMatchScore;
|
||||
private javax.swing.JLabel lblPlayerInfo;
|
||||
private javax.swing.JLabel lblResultImage;
|
||||
private javax.swing.JLabel lblResultText;
|
||||
private javax.swing.JLayeredPane pnlText;
|
||||
private javax.swing.JTabbedPane tabPane;
|
||||
private javax.swing.JLayeredPane tabResult;
|
||||
|
|
|
@ -45,16 +45,17 @@ import mage.players.Player;
|
|||
public class GameEndView implements Serializable {
|
||||
|
||||
private PlayerView clientPlayer = null;
|
||||
private List<PlayerView> players = new ArrayList<PlayerView>();
|
||||
private Date startTime;
|
||||
private Date endTime;
|
||||
private String resultMessage;
|
||||
private final List<PlayerView> players = new ArrayList<>();
|
||||
private final Date startTime;
|
||||
private final Date endTime;
|
||||
private String gameInfo;
|
||||
private final String matchInfo;
|
||||
private final String additionalInfo;
|
||||
private boolean won;
|
||||
private MatchView matchView;
|
||||
private final MatchView matchView;
|
||||
private int wins;
|
||||
private int loses;
|
||||
private int winsNeeded;
|
||||
private String nameMatchWinner = null;
|
||||
private final int winsNeeded;
|
||||
|
||||
public GameEndView(GameState state, Game game, UUID playerId, Match match) {
|
||||
startTime = game.getStartTime();
|
||||
|
@ -68,6 +69,7 @@ public class GameEndView implements Serializable {
|
|||
if (playerView.getPlayerId().equals(playerId)) {
|
||||
clientPlayer = playerView;
|
||||
you = player;
|
||||
won = you.hasWon(); // needed to control image
|
||||
}
|
||||
players.add(playerView);
|
||||
if (player.hasWon()) {
|
||||
|
@ -75,29 +77,58 @@ public class GameEndView implements Serializable {
|
|||
}
|
||||
}
|
||||
if (you != null) {
|
||||
won = you.hasWon();
|
||||
if (you.hasWon()) {
|
||||
resultMessage = new StringBuilder("You won the game on turn ").append(game.getTurnNum()).append(".").toString();
|
||||
gameInfo = new StringBuilder("You won the game on turn ").append(game.getTurnNum()).append(".").toString();
|
||||
} else if (winner > 0) {
|
||||
resultMessage = new StringBuilder("You lost the game on turn ").append(game.getTurnNum()).append(".").toString();
|
||||
gameInfo = new StringBuilder("You lost the game on turn ").append(game.getTurnNum()).append(".").toString();
|
||||
} else {
|
||||
resultMessage = new StringBuilder("Game is a draw on Turn ").append(game.getTurnNum()).append(".").toString();
|
||||
gameInfo = new StringBuilder("Game is a draw on Turn ").append(game.getTurnNum()).append(".").toString();
|
||||
}
|
||||
}
|
||||
matchView = new MatchView(match);
|
||||
|
||||
winsNeeded = match.getOptions().getWinsNeeded();
|
||||
for (MatchPlayer mPlayer: match.getPlayers()) {
|
||||
if (mPlayer.getPlayer().equals(you)) {
|
||||
wins = mPlayer.getWins();
|
||||
loses = mPlayer.getLoses();
|
||||
|
||||
MatchPlayer matchWinner = null;
|
||||
winsNeeded = match.getOptions().getWinsNeeded();
|
||||
StringBuilder additonalText = new StringBuilder();
|
||||
for (MatchPlayer matchPlayer: match.getPlayers()) {
|
||||
if (matchPlayer.getPlayer().equals(you)) {
|
||||
wins = matchPlayer.getWins();
|
||||
}
|
||||
if (mPlayer.getWins() == winsNeeded) {
|
||||
nameMatchWinner = mPlayer.getName();
|
||||
if (matchPlayer.isMatchWinner()) {
|
||||
matchWinner = matchPlayer;
|
||||
}
|
||||
if (matchPlayer.hasTimerTimeout()) {
|
||||
if (matchPlayer.getPlayer().equals(you)) {
|
||||
additonalText.append("You run out of time. ");
|
||||
} else {
|
||||
additonalText.append(matchPlayer.getName()).append(" runs out of time. ");
|
||||
}
|
||||
} else if (matchPlayer.hasQuit()) {
|
||||
if (matchPlayer.getPlayer().equals(you)) {
|
||||
additonalText.append("You have quit the match. ");
|
||||
} else {
|
||||
additonalText.append(matchPlayer.getName()).append(" has quit the match. ");
|
||||
}
|
||||
} else if (matchPlayer.getPlayer().hasIdleTimeout()) {
|
||||
if (matchPlayer.getPlayer().equals(you)) {
|
||||
additonalText.append("You lost the match for beeing idle. ");
|
||||
} else {
|
||||
additonalText.append(matchPlayer.getName()).append(" lost for beeing idle. ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (matchWinner != null) {
|
||||
if (matchWinner.getPlayer().equals(you)) {
|
||||
matchInfo = "You won the match!";
|
||||
} else {
|
||||
matchInfo = new StringBuilder(matchWinner.getName()).append(" won the match!").toString();
|
||||
}
|
||||
} else {
|
||||
matchInfo = new StringBuilder("You need ").append(winsNeeded - wins == 1 ? "one more win ":winsNeeded - wins + " more wins ").append("to win the match.").toString();
|
||||
}
|
||||
additionalInfo = additonalText.toString();
|
||||
|
||||
}
|
||||
|
||||
public Date getStartTime() {
|
||||
|
@ -112,8 +143,16 @@ public class GameEndView implements Serializable {
|
|||
return players;
|
||||
}
|
||||
|
||||
public String getResultMessage() {
|
||||
return resultMessage;
|
||||
public String getGameInfo() {
|
||||
return gameInfo;
|
||||
}
|
||||
|
||||
public String getMatchInfo() {
|
||||
return matchInfo;
|
||||
}
|
||||
|
||||
public String getAdditionalInfo() {
|
||||
return additionalInfo;
|
||||
}
|
||||
|
||||
public boolean hasWon() {
|
||||
|
@ -136,10 +175,6 @@ public class GameEndView implements Serializable {
|
|||
return winsNeeded;
|
||||
}
|
||||
|
||||
public String getNameMatchWinner() {
|
||||
return nameMatchWinner;
|
||||
}
|
||||
|
||||
public PlayerView getClientPlayer() {
|
||||
return clientPlayer;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue