Skip to content

Commit 373478b

Browse files
update view-models lib with new gamesclient 3.5.0-beta.13
1 parent 9342ba9 commit 373478b

4 files changed

Lines changed: 35 additions & 8 deletions

File tree

src/clients/xaml/CodeBreaker.ViewModels/CodeBreaker.ViewModels.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
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>

src/clients/xaml/CodeBreaker.ViewModels/Components/GameViewModel.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.Collections.ObjectModel;
22

3-
using Codebreaker.GameAPIs.Client.Models;
3+
using CodeBreaker.ViewModels.Models;
44

55
namespace 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;

src/clients/xaml/CodeBreaker.ViewModels/Components/MoveViewModel.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using Codebreaker.GameAPIs.Client.Models;
2-
1+
using CodeBreaker.ViewModels.Models;
32

43
namespace 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
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
}

0 commit comments

Comments
 (0)