예제 #1
0
파일: AGame.cs 프로젝트: TheIndra55/Sanara
        private async Task BestOfOutOfRound(bool didFindGuess)
        {
            List <string> bestName  = new List <string>();
            int           bestScore = 0;

            foreach (var name in _lobby.GetFullNames())
            {
                int currScore = _bestOfScore.ContainsKey(name) ? _bestOfScore[name] : 0;
                if (currScore == bestScore)
                {
                    bestName.Add(name);
                }
                else if (currScore > bestScore)
                {
                    bestName = new List <string>();
                    bestName.Add(name);
                    bestScore = currScore;
                }
            }
            string finalStr = "";

            if (didFindGuess)
            {
                finalStr += Sentences.GuessGood(_guild) + Environment.NewLine;
            }
            finalStr += Sentences.CurrentScore(_guild) + Environment.NewLine + GetBestOfScore() + Environment.NewLine + Environment.NewLine + Sentences.ReversiGameEnded(_guild) + Environment.NewLine;
            if (bestName.Count == _lobby.GetFullNames().Count)
            {
                await PostText(finalStr + Sentences.Draw(_guild));
            }
            else
            {
                await PostText(finalStr + Sentences.WonMulti(_guild, string.Join(", ", bestName)));
            }
            _gameState = GameState.Lost;
        }