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; }
/// <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)); } }
public Chessman(ChessType type, ChessCamp camp, ChessboardPosition position) { Type = type; Camp = camp; Position = position; }
public static ChessMove Move(Chessboard chessboard, ChessCamp camp, ChessboardPosition start, ChessboardPosition end) { throw new NotImplementedException(); }
public static ChessCamp RivalCamp(this ChessCamp camp) => camp == ChessCamp.Red ? ChessCamp.Black : ChessCamp.Red;
/// <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]); }
public IEnumerable <Chessman> GetChessmenByType(ChessType type, ChessCamp camp) => AlivingChessman.Where(chess => chess.Type == type && chess.Camp == camp);