当前位置: 首页>>代码示例>>C#>>正文


C# IPlayer.Equals方法代码示例

本文整理汇总了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;
        }
开发者ID:AvetisG,项目名称:TicTacToe.NET,代码行数:17,代码来源:RealPlayerVsAIPlayer.cs

示例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;
        }
开发者ID:MarinAtanasov,项目名称:Backgammon,代码行数:22,代码来源:DefaultGame.cs

示例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);
        }
开发者ID:pchaigno,项目名称:smallworld,代码行数:18,代码来源:TestPlayer.cs

示例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;
     }
 }
开发者ID:WASP3D,项目名称:Soccer-App,代码行数:41,代码来源:SoccerApp.cs


注:本文中的IPlayer.Equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。