All the code

This commit is contained in:
2020-12-13 14:27:36 -06:00
parent 9c3d67a07e
commit 9e6a7bca2c
49 changed files with 1878 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
namespace Websockets.ServiceModels.Types
{
public enum ClientAction
{
ListGames,
CreateGame,
JoinGame,
JoinByCode,
LoadGame,
Move,
KeepAlive
}
}

View File

@@ -0,0 +1,8 @@
namespace Websockets.ServiceModels.Types
{
public class Coords
{
public int X { get; set; }
public int Y { get; set; }
}
}

View File

@@ -0,0 +1,8 @@
namespace Websockets.ServiceModels.Types
{
public class Game
{
public string GameName { get; set; }
public string[] Players { get; set; }
}
}

View File

@@ -0,0 +1,33 @@
namespace Websockets.ServiceModels.Types
{
public class Move
{
public string PieceFromCaptured { get; set; }
public Coords From { get; set; }
public Coords To { get; set; }
public bool IsPromotion { get; set; }
/// <summary>
/// Toggles perspective of this move. (ie from player 1 to player 2)
/// </summary>
public static Move ConvertPerspective(Move m)
{
var convertedMove = new Move
{
To = new Coords
{
X = 8 - m.To.X,
Y = 8 - m.To.Y
},
From = new Coords
{
X = 8 - m.From.X,
Y = 8 - m.From.Y
},
IsPromotion = m.IsPromotion,
PieceFromCaptured = m.PieceFromCaptured
};
return convertedMove;
}
}
}