File tree Expand file tree Collapse file tree
src/clients/xaml/CodeBreaker.ViewModels Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2323 <ItemGroup >
2424 <PackageReference Include =" CommunityToolkit.Mvvm" Version =" 8.2.1" />
2525 <PackageReference Include =" Microsoft.Extensions.Options" Version =" 7.0.1" />
26- <PackageReference Include =" CNinnovation.Codebreaker.GamesClient" Version =" 3.5.0-beta.12 " />
26+ <PackageReference Include =" CNinnovation.Codebreaker.GamesClient" Version =" 3.5.0-beta.13 " />
2727 </ItemGroup >
2828
2929 <ItemGroup >
Original file line number Diff line number Diff line change 11using System . Collections . ObjectModel ;
22
3- using Codebreaker . GameAPIs . Client . Models ;
3+ using CodeBreaker . ViewModels . Models ;
44
55namespace CodeBreaker . ViewModels . Components ;
66
@@ -13,7 +13,6 @@ public GameViewModel(Game game)
1313 _game = game ;
1414
1515 ColorList = new List < string > ( _game . FieldValues [ "colors" ] ) ;
16- Code = new List < string > ( _game . Codes ) ;
1716 }
1817
1918 public Guid GameId => _game . GameId ;
@@ -22,8 +21,6 @@ public GameViewModel(Game game)
2221
2322 public string GameType => _game . GameType ;
2423
25- public IReadOnlyList < string > Code { get ; private set ; }
26-
2724 public IReadOnlyList < string > ColorList { get ; private set ; }
2825
2926 public int NumberCodes => _game . NumberCodes ;
Original file line number Diff line number Diff line change 1- using Codebreaker . GameAPIs . Client . Models ;
2-
1+ using CodeBreaker . ViewModels . Models ;
32
43namespace CodeBreaker . ViewModels . Components ;
54
@@ -12,7 +11,9 @@ public MoveViewModel(Move move) =>
1211
1312 public int MoveNumber => _move . MoveNumber ;
1413
14+ // TODO: read-only or updates?
1515 public IReadOnlyList < string > GuessPegs => _move . GuessPegs ;
1616
17- public string [ ] KeyPegs => _move . KeyPegs ;
17+ // TODO: read-only or updates?
18+ public string [ ] KeyPegs => _move . KeyPegs . ToArray ( ) ;
1819}
Original file line number Diff line number Diff line change 1+ using System . Collections . ObjectModel ;
2+
3+ using CommunityToolkit . Mvvm . ComponentModel ;
4+
5+ namespace CodeBreaker . ViewModels . Models ;
6+ public partial class Move ( Guid moveId , int moveNumber ) : ObservableObject
7+ {
8+ public Guid MoveId { get ; private set ; } = moveId ;
9+
10+ /// <summary>
11+ /// The move number for this move within the associated game.
12+ /// </summary>
13+ [ ObservableProperty ]
14+ private int _moveNumber = moveNumber ;
15+
16+ /// <summary>
17+ /// The guess pegs from the user for this move.
18+ /// </summary>
19+ public ObservableCollection < string > GuessPegs { get ; } = new ( ) ;
20+
21+ /// <summary>
22+ /// The result from the analyer for this move based on the associated game that contains the move.
23+ /// </summary>
24+ public ObservableCollection < string > KeyPegs { get ; } = new ( ) ;
25+
26+ public override string ToString ( ) => $ "{ MoveNumber } . " +
27+ $ "{ string . Join ( '#' , GuessPegs ) } : " +
28+ $ "{ string . Join ( '#' , KeyPegs ) } ";
29+ }
You can’t perform that action at this time.
0 commit comments