本文整理汇总了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);
}
}
示例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]);
//.........这里部分代码省略.........
示例3: updatePlayerName
/*
* Param: Player
* Updates the UI Player Name for a given player.
*/
public void updatePlayerName(Player player)
{
labelPlayerNames[player.getPositionOnBoard()].Text = player.getName();
}
示例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();
});
}
示例5: setBigBlindPlayer
/*
* Param: Player
* Update the current big blind player
*/
public void setBigBlindPlayer(Player player)
{
this.Invoke((MethodInvoker)delegate
{
labelBigBlindPlayerName.Text = player.getName();
});
}
示例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;
}
}
示例7: notifyOtherPlayerTurnStarted
public void notifyOtherPlayerTurnStarted(Player p)
{
Console.WriteLine(p.getName() + "/'s Turn");
}
示例8: test_contructer
public void test_contructer()
{
Player thePlayer = new Player("Jim");
Assert.IsNotNull(thePlayer);
StringAssert.Contains(thePlayer.getName(), "Player");
}
示例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();
}
示例10: findPlayerIndex
public int findPlayerIndex(Player p)
{
int index = players.FindIndex (i => i.getName () == p.getName ());
return index;
}
示例11: testPlayerNameStoredWhenSet
public void testPlayerNameStoredWhenSet()
{
testSubject = new Player();
testSubject.setName("Tony Stark");
Assert.AreEqual("Tony Stark", testSubject.getName());
}
示例12: testPlayerNameDefaultsToPlayer
public void testPlayerNameDefaultsToPlayer()
{
testSubject = new Player();
Assert.AreEqual("Player", testSubject.getName());
}