From 3fbe28accf308844c2116118619882f0f2cd1cc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20LAVERGNE?= Date: Sat, 8 Jun 2024 20:13:11 +0200 Subject: [PATCH] =?UTF-8?q?Quelques=20modification=20pour=20continuer=20un?= =?UTF-8?q?e=20partie=20non=20termin=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/Trek-12/Models/Game/Game.cs | 20 +++++++++++++ .../Trek-12/Trek-12/Views/PageSelectMap.xaml | 10 +++++++ .../Trek-12/Views/PageSelectMap.xaml.cs | 29 +++++++++++++++++-- 3 files changed, 57 insertions(+), 2 deletions(-) diff --git a/source/Trek-12/Models/Game/Game.cs b/source/Trek-12/Models/Game/Game.cs index 6d19c41..374152d 100644 --- a/source/Trek-12/Models/Game/Game.cs +++ b/source/Trek-12/Models/Game/Game.cs @@ -23,6 +23,8 @@ namespace Models.Game [DataContract] public class Game : INotifyPropertyChanged { + public bool IsPreviousGameNotFinished { get; private set; } + /* Persistence Interface */ public IPersistence PersistenceManager { get; set; } @@ -134,6 +136,20 @@ namespace Models.Game { Maps.Add(map); } + + /// + /// Deletes the last game in the list of games. Use for avoiding stack not finished games. + /// + /// + public bool DeleteGame() + { + if (Games.Count == 0) + { + return false; + } + Games.RemoveAt(Games.Count - 1); // Remove the last game + return true; + } /// /// Adds a new best score to the list of best scores. Or updates it if it already exists. @@ -248,6 +264,10 @@ namespace Models.Game } foreach (var game in data.Item2) { + if (game.IsRunning) + { + IsPreviousGameNotFinished = true; + } Games.Add(game); } foreach (var map in data.Item3) diff --git a/source/Trek-12/Trek-12/Views/PageSelectMap.xaml b/source/Trek-12/Trek-12/Views/PageSelectMap.xaml index 68580d9..e86bd52 100644 --- a/source/Trek-12/Trek-12/Views/PageSelectMap.xaml +++ b/source/Trek-12/Trek-12/Views/PageSelectMap.xaml @@ -42,6 +42,16 @@ +