|
@ -1,6 +1,8 @@ |
|
|
package de.tims.fleetstorm.gui; |
|
|
package de.tims.fleetstorm.gui; |
|
|
|
|
|
|
|
|
|
|
|
import java.awt.BorderLayout; |
|
|
import java.awt.Color; |
|
|
import java.awt.Color; |
|
|
|
|
|
import java.awt.Font; |
|
|
import java.awt.event.MouseAdapter; |
|
|
import java.awt.event.MouseAdapter; |
|
|
import java.awt.event.MouseEvent; |
|
|
import java.awt.event.MouseEvent; |
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
@ -8,6 +10,7 @@ import java.util.ArrayList; |
|
|
import javax.swing.JFrame; |
|
|
import javax.swing.JFrame; |
|
|
import javax.swing.JLabel; |
|
|
import javax.swing.JLabel; |
|
|
import javax.swing.JPanel; |
|
|
import javax.swing.JPanel; |
|
|
|
|
|
import javax.swing.SwingConstants; |
|
|
import javax.swing.border.MatteBorder; |
|
|
import javax.swing.border.MatteBorder; |
|
|
|
|
|
|
|
|
import de.tims.fleetstorm.ai.Logic; |
|
|
import de.tims.fleetstorm.ai.Logic; |
|
@ -245,6 +248,18 @@ public class GameLogic extends JPanel { |
|
|
|
|
|
|
|
|
protected void gameOver(boolean playerWinner) { |
|
|
protected void gameOver(boolean playerWinner) { |
|
|
this.gameState = GameLogic.GAME_OVER; |
|
|
this.gameState = GameLogic.GAME_OVER; |
|
|
|
|
|
|
|
|
|
|
|
this.removeAll(); |
|
|
|
|
|
this.setLayout(new BorderLayout()); |
|
|
|
|
|
|
|
|
|
|
|
JLabel wonLabel = new JLabel(playerWinner ? "Du hast gewonnen!" : "Du hast verloren!"); |
|
|
|
|
|
wonLabel.setHorizontalAlignment(SwingConstants.CENTER); |
|
|
|
|
|
wonLabel.setVerticalAlignment(SwingConstants.CENTER); |
|
|
|
|
|
wonLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); |
|
|
|
|
|
this.add(wonLabel, SwingConstants.CENTER); |
|
|
|
|
|
|
|
|
|
|
|
this.revalidate(); |
|
|
|
|
|
this.repaint(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public int getGameState() { |
|
|
public int getGameState() { |
|
|