diff --git a/source/Trek-12/Models/Game/Cell.cs b/source/Trek-12/Models/Game/Cell.cs index b2eb151..c14e579 100644 --- a/source/Trek-12/Models/Game/Cell.cs +++ b/source/Trek-12/Models/Game/Cell.cs @@ -1,14 +1,18 @@ -namespace Models.Game +using System.Runtime.Serialization; + +namespace Models.Game { /// /// The Cell class represents a cell in the application. /// + [DataContract] public class Cell : Position, IEquatable { /// /// The value of the cell. /// private int? _value; + [DataMember] public int? Value { get => _value; set @@ -24,14 +28,17 @@ /// /// The fact that the cell is dangerous or not. /// + [DataMember] public bool IsDangerous { get; set; } + [DataMember] public bool Valid { get; set; } /// /// Atribute to know if the cell is a penalty cell. /// + [DataMember] private bool Penalty { get; set; } /// diff --git a/source/Trek-12/Models/Game/Game.cs b/source/Trek-12/Models/Game/Game.cs index 0294cd4..5dbc3b4 100644 --- a/source/Trek-12/Models/Game/Game.cs +++ b/source/Trek-12/Models/Game/Game.cs @@ -5,6 +5,7 @@ using System.Collections.ObjectModel; using System.ComponentModel; using System.Linq; using System.Runtime.CompilerServices; +using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; using System.Threading.Tasks.Dataflow; @@ -19,6 +20,7 @@ namespace Models.Game /// The Game class represents a game session in the application. /// It contains all the necessary properties and methods to manage a game, including the game loop, dice rolling, and use of the game rules. /// + [DataContract] public class Game : INotifyPropertyChanged { /* Persistence */ @@ -74,19 +76,24 @@ namespace Models.Game } private bool _isRunning; + [DataMember] public bool IsRunning { get => _isRunning; private set => _isRunning = value; } - public Player CurrentPlayer { get; private set; } + [DataMember] + public Player? CurrentPlayer { get; private set; } - public Map UsedMap { get; private set; } + [DataMember] + public Map? UsedMap { get; private set; } public Dice Dice1 { get; private set;} + public Dice Dice2 { get; private set; } + [DataMember] public int Turn { get; private set; } public Rules.Rules GameRules { get; } diff --git a/source/Trek-12/Models/Game/Map.cs b/source/Trek-12/Models/Game/Map.cs index e59c1b2..a4ffadf 100644 --- a/source/Trek-12/Models/Game/Map.cs +++ b/source/Trek-12/Models/Game/Map.cs @@ -1,4 +1,5 @@ using System.Collections.ObjectModel; +using System.Runtime.Serialization; namespace Models.Game { @@ -6,33 +7,39 @@ namespace Models.Game /// /// The Map class is the representation of the game map with the board and the operations table. /// + [DataContract] public class Map { /// /// It is the list of cells on the map. /// + [DataMember] public ReadOnlyObservableCollection Boards { get; private set; } ObservableCollection board = new ObservableCollection(); - + /// /// It is the backgrond image of the map /// + [DataMember] public string Background { get; private set; } /// /// It is the grid of the possible operation in the game /// + [DataMember] public ReadOnlyObservableCollection OperationGrid { get; private set; } ObservableCollection operationGrid = new ObservableCollection(); /// /// It is a list of a list containing user's rope paths in the current game /// + [DataMember] public List> RopePaths { get; private set; } /// /// It is a list of a list containing user's zones in the current game /// + [DataMember] public List> Zones { get; private set; } /// diff --git a/source/Trek-12/Models/Game/OperationCell.cs b/source/Trek-12/Models/Game/OperationCell.cs index 25ebbb1..7a1b19d 100644 --- a/source/Trek-12/Models/Game/OperationCell.cs +++ b/source/Trek-12/Models/Game/OperationCell.cs @@ -1,15 +1,18 @@ using System.ComponentModel; +using System.Runtime.Serialization; namespace Models.Game { /// /// Represents a cell in the operation grid of the game. /// + [DataContract] public class OperationCell : Position { /// /// It tells if the operation is checked or not in the operation grid of the game. /// + [DataMember] public bool IsChecked { get; private set; } /// diff --git a/source/Trek-12/Models/Game/Position.cs b/source/Trek-12/Models/Game/Position.cs index 980e80c..e6edc7a 100644 --- a/source/Trek-12/Models/Game/Position.cs +++ b/source/Trek-12/Models/Game/Position.cs @@ -1,5 +1,6 @@ using System.ComponentModel; using System.Runtime.CompilerServices; +using System.Runtime.Serialization; namespace Models.Game { @@ -7,16 +8,19 @@ namespace Models.Game /// /// The Position (x,y) of a cell in the game. /// + [DataContract] public class Position { /// /// The X coordinate. /// + [DataMember] public int X { get; set; } /// /// The Y coordinate. /// + [DataMember] public int Y { get; set; } /// diff --git a/source/Trek-12/Trek-12/App.xaml.cs b/source/Trek-12/Trek-12/App.xaml.cs index 2265b67..d838b8b 100644 --- a/source/Trek-12/Trek-12/App.xaml.cs +++ b/source/Trek-12/Trek-12/App.xaml.cs @@ -1,11 +1,12 @@ using System.Diagnostics; using System.Runtime.Serialization.DataContracts; -using DataContractPersistence; -using Models.Game; -using Models.Interfaces; namespace Trek_12 { + using Models.Game; + using Models.Interfaces; + using DataContractPersistence; + public partial class App : Application { public string FileName { get; set; } = "data.json"; @@ -33,6 +34,13 @@ namespace Trek_12 Debug.WriteLine("Data loaded from " + fullPath); Manager.LoadData(); } + /* Add the permanent maps if they are not already in the game */ + if (Manager.Maps.Count == 0) + { + Manager.AddMap(new Map("profile.jpg")); + Manager.AddMap(new Map("montagne1.png")); + Manager.AddMap(new Map("tmp1.jpeg")); + } MainPage = new AppShell(); diff --git a/source/Trek-12/Trek-12/AppShell.xaml b/source/Trek-12/Trek-12/AppShell.xaml index 79a9d52..c66ddf6 100644 --- a/source/Trek-12/Trek-12/AppShell.xaml +++ b/source/Trek-12/Trek-12/AppShell.xaml @@ -5,38 +5,11 @@ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:Trek_12" xmlns:views="clr-namespace:Trek_12.Views" - Shell.FlyoutBehavior="Flyout" + Shell.FlyoutBehavior="Disabled" Title="Trek_12" - Shell.NavBarIsVisible="False"> - - - - - - - - - - - - + Shell.NavBarIsVisible="False" + Shell.FlyoutItemIsVisible="False" + Shell.TabBarIsVisible="False"> + diff --git a/source/Trek-12/Trek-12/AppShell.xaml.cs b/source/Trek-12/Trek-12/AppShell.xaml.cs index 61288b8..eba8dbd 100644 --- a/source/Trek-12/Trek-12/AppShell.xaml.cs +++ b/source/Trek-12/Trek-12/AppShell.xaml.cs @@ -16,6 +16,7 @@ namespace Trek_12 Routing.RegisterRoute(nameof(PageSelectMap), typeof(PageSelectMap)); Routing.RegisterRoute(nameof(PageRegles), typeof(PageRegles)); Routing.RegisterRoute(nameof(PageLeaderBoard), typeof(PageLeaderBoard)); + Routing.RegisterRoute(nameof(PageBoard), typeof(PageBoard)); } } } diff --git a/source/Trek-12/Trek-12/Resources/AppIcon/app_icon.png b/source/Trek-12/Trek-12/Resources/AppIcon/app_icon.png new file mode 100644 index 0000000..c9df929 Binary files /dev/null and b/source/Trek-12/Trek-12/Resources/AppIcon/app_icon.png differ diff --git a/source/Trek-12/Trek-12/Resources/AppIcon/appicon.svg b/source/Trek-12/Trek-12/Resources/AppIcon/appicon.svg deleted file mode 100644 index 9d63b65..0000000 --- a/source/Trek-12/Trek-12/Resources/AppIcon/appicon.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/source/Trek-12/Trek-12/Resources/AppIcon/appiconfg.svg b/source/Trek-12/Trek-12/Resources/AppIcon/appiconfg.svg deleted file mode 100644 index 21dfb25..0000000 --- a/source/Trek-12/Trek-12/Resources/AppIcon/appiconfg.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/source/Trek-12/Trek-12/Resources/Images/back_arrow.png b/source/Trek-12/Trek-12/Resources/Images/back_arrow.png new file mode 100644 index 0000000..fcc3d87 Binary files /dev/null and b/source/Trek-12/Trek-12/Resources/Images/back_arrow.png differ diff --git a/source/Trek-12/Trek-12/Resources/Images/user.png b/source/Trek-12/Trek-12/Resources/Images/user.png new file mode 100644 index 0000000..9c4f84d Binary files /dev/null and b/source/Trek-12/Trek-12/Resources/Images/user.png differ diff --git a/source/Trek-12/Trek-12/Trek-12.csproj b/source/Trek-12/Trek-12/Trek-12.csproj index 1630103..4d2aac5 100644 --- a/source/Trek-12/Trek-12/Trek-12.csproj +++ b/source/Trek-12/Trek-12/Trek-12.csproj @@ -40,7 +40,7 @@ - + @@ -57,8 +57,11 @@ + + + diff --git a/source/Trek-12/Trek-12/Views/PageBoard.xaml b/source/Trek-12/Trek-12/Views/PageBoard.xaml index 6dfa23c..e0c2770 100644 --- a/source/Trek-12/Trek-12/Views/PageBoard.xaml +++ b/source/Trek-12/Trek-12/Views/PageBoard.xaml @@ -14,7 +14,7 @@ HorizontalOptions="Center" VerticalOptions="Center" Padding="0"> -