Better communication
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
namespace Gameboard.ShogiUI.Sockets.ServiceModels.Socket.Types
|
||||
{
|
||||
public class Coords
|
||||
{
|
||||
public int X { get; set; }
|
||||
public int Y { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,33 +1,12 @@
|
||||
namespace Gameboard.ShogiUI.Sockets.ServiceModels.Socket.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;
|
||||
}
|
||||
}
|
||||
public class Move
|
||||
{
|
||||
public string PieceFromCaptured { get; set; }
|
||||
/// <summary>Board position notation, like A3 or G1</summary>
|
||||
public string From { get; set; }
|
||||
/// <summary>Board position notation, like A3 or G1</summary>
|
||||
public string To { get; set; }
|
||||
public bool IsPromotion { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user