checkpoint
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
using Gameboard.ShogiUI.Sockets.ServiceModels.Types;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Gameboard.ShogiUI.Sockets.ServiceModels.Api
|
||||
{
|
||||
public class GetSessionResponse
|
||||
{
|
||||
public Game Game { get; set; }
|
||||
/// <summary>
|
||||
/// The perspective on the game of the requesting user.
|
||||
/// </summary>
|
||||
public WhichPerspective PlayerPerspective { get; set; }
|
||||
public BoardState BoardState { get; set; }
|
||||
public IList<Move> MoveHistory { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace Gameboard.ShogiUI.Sockets.ServiceModels.Api
|
||||
{
|
||||
public class GetSessionsResponse
|
||||
{
|
||||
public Collection<Game> PlayerHasJoinedSessions { get; set; }
|
||||
public Collection<Game> AllOtherSessions { get; set; }
|
||||
public Collection<Session> PlayerHasJoinedSessions { get; set; }
|
||||
public Collection<Session> AllOtherSessions { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Gameboard.ShogiUI.Sockets.ServiceModels.Socket
|
||||
public class CreateGameResponse : IResponse
|
||||
{
|
||||
public string Action { get; }
|
||||
public Game Game { get; set; }
|
||||
public Session Game { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The player who created the game.
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Gameboard.ShogiUI.Sockets.ServiceModels.Types
|
||||
public Dictionary<string, Piece?> Board { get; set; } = new Dictionary<string, Piece?>();
|
||||
public IReadOnlyCollection<Piece> Player1Hand { get; set; } = Array.Empty<Piece>();
|
||||
public IReadOnlyCollection<Piece> Player2Hand { get; set; } = Array.Empty<Piece>();
|
||||
public WhichPerspective? PlayerInCheck { get; set; }
|
||||
public WhichPerspective WhoseTurn { get; set; }
|
||||
public WhichPlayer? PlayerInCheck { get; set; }
|
||||
public WhichPlayer WhoseTurn { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Gameboard.ShogiUI.Sockets.ServiceModels.Types
|
||||
{
|
||||
public class Game
|
||||
{
|
||||
public string Player1 { get; set; }
|
||||
public string? Player2 { get; set; }
|
||||
public string GameName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Players[0] is the session owner, Players[1] is the other person.
|
||||
/// </summary>
|
||||
public IReadOnlyList<string> Players
|
||||
{
|
||||
get
|
||||
{
|
||||
var list = new List<string>(2) { Player1 };
|
||||
if (!string.IsNullOrEmpty(Player2)) list.Add(Player2);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for serialization.
|
||||
/// </summary>
|
||||
public Game()
|
||||
{
|
||||
}
|
||||
|
||||
public Game(string gameName, string player1, string? player2 = null)
|
||||
{
|
||||
GameName = gameName;
|
||||
Player1 = player1;
|
||||
Player2 = player2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,6 @@
|
||||
{
|
||||
public bool IsPromoted { get; set; }
|
||||
public WhichPiece WhichPiece { get; set; }
|
||||
public WhichPerspective Owner { get; set; }
|
||||
public WhichPlayer Owner { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
10
Gameboard.ShogiUI.Sockets.ServiceModels/Types/Session.cs
Normal file
10
Gameboard.ShogiUI.Sockets.ServiceModels/Types/Session.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace Gameboard.ShogiUI.Sockets.ServiceModels.Types
|
||||
{
|
||||
public class Session
|
||||
{
|
||||
public string Player1 { get; set; }
|
||||
public string? Player2 { get; set; }
|
||||
public string GameName { get; set; }
|
||||
public BoardState BoardState { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
namespace Gameboard.ShogiUI.Sockets.ServiceModels.Types
|
||||
{
|
||||
public enum WhichPerspective
|
||||
public enum WhichPlayer
|
||||
{
|
||||
Player1,
|
||||
Player2,
|
||||
Spectator
|
||||
Player2
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user