Пример #1
0
 public ChessMove(ChessCamp camp, ChessType chess, ChessType?killed, ChessboardPosition start, ChessboardPosition end, string text)
 {
     Camp   = camp;
     Chess  = chess;
     Killed = killed;
     Start  = start;
     End    = end;
     Text   = text;
 }
Пример #2
0
 /// <summary>
 /// 获取象棋图片
 /// </summary>
 /// <param name="type">棋子类型</param>
 /// <param name="camp">棋子阵营</param>
 /// <returns>返回缓存中的图片</returns>
 public Bitmap GetChessmanBitmap(ChessType type, ChessCamp camp)
 {
     if (camp == ChessCamp.Red)
     {
         return(_RedChessmans[type]);
     }
     else if (camp == ChessCamp.Black)
     {
         return(_BlackChessmans[type]);
     }
     else
     {
         throw new ArgumentException("无效阵营参数", nameof(camp));
     }
 }
Пример #3
0
 public Chessman(ChessType type, ChessCamp camp, ChessboardPosition position)
 {
     Type     = type;
     Camp     = camp;
     Position = position;
 }
Пример #4
0
 public static ChessMove Move(Chessboard chessboard, ChessCamp camp, ChessboardPosition start, ChessboardPosition end)
 {
     throw new NotImplementedException();
 }
Пример #5
0
 public static ChessCamp RivalCamp(this ChessCamp camp)
 => camp == ChessCamp.Red ? ChessCamp.Black : ChessCamp.Red;
Пример #6
0
 /// <summary>
 /// 获取棋子名称
 /// </summary>
 /// <param name="type">棋子类型</param>
 /// <param name="camp">棋子阵营</param>
 /// <returns></returns>
 public static char GetName(this ChessType type, ChessCamp camp)
 {
     return(camp == ChessCamp.Red ? RedChess[type] : BlackChess[type]);
 }
Пример #7
0
 public IEnumerable <Chessman> GetChessmenByType(ChessType type, ChessCamp camp)
 => AlivingChessman.Where(chess => chess.Type == type && chess.Camp == camp);