コード例 #1
0
        public void AddArtSubmission(string url, string correctAnswerPrompt)
        {
            DrawGameRound dgr = new DrawGameRound();

            dgr.AllAnswers.Add(correctAnswerPrompt);
            dgr.Answer   = correctAnswerPrompt;
            dgr.ImageUrl = url;
            this.GameRounds.Add(dgr);
        }
コード例 #2
0
        public DrawGameRound FetchRandomGameRound()
        {
            int           index = rnd.Next(0, this.GameRounds.Count);
            DrawGameRound dgr   = this.GameRounds[index];

            this.GameRounds.RemoveAt(index);
            if (this.GameRounds.Count == 0)
            {
                this.LastRound = true;
                dgr.LastRound  = true;
            }

            this.CurrentRound.Add(dgr);
            return(dgr);
        }
コード例 #3
0
        public DrawGameRound FetchGameRoundResults()
        {
            int currentRoundIndex = this.CurrentRound.Count - 1;

            DrawGameRound dgr = this.CurrentRound[currentRoundIndex];

            Console.WriteLine($"The answer was = {dgr.Answer}");
            foreach (Tuple <DrawPlayer, string> tple in dgr.ListPlayerAnswerTuples)
            {
                Console.WriteLine($"{tple.Item1.Name}'s img url {tple.Item1.ImageUrl}");


                foreach (DrawPlayer dp in this.DrawPlayers)
                {
                    Console.WriteLine($"{tple.Item1.Name}'s score is {dp.Score}");
                    if (tple.Item1.Name == dp.Name)
                    {
                        Console.WriteLine($"UPDATING {tple.Item1.Name}'s SCORE TO {dp.Score}");
                        tple.Item1.Score = dp.Score;
                        break;
                    }
                }
            }

            foreach (DrawPlayer dp in dgr.Players)
            {
                foreach (DrawPlayer thisdp in this.DrawPlayers)
                {
                    if (thisdp.Name == dp.Name)
                    {
                        Console.WriteLine($"UPDATING {thisdp.Name}'s SCORE TO {thisdp.Score}");
                        dp.Score = thisdp.Score;
                        break;
                    }
                }
            }

            return(dgr);
        }