Move from the hand.

This commit is contained in:
2023-02-01 22:49:28 -06:00
parent e2eff4f8b5
commit 3bf9aa3ee3
29 changed files with 248 additions and 133 deletions

View File

@@ -2,12 +2,12 @@
namespace Shogi.Contracts.Socket;
public interface ISocketResponse
public interface ISocketMessage
{
SocketAction Action { get; }
}
public class SocketResponse : ISocketResponse
public class SocketResponse : ISocketMessage
{
public SocketAction Action { get; set; }
}

View File

@@ -1,9 +0,0 @@
using Shogi.Contracts.Types;
namespace Shogi.Contracts.Socket
{
public interface ISocketRequest
{
SocketAction Action { get; }
}
}

View File

@@ -2,7 +2,7 @@
namespace Shogi.Contracts.Socket;
public class PlayerHasMovedMessage : ISocketResponse
public class PlayerHasMovedMessage : ISocketMessage
{
public SocketAction Action { get; }
public string SessionName { get; set; }

View File

@@ -2,7 +2,7 @@
namespace Shogi.Contracts.Socket;
public class SessionCreatedSocketMessage : ISocketResponse
public class SessionCreatedSocketMessage : ISocketMessage
{
public SocketAction Action => SocketAction.SessionCreated;
}

View File

@@ -2,11 +2,11 @@
namespace Shogi.Contracts.Socket;
public class SessionJoinedByPlayerSocketMessage : ISocketResponse
public class SessionJoinedByPlayerSocketMessage : ISocketMessage
{
public SocketAction Action => SocketAction.SessionJoined;
public string SessionName { get; }
public string SessionName { get; set; }
public SessionJoinedByPlayerSocketMessage(string sessionName)
{

View File

@@ -2,8 +2,8 @@
public class Session
{
public string Player1 { get; set; }
public string? Player2 { get; set; }
public User Player1 { get; set; }
public User? Player2 { get; set; }
public string SessionName { get; set; }
public BoardState BoardState { get; set; }
}

View File

@@ -1,9 +1,17 @@
namespace Shogi.Contracts.Types
{
public class User
{
public string Id { get; set; } = string.Empty;
namespace Shogi.Contracts.Types;
public string Name { get; set; } = string.Empty;
}
public class User
{
public string Id { get; set; } = string.Empty;
/// <summary>
/// A display name for the user.
/// </summary>
public string Name { get; set; } = string.Empty;
public User(string id, string name)
{
Id = id;
Name = name;
}
}