本文整理汇总了C#中ChessGame.HasTag方法的典型用法代码示例。如果您正苦于以下问题:C# ChessGame.HasTag方法的具体用法?C# ChessGame.HasTag怎么用?C# ChessGame.HasTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ChessGame
的用法示例。
在下文中一共展示了ChessGame.HasTag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Set
public void Set(ChessGame g)
{
idx = -1;
move = null;
total_moves = 0;
if (g == null)
{
player = ChessGamePlayer.
CreatePlayer ();
return;
}
player = g.HasTag ("FEN") ? ChessGamePlayer.
CreateFromFEN (g.
GetTagValue ("FEN",
null)) :
ChessGamePlayer.CreatePlayer ();
game = g;
int n = game.Moves.Count;
if (n > 0)
{
total_moves = n;
}
if (total_moves == 0)
hasNext = false;
else
hasNext = true;
}
示例2: WriteGame
private void WriteGame(ChessGame game)
{
GameSession session = new GameSession ();
session.Set (game);
string white = game.White;
string black = game.Black;
string result = game.Result;
if (white == null)
white = Catalog.GetString ("[White]");
if (black == null)
black = Catalog.GetString ("[Black]");
if (result == null)
result = Catalog.
GetString ("Unknown");
printer.Font = fonts.titleFont;
printer.PrintText (white +
Catalog.
GetString (" vs ") +
black + "\n\n");
printer.Font = fonts.regularFont;
printer.PrintText (Catalog.
GetString ("Result: ") +
result + "\n\n");
printer.Font = fonts.moveFont;
int moveno = 1;
if (game.HasTag ("FEN"))
PrintImageForPosition
(session.player);
bool whitesTurn = true;
bool whiteMoveComment = false;
foreach (PGNChessMove move in game.Moves)
{
// print move
if (move.Move == null)
break;
if (!session.HasNext ())
break;
session.Next ();
session.player.Move (session.
CurrentMove);
if (whitesTurn)
{
printer.PrintText (moveno +
". ");
whitesTurn = false;
}
else
{ // black
moveno++;
whitesTurn = true;
if (whiteMoveComment)
{
printer.PrintText
("\n" +
moveno +
"... ");
whiteMoveComment =
false;
}
}
printer.PrintText (move.DetailedMove +
" ");
if (move.comment != null)
{
printer.LineBreak ();
PrintImageForPosition
(session.player);
printer.Font =
fonts.commentFont;
printer.PrintText (move.
comment);
printer.Font =
fonts.moveFont;
whiteMoveComment = true;
}
}
}