本文整理汇总了C#中IPlayer.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# IPlayer.Equals方法的具体用法?C# IPlayer.Equals怎么用?C# IPlayer.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPlayer
的用法示例。
在下文中一共展示了IPlayer.Equals方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
public PlayResponse Execute(PlayRequest PlayRequest)
{
_currentPlayer = ((_currentPlayer != null) && _currentPlayer.Equals(_realPlayer)) ? _AIPlayer : _realPlayer;
PlayResponse response = _currentPlayer.Play(PlayRequest);
if (!response.PlayerWon)
{
_currentPlayer = ((_currentPlayer != null) && _currentPlayer.Equals(_realPlayer)) ? _AIPlayer : _realPlayer;
PlayRequest request = new PlayRequest();
request.TicTacToeBoard = response.TicTacToeBoard;
response = _currentPlayer.Play(request);
}
return response;
}
示例2: DefaultGame
public DefaultGame(IApp app, IGameBoard board, IPlayer player1, IPlayer player2, IGameRules gameRules)
{
if (app == null)
throw new ArgumentNullException(nameof(app));
if (player1 == null)
throw new ArgumentNullException(nameof(player1));
if (player2 == null)
throw new ArgumentNullException(nameof(player2));
if (player1.Equals(player2))
throw new ArgumentException($"{nameof(player1)} is the same as {nameof(player2)}");
if (player1.Name == player2.Name)
throw new ArgumentException(
$"{nameof(player1)}.{nameof(player1.Name)} == {nameof(player2)}.{nameof(player2.Name)}");
this.App = app;
this.Players = new [] { player1, player2 };
var reversedBoard = new DefaultBoard(new ReversedLanes(board.Lanes), board.Bar, board.BearedOff);
this.Boards = new [] { board, reversedBoard };
this.Rules = gameRules;
}
示例3: TestSerialization
private void TestSerialization(IPlayer player)
{
// Serializes:
Stream stream = File.Open("Player.sav", FileMode.Create);
BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(stream, player);
stream.Close();
// Deserializes and checks the values:
stream = File.Open("Player.sav", FileMode.Open);
formatter = new BinaryFormatter();
IPlayer savedPlayer = (IPlayer)formatter.Deserialize(stream);
stream.Close();
Assert.IsTrue(player.Equals(savedPlayer));
Assert.AreEqual(player.Points, savedPlayer.Points);
Assert.AreEqual(player.Name, savedPlayer.Name);
Assert.AreEqual(player.NationNumber, savedPlayer.NationNumber);
}
示例4: objPlayer_OnShotBoxControllerStatus
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void objPlayer_OnShotBoxControllerStatus(object sender, SHOTBOXARGS e)
{
switch (e.SHOTBOXRESPONSE)
{
case SHOTBOXMSG.PLAYCOMPLETE:
m_objplayertodelete = sender as IPlayer;
if (m_objplayertodelete != null && BtnLoadBG.Text != "Unload BG")
{
m_objplayertodelete.DeleteSg();
}
break;
case SHOTBOXMSG.SGDELETED:
if (m_objplayertodelete != null && m_objplayertodelete.Equals(sender as IPlayer))
{
TableLayoutPanelCellPosition position = tableLayoutPanel1.GetPositionFromControl(m_objplayertodelete as Form);
tableLayoutPanel1.Controls.Remove(m_objplayertodelete as Form);
switch (position.Column)
{
case 0:
foreach (DataGridViewRow dr in dgvSelectPlayer.Rows)
{
dr.Cells[1].Value = false;
}
break;
case 1:
foreach (DataGridViewRow dr in dgvSelectPlayer.Rows)
{
dr.Cells[2].Value = false;
}
break;
}
break;
}
break;
}
}