|
|
@ -1,17 +1,9 @@
|
|
|
|
using QwirkleClassLibrary.Boards;
|
|
|
|
using QwirkleClassLibrary.Boards;
|
|
|
|
using QwirkleClassLibrary.Events;
|
|
|
|
|
|
|
|
using QwirkleClassLibrary.Games;
|
|
|
|
using QwirkleClassLibrary.Games;
|
|
|
|
using QwirkleClassLibrary.Players;
|
|
|
|
using QwirkleClassLibrary.Players;
|
|
|
|
using QwirkleClassLibrary.Tiles;
|
|
|
|
using QwirkleClassLibrary.Tiles;
|
|
|
|
using QwirkleConsoleApp;
|
|
|
|
using QwirkleConsoleApp;
|
|
|
|
using System.Collections.Immutable;
|
|
|
|
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
|
|
|
|
using System.Diagnostics.Metrics;
|
|
|
|
|
|
|
|
using System.Net.Quic;
|
|
|
|
|
|
|
|
using System.Runtime.Serialization;
|
|
|
|
|
|
|
|
using System.Runtime.Serialization.Json;
|
|
|
|
|
|
|
|
using System.Text;
|
|
|
|
using System.Text;
|
|
|
|
using System.Transactions;
|
|
|
|
|
|
|
|
using QwirkleClassLibrary.Persistences;
|
|
|
|
using QwirkleClassLibrary.Persistences;
|
|
|
|
using static System.Console;
|
|
|
|
using static System.Console;
|
|
|
|
|
|
|
|
|
|
|
@ -423,12 +415,33 @@ static void MainGame()
|
|
|
|
Game loadedGame;
|
|
|
|
Game loadedGame;
|
|
|
|
|
|
|
|
|
|
|
|
IGamePersistence gameLoad = new GamePersistenceXml();
|
|
|
|
IGamePersistence gameLoad = new GamePersistenceXml();
|
|
|
|
loadedGame = gameLoad.LoadGame();
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
loadedGame = gameLoad.LoadGame();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ForegroundColor = ConsoleColor.Red;
|
|
|
|
|
|
|
|
WriteLine("ERROR : No game saved ! Creating a new game !");
|
|
|
|
|
|
|
|
ResetColor();
|
|
|
|
|
|
|
|
loadedGame = new Game();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ILeaderboardPersistence leaderboardLoad = new LeaderboardPersistenceJson();
|
|
|
|
ILeaderboardPersistence leaderboardLoad = new LeaderboardPersistenceJson();
|
|
|
|
leaderboard = leaderboardLoad.LoadLeaderboard();
|
|
|
|
leaderboard = leaderboardLoad.LoadLeaderboard();
|
|
|
|
|
|
|
|
|
|
|
|
MainMenuContinue(loadedGame);
|
|
|
|
if (loadedGame.GameRunning)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MainMenuContinue(loadedGame);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
AddPlayers(loadedGame);
|
|
|
|
|
|
|
|
loadedGame.StartGame();
|
|
|
|
|
|
|
|
MainMenu(loadedGame);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
leaderboard.AddScoreInLead(loadedGame.ScoreBoard);
|
|
|
|
leaderboard.AddScoreInLead(loadedGame.ScoreBoard);
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|