flutter: 增加部分画X的代码 (WIP)
This commit is contained in:
parent
75e9787ab0
commit
43a9eff2d8
|
@ -128,21 +128,34 @@ class PiecesPainter extends PainterBase {
|
|||
var pieceInnerRadius = pieceRadius * 0.99; // 决定棋子外圈有宽
|
||||
|
||||
// 绘制棋子边界
|
||||
paint.color = Piece.isWhite(pps.piece)
|
||||
? Properties.whitePieceBorderColor
|
||||
: Properties.blackPieceBorderColor;
|
||||
switch (pps.piece) {
|
||||
case Piece.blackStone:
|
||||
paint.color = Properties.blackPieceBorderColor;
|
||||
canvas.drawCircle(pps.pos, pieceRadius, paint); // 临时调试用
|
||||
paint.color = Properties.blackPieceColor;
|
||||
canvas.drawCircle(pps.pos, pieceInnerRadius, paint);
|
||||
break;
|
||||
case Piece.whiteStone:
|
||||
paint.color = Properties.whitePieceBorderColor;
|
||||
canvas.drawCircle(pps.pos, pieceRadius, paint); // 临时调试用
|
||||
paint.color = Properties.whitePieceColor;
|
||||
canvas.drawCircle(pps.pos, pieceInnerRadius, paint);
|
||||
break;
|
||||
case Piece.ban:
|
||||
print("pps.piece is Ban");
|
||||
paint.color = Properties.banBorderColor;
|
||||
// TODO
|
||||
paint.color = Properties.banColor;
|
||||
canvas.drawLine(new Offset(0, 0),
|
||||
new Offset(pieceInnerRadius, pieceInnerRadius), paint);
|
||||
canvas.drawLine(new Offset(pieceInnerRadius, 0),
|
||||
new Offset(0, pieceInnerRadius), paint);
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
|
||||
canvas.drawCircle(pps.pos, pieceRadius, paint); // 临时调试用
|
||||
|
||||
// 绘制棋子内部
|
||||
|
||||
// 棋子颜色
|
||||
paint.color = Piece.isWhite(pps.piece)
|
||||
? Properties.whitePieceColor
|
||||
: Properties.blackPieceColor;
|
||||
//paint.color = ColorConst.WhitePieceColor;
|
||||
|
||||
canvas.drawCircle(pps.pos, pieceInnerRadius, paint);
|
||||
/*
|
||||
final textSpan = TextSpan(text: Piece.Names[pps.piece], style: textStyle);
|
||||
|
||||
|
|
|
@ -48,5 +48,8 @@ class Properties {
|
|||
static const whitePieceColor = Color.fromARGB(0xFF, 0xFF, 0xFF, 0xFF);
|
||||
static const whitePieceBorderColor = Color.fromARGB(0xFF, 0x66, 0x00, 0x00);
|
||||
|
||||
static const banColor = Color.fromARGB(0xFF, 0xFF, 0x00, 0x00);
|
||||
static const banBorderColor = Color.fromARGB(0x80, 0xFF, 0x00, 0x00);
|
||||
|
||||
static const pieceTextColor = Color.fromARGB(0xCC, 0xFF, 0xFF, 0xFF);
|
||||
}
|
||||
|
|
|
@ -95,6 +95,10 @@ class Piece {
|
|||
static bool isBlack(String c) => '@'.contains(c);
|
||||
|
||||
static bool isWhite(String c) => 'O'.contains(c);
|
||||
|
||||
static bool isBan(String c) => 'X'.contains(c);
|
||||
|
||||
static bool isEmpty(String c) => '*'.contains(c);
|
||||
}
|
||||
|
||||
class Move {
|
||||
|
|
Loading…
Reference in New Issue