Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Quentin DRUAULT-AUBIN
lo23-project
Commits
d55ba504
Commit
d55ba504
authored
Dec 12, 2017
by
Quentin DRUAULT-AUBIN
Browse files
Connection lost
parent
10d88054
Changes
2
Hide whitespace changes
Inline
Side-by-side
Battleship/src/main/java/com/utclo23/ihmtable/IHMTableFacade.java
View file @
d55ba504
...
...
@@ -225,7 +225,7 @@ public class IHMTableFacade implements IIHMTableToIHMMain, IIHMTableToData {
*/
@Override
public
void
connectionLostWithOpponent
()
{
throw
new
UnsupportedOperationException
(
EXCEPTION_MESSAGE
);
controller
.
popupConnectionLost
(
);
}
/**
...
...
Battleship/src/main/java/com/utclo23/ihmtable/controller/InGameGUIController.java
View file @
d55ba504
...
...
@@ -395,7 +395,6 @@ public class InGameGUIController {
updateStatsPannel
();
// Get the current player.
// currentPlayer = facade.getFacadeData().getGame().getCurrentPlayer();
}
/**
...
...
@@ -1153,4 +1152,28 @@ public class InGameGUIController {
node
.
getStyleClass
().
add
(
"inGameGUI_destroyed_cell"
);
}
}
/**
* Popup displayed when the opponent lost his connection.
*/
public
void
popupConnectionLost
()
{
// Create the popup.
Alert
alert
=
new
Alert
(
AlertType
.
CONFIRMATION
);
alert
.
setTitle
(
"Connection lost"
);
alert
.
setHeaderText
(
"Connection has been lost with your opponent"
);
alert
.
setContentText
(
"Do you want to save this game?"
);
Optional
<
ButtonType
>
result
=
alert
.
showAndWait
();
// Click on OK.
if
(
result
.
get
()
==
ButtonType
.
OK
){
// TODO: save the game.
}
try
{
// Go back to the menu.
facade
.
getFacadeIHMMain
().
toMenu
();
}
catch
(
IOException
ex
)
{
Logger
.
getLogger
(
InGameGUIController
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
ex
);
}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment