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


C# Player.getName方法代码示例

本文整理汇总了C#中Player.getName方法的典型用法代码示例。如果您正苦于以下问题:C# Player.getName方法的具体用法?C# Player.getName怎么用?C# Player.getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Player的用法示例。


在下文中一共展示了Player.getName方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: checkLoss

    public void checkLoss(Player p)
    {
        int numVillages = p.getVillages().Count();
        if (numVillages == 0)
        {
            int curPlayerIndex = findPlayerIndex (p);
            game.networkView.RPC ("setPlayerStatus",RPCMode.AllBuffered,(int)PlayerStatus.LOST,curPlayerIndex);
            p.addLoss(); //update database
            gameGUI.displayError (@""+ p.getName ()+" has lost and is out of the game.");

        }

        int loserCounter = 0;
        int winnerIndex = 0;
        for(int i = 0; i < game.getPlayerStatuses().Count; i++)
        {
            if(game.getPlayerStatuses()[i] == PlayerStatus.LOST)
            {
                loserCounter++;
            }
            else if (game.getPlayerStatuses()[i] == PlayerStatus.PLAYING)
            {
                winnerIndex = i;
            }
        }
        if (loserCounter == players.Count ()-2)
        {
            game.networkView.RPC ("setPlayerStatus",RPCMode.AllBuffered,(int)PlayerStatus.WIN,winnerIndex);
        }
    }
开发者ID:hysoftwareeng,项目名称:MedievalWarfare,代码行数:30,代码来源:GameManager.cs

示例2: Main

        static void Main(string[] args)
        {
            Console.Write("Name A : ");
            Player player1 = new Player(Console.ReadLine());
            Console.Write("Name B : ");
            Player player2 = new Player(Console.ReadLine());

            List<Cards> allCard = new List<Cards>();

            for (int i = 1; i <= 13; i++)
            {
                for (int j = 1; j <= 4; j++)
                {
                    allCard.Add(new Cards(i, j));
                }
            }
            allCard = ShuffleList(allCard);

            for (int i = 0; i < 52; i += 2)
            {
                player1.addCard(allCard[i]);
                player2.addCard(allCard[i + 1]);
            }
            do
            {
                if (player1.getNumdeck() == 26)
                {
                    Console.Write("\nStart Game, Each player has " + player1.getNumdeck() + " Cards.\n");
                }
                else if (player1.getNumdeck() == 1)
                {
                    Console.Write("\nNext Round, Each player has " + player1.getNumdeck() + " Card.\n");
                }
                else Console.Write("\nNext Round, Each player has " + player1.getNumdeck() + " Cards.\n");

                Cards c1 = player1.Draw();
                Console.Write(player1.getName() + " Draw : " + c1.nameRank() + c1.nameSuit() + "\n");
                Cards c2 = player2.Draw();
                Console.Write(player2.getName() + " Draw : " + c2.nameRank() + c2.nameSuit() + "\n");
                if (c1.getRank() < c2.getRank())
                {
                    Console.WriteLine(player1.getName() + " Win! and get 2 cards.");
                    player1.addPile(c1);
                    player1.addPile(c2);
                }
                else if (c1.getRank() > c2.getRank())
                {
                    Console.WriteLine(player2.getName() + " Win! and get 2 cards.");
                    player2.addPile(c1);
                    player2.addPile(c2);
                }
                else
                {

                    int i, round;
                    List<Cards> tempc1 = new List<Cards>();
                    List<Cards> tempc2 = new List<Cards>();

                    tempc1.Add(c1);
                    tempc2.Add(c2);

                    if (player1.getNumdeck() < c1.getRank())
                    {
                        round = player1.getNumdeck();
                    }
                    else round = c1.getRank();
                    Console.WriteLine("Card is equal at rank " + Convert.ToString(c1.getRank()) + "\nEach player draw " + Convert.ToString(round) + " Cards");
                    for (i = 0; i < round; i++)
                    {
                        tempc1.Add(player1.Draw());
                        tempc2.Add(player2.Draw());
                    }

                    Console.WriteLine(player1.getName() + " draw last card is " + tempc1[i - 1].nameRank() + tempc1[i - 1].nameSuit());
                    Console.WriteLine(player2.getName() + " draw last card is " + tempc2[i - 1].nameRank() + tempc2[i - 1].nameSuit());

                    if (tempc1[i - 1].getRank() < tempc2[i - 1].getRank())
                    {
                        Console.WriteLine(player1.getName() + " Win! and get " + Convert.ToString(round * 2) + "+2 Cards");
                        for (i = 0; i < round + 1; i++)
                        {
                            player1.addPile(tempc1[i]);
                            player1.addPile(tempc2[i]);
                        }
                    }
                    else if (tempc1[i - 1].getRank() > tempc2[i - 1].getRank())
                    {
                        Console.WriteLine(player2.getName() + " Win! and get " + Convert.ToString(round * 2) + "+2 Cards");
                        for (i = 0; i < round + 1; i++)
                        {
                            player2.addPile(tempc1[i]);
                            player2.addPile(tempc2[i]);
                        }
                    }
                    else
                    {
                        Console.WriteLine("Equal again! Return all cards to your deck, then shuffle it.");
                        for (i = 0; i < round + 1; i++)
                        {
                            player1.addCard(tempc1[i]);
//.........这里部分代码省略.........
开发者ID:cpe200-158-sec2-0565,项目名称:AssignHiLowCardGameUML,代码行数:101,代码来源:Program.cs

示例3: updatePlayerName

 /*
 *   Param: Player
 *   Updates the UI Player Name for a given player.
 */
 public void updatePlayerName(Player player)
 {
     labelPlayerNames[player.getPositionOnBoard()].Text = player.getName();
 }
开发者ID:TenLetters,项目名称:AIPokerPlayer,代码行数:8,代码来源:GameForm.cs

示例4: setPlayerTurn

 /*
  *   Param: Player
  *   Update the current player turn to Player's name
  */
 public void setPlayerTurn(Player player)
 {
     this.Invoke((MethodInvoker)delegate
     {
         labelPlayerNameTurn.Text = player.getName();
     });
 }
开发者ID:TenLetters,项目名称:AIPokerPlayer,代码行数:11,代码来源:GameForm.cs

示例5: setBigBlindPlayer

 /*
 *   Param: Player
 *   Update the current big blind player
 */
 public void setBigBlindPlayer(Player player)
 {
     this.Invoke((MethodInvoker)delegate
     {
         labelBigBlindPlayerName.Text = player.getName();
     });
 }
开发者ID:TenLetters,项目名称:AIPokerPlayer,代码行数:11,代码来源:GameForm.cs

示例6: removePlayer

    /*
    return 1 if removing from front
    return 2 if not front
     */
    public int removePlayer(Player player)
    {
        Debug.Log ("removing");

        Node current = front;
        Node nodeToDelete = null;
        //if at front
        if (current.item.getName () == player.getName ()) {
            //nodeToDelete = front;
            //front = front.next;
            Debug.Log("front");
            Dequeue();
            return 1;
        } else {
            while(current.item.getName() != player.getName()){

                if(current.next.item.getName()==( player.getName())){
                    Debug.Log("found");
                    break;
                }
                Debug.Log("current next");
                current = current.next;//current = node before the node we want to delete
            }
            nodeToDelete = current.next;
            Debug.Log(nodeToDelete.item.getName());
            Debug.Log(nodeToDelete.next);
            //rearrange links
            current.next = nodeToDelete.next;
            return 2;
        }
    }
开发者ID:113256,项目名称:bowling-game-unity3d,代码行数:35,代码来源:PlayerQueue.cs

示例7: notifyOtherPlayerTurnStarted

 public void notifyOtherPlayerTurnStarted(Player p)
 {
     Console.WriteLine(p.getName() + "/'s Turn");
 }
开发者ID:nzdev,项目名称:Monopoly-Deal,代码行数:4,代码来源:UI.cs

示例8: test_contructer

 public void test_contructer()
 {
     Player thePlayer = new Player("Jim");
     Assert.IsNotNull(thePlayer);
     StringAssert.Contains(thePlayer.getName(), "Player");
 }
开发者ID:carl-blance,项目名称:Monopoly,代码行数:6,代码来源:_PlayerTest.cs

示例9: learnAndCleanUp

 public void learnAndCleanUp(Player winner)
 {
     if (getName() == winner.getName()) // we won so increment our attributes since they lead to a winning hand
     {
         if (suited) preFlopMultiplierValues.incrementSuitedMultiplier();
         if (pair) preFlopMultiplierValues.incrementPairMultiplier();
         if (highStraightChance) preFlopMultiplierValues.incrementHighStraightChanceMultiplier();
         if (lowStraightChance) preFlopMultiplierValues.incrementLowStraightChanceMultiplier();
         if (highCard) preFlopMultiplierValues.incrementHighCardMultiplier();
         if (doubleHighCard) preFlopMultiplierValues.incrementDoubleHighCardMultiplier();
     }
     else //not the winner decrement our attributes since they did not lead to a winning hand
     {
         if (suited) preFlopMultiplierValues.decrementSuitedMultiplier();
         if (pair) preFlopMultiplierValues.decrementPairMultiplier();
         if (highStraightChance) preFlopMultiplierValues.decrementHighStraightChanceMultiplier();
         if (lowStraightChance) preFlopMultiplierValues.decrementLowStraightChanceMultiplier();
         if (highCard) preFlopMultiplierValues.decrementHighCardMultiplier();
         if (doubleHighCard) preFlopMultiplierValues.decrementDoubleHighCardMultiplier();
     }
     resetRoundBasedVariables();
     serializeMultiplierValues();
 }
开发者ID:TenLetters,项目名称:AIPokerPlayer,代码行数:23,代码来源:AIPlayer.cs

示例10: findPlayerIndex

 public int findPlayerIndex(Player p)
 {
     int index = players.FindIndex (i => i.getName () == p.getName ());
     return index;
 }
开发者ID:hysoftwareeng,项目名称:MedievalWarfare,代码行数:5,代码来源:GameManager.cs

示例11: testPlayerNameStoredWhenSet

 public void testPlayerNameStoredWhenSet()
 {
     testSubject = new Player();
     testSubject.setName("Tony Stark");
     Assert.AreEqual("Tony Stark", testSubject.getName());
 }
开发者ID:sarmstrongLN,项目名称:C-Sharp-OXO,代码行数:6,代码来源:PlayerTests.cs

示例12: testPlayerNameDefaultsToPlayer

 public void testPlayerNameDefaultsToPlayer()
 {
     testSubject = new Player();
     Assert.AreEqual("Player", testSubject.getName());
 }
开发者ID:sarmstrongLN,项目名称:C-Sharp-OXO,代码行数:5,代码来源:PlayerTests.cs


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