Демонстрируемый код на практических занятиях
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
namespace ClassLib000.Chess
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Фигура
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class Figure
|
|
|
|
|
{
|
|
|
|
|
#region public fields
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Тип фигуры
|
|
|
|
|
/// </summary>
|
|
|
|
|
public EFigureType Type;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Цвет фигуры
|
|
|
|
|
/// </summary>
|
|
|
|
|
public EColor Color;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Позиция
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int X;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Позиция
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int Y;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Срублена ли фигура
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool IsBroken;
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
public Figure(EColor enColor, EFigureType type, int x, int y)
|
|
|
|
|
{
|
|
|
|
|
this.Type = type;
|
|
|
|
|
this.Color = enColor;
|
|
|
|
|
this.X = x;
|
|
|
|
|
this.Y = y;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public string AsTextString()
|
|
|
|
|
{
|
|
|
|
|
int x = this.X;
|
|
|
|
|
int y = this.Y;
|
|
|
|
|
EColor figureColor = this.Color;
|
|
|
|
|
EFigureType ft = this.Type;
|
|
|
|
|
// TODO: .. Console.SetCursorPosition(posx, posy);
|
|
|
|
|
return $"{x};{y};{figureColor};{(int)ft}";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|