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


C# Entities.HasRequiredNumberOfPlayers方法代码示例

本文整理汇总了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;
        }
开发者ID:kwmcrell,项目名称:ArmedCards,代码行数:34,代码来源:Start.cs

示例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;
        }
开发者ID:kwmcrell,项目名称:ArmedCards,代码行数:37,代码来源:WaitingHeader.cs


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