Commit 4d1f9a13 authored by Peining's avatar Peining
Browse files

Merge branch 'develop' of https://gitlab.utc.fr/qdruault/lo23-project into develop

modify functions about statistics
parents 95681eb2 969f928b
...@@ -284,7 +284,7 @@ public class DataFacade implements IDataCom, IDataIHMTable, IDataIHMMain { ...@@ -284,7 +284,7 @@ public class DataFacade implements IDataCom, IDataIHMTable, IDataIHMMain {
@Override @Override
public void leaveGame() { public void leaveGame() {
String role = this.gameMediator.getOwnerStatus(); String role = this.gameMediator.getOwnerStatus();
if (!role.equals("spectator") && this.gameMediator.getCurrentGame()!=null) { if (!role.equals("spectator") && this.gameMediator.getCurrentGame() != null) {
Logger.getLogger(DataFacade.class.getName()).log(Level.INFO, null, "data | leave game"); Logger.getLogger(DataFacade.class.getName()).log(Level.INFO, null, "data | leave game");
this.comfacade.leaveGame(this.gameMediator.getCurrentGame().getRecipients(this.getMyPublicUserProfile().getPlayerName())); this.comfacade.leaveGame(this.gameMediator.getCurrentGame().getRecipients(this.getMyPublicUserProfile().getPlayerName()));
...@@ -308,7 +308,6 @@ public class DataFacade implements IDataCom, IDataIHMTable, IDataIHMMain { ...@@ -308,7 +308,6 @@ public class DataFacade implements IDataCom, IDataIHMTable, IDataIHMMain {
public void opponentHasLeftGame() { public void opponentHasLeftGame() {
Logger.getLogger(DataFacade.class.getName()).info("data | opponent has left"); Logger.getLogger(DataFacade.class.getName()).info("data | opponent has left");
if (!this.gameMediator.isFinishedGame()) { if (!this.gameMediator.isFinishedGame()) {
try { try {
this.gameMediator.defWin(); this.gameMediator.defWin();
...@@ -319,10 +318,9 @@ public class DataFacade implements IDataCom, IDataIHMTable, IDataIHMMain { ...@@ -319,10 +318,9 @@ public class DataFacade implements IDataCom, IDataIHMTable, IDataIHMMain {
this.ihmTablefacade.opponentHasLeftGame(); this.ihmTablefacade.opponentHasLeftGame();
} }
} }
@Override @Override
public void removeGame(String id) public void removeGame(String id) {
{
this.gameMediator.removeGame(id); this.gameMediator.removeGame(id);
} }
...@@ -426,14 +424,16 @@ public class DataFacade implements IDataCom, IDataIHMTable, IDataIHMMain { ...@@ -426,14 +424,16 @@ public class DataFacade implements IDataCom, IDataIHMTable, IDataIHMMain {
public PublicUser getMyPublicUserProfile() { public PublicUser getMyPublicUserProfile() {
PublicUser usr = this.userMediator.getMyPublicUserProfile(); PublicUser usr = this.userMediator.getMyPublicUserProfile();
try { if (usr != null) {
usr.setNumberDefeatsClassic(this.getNumberDefeatsClassic()); try {
usr.setNumberDefeatsClassic(this.getNumberDefeatsClassic());
usr.setNumberVictoriesClassic(this.getNumberVictoriesClassic()); usr.setNumberVictoriesClassic(this.getNumberVictoriesClassic());
usr.setNumberAbandonsClassic(this.getNumberAbandonsClassic()); usr.setNumberAbandonsClassic(this.getNumberAbandonsClassic());
} catch (DataException ex) { } catch (DataException ex) {
Logger.getLogger(DataFacade.class.getName()).log(Level.SEVERE, null, ex); Logger.getLogger(DataFacade.class.getName()).log(Level.SEVERE, null, ex);
}
} }
return usr; return usr;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment