本文整理汇总了C#中Entities.HasRequiredNumberOfPlayers方法的典型用法代码示例。如果您正苦于以下问题:C# Entities.HasRequiredNumberOfPlayers方法的具体用法?C# Entities.HasRequiredNumberOfPlayers怎么用?C# Entities.HasRequiredNumberOfPlayers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entities
的用法示例。
在下文中一共展示了Entities.HasRequiredNumberOfPlayers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
/// <summary>
/// Starts a round if certain requirements are met
/// </summary>
/// <param name="game">The game to start a new round for</param>
/// <param name="commander">The new round's commander</param>
/// <returns>If a round was successfully started</returns>
public Boolean Execute(Entities.Game game, Entities.User commander)
{
Boolean successful = false;
//Check to make sure game still has required number of players
if (game.HasRequiredNumberOfPlayers())
{
//Check to make sure the game has not been ended.
if (game.GameOver.HasValue == false && !game.HasWinner())
{
Entities.GameRound round = _insertGameRound.Execute(game.GameID, commander);
successful = round.GameRoundID > 0;
if (successful)
{
game.Rounds.Add(round);
game.RoundCount++;
//Deal Cards
_dealCards.Execute(game);
}
}
}
return successful;
}
示例2: Build
public static String Build(Entities.Game game, Int32 currentUserId, Entities.Enums.GamePlayerType playerType)
{
String waitingOnPlayers = "{0} is waiting for {1} more {2}...";
String commanderStartGame = "{0} can be started. {1}";
String waitingOnHost = "{0} waiting on commander to start game...";
String headerText = String.Empty;
if (game.HasRequiredNumberOfPlayers() == false)
{
Int32 shortNumberOfPlayers = game.NumberOfPlayersNeededToStart();
headerText = string.Format(waitingOnPlayers,
game.Title,
shortNumberOfPlayers.ToString(),
shortNumberOfPlayers == 1 ? "player" : "players");
}
else
{
if(game.IsCurrentCommander(currentUserId) && playerType == Entities.Enums.GamePlayerType.Player)
{
TagBuilder startGame = new TagBuilder("a");
startGame.AddCssClass("button");
startGame.AddCssClass("startGameButton");
startGame.InnerHtml = "Start";
startGame.Attributes.Add("style", "font-size: .8em; cursor: pointer;");
headerText = string.Format(commanderStartGame, game.Title, startGame.ToString());
}
else
{
headerText = string.Format(waitingOnHost, game.Title);
}
}
return headerText;
}