Exemplo n.º 1
0
 // Start is called before the first frame update
 void Start()
 {
     HighScore.SetText(string.Concat("Highscore: ", GameManager.highscore));
     QuestionsAnswered.SetText(string.Concat("Most Questions Answered: ", GameManager.mostQuestions));
     if (GameManager.timesPlayed != 0)
     {
         AverageScore.SetText(string.Concat("Average Score: ", (GameManager.totalscore / GameManager.timesPlayed)));
     }
     else
     {
         AverageScore.SetText("Average Score: 0");
     }
     if (GameManager.bestPhoneme != "")
     {
         BestPhoneme.SetText(string.Concat("Best Phoneme: ", GameManager.bestPhoneme));
     }
     else
     {
         BestPhoneme.SetText("Best Phoneme: N/A");
     }
     if (GameManager.worstPhoneme != "")
     {
         WorstPhoneme.SetText(string.Concat("Worst Phoneme: ", GameManager.worstPhoneme));
     }
     else
     {
         WorstPhoneme.SetText("Worst Phoneme: N/A");
     }
 }
Exemplo n.º 2
0
 private void Start()
 {
     if (AverageTime != null)
     {
         AverageTime.Invoke();
     }
     if (PlayedGames != null)
     {
         PlayedGames.Invoke();
     }
     if (AverageScore != null)
     {
         AverageScore.Invoke();
     }
 }
Exemplo n.º 3
0
        public AverageScore ScoreReport(Members members)
        {
            var averageScore = new AverageScore();

            var allMemberScores = _playerScoreRepository.FindBy(x =>
                                                                x.MemberID == members.ID).ToList();

            if (allMemberScores.Count > 0)
            {
                //Week Score
                var weekScore = allMemberScores.Where(x =>
                                                      GetWeekOfYear(x.DatePlayed) == GetWeekOfYear(DateTime.Now));


                var actualWeekScore = 0.0;
                if (weekScore.Count() > 0)
                {
                    actualWeekScore = weekScore.Select(x => x.Score).Sum() / weekScore.Count();
                }

                //Month Score
                var monthScore = allMemberScores.Where(x =>
                                                       x.DatePlayed.Month == DateTime.Now.Month);

                var actualMonthScore = 0.0;
                if (monthScore.Count() > 0)
                {
                    actualMonthScore = monthScore.Select(x => x.Score).Sum() / monthScore.Count();
                }

                //Year Score
                var yearScore = allMemberScores.Where(x =>
                                                      x.DatePlayed.Year == DateTime.Now.Year);

                var actualYearScore = 0.0;
                if (yearScore.Count() > 0)
                {
                    actualYearScore = yearScore.Select(x => x.Score).Sum() / yearScore.Count();
                }

                averageScore.ScoreMonth = actualMonthScore;
                averageScore.ScoreWeek  = actualWeekScore;
                averageScore.ScoreYear  = actualYearScore;
            }

            return(averageScore);
        }
 public string GetCountryInCsv()
 {
     return($"{CountryName};{AverageScore.ToString()};{MedianScore.ToString()};{MaxScore.ToString()};{MaxScorePerson};{MinScore.ToString()};{MinScorePerson};{RecordCount.ToString()}");
 }
 /// <summary>
 /// Filter by the media's average score
 /// </summary>
 public GraphQueryArgument <int> AverageScoreArgument(int value)
 {
     return(AverageScore.GetQueryArgumentAndSetValue(value));
 }
Exemplo n.º 6
0
 public override string ToString()
 {
     return($"{Name} - Avg: {AverageScore.ToString("F3")}, Max: {MaxScore.ToString("F3")}");
 }
Exemplo n.º 7
0
        public bool GetAverageScore(string _studentID, int _grade, List <AverageScore> averageScores)
        {
            bool success = Connect();

            if (!success)
            {
                return(false);
            }

            try
            {
                AverageScore score;
                using (SqlCommand command = connection.CreateCommand())
                {
                    command.CommandType = System.Data.CommandType.Text;
                    command.CommandText = "SELECT SCOREBOARD.SemesterAverage FROM LEARNRESULT JOIN SCOREBOARD ON LEARNRESULT.ScoreBoardSE01ID = SCOREBOARD.ScoreBoardID " +
                                          "WHERE LEARNRESULT.StudentID = @studentid AND Grade = @grade";
                    command.Parameters.AddWithValue("@studentid", _studentID);
                    command.Parameters.AddWithValue("@grade", _grade);
                    score = new AverageScore(AverageScore.ScoreType.HK1);
                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        reader.Read();
                        if (!reader.IsDBNull(0))
                        {
                            score.Value = reader.GetDouble(0);
                        }
                    }
                    averageScores.Add(score);
                }
                using (SqlCommand command = connection.CreateCommand())
                {
                    command.CommandType = System.Data.CommandType.Text;
                    command.CommandText = "SELECT SCOREBOARD.SemesterAverage FROM LEARNRESULT JOIN SCOREBOARD ON LEARNRESULT.ScoreBoardSE02ID = SCOREBOARD.ScoreBoardID " +
                                          "WHERE LEARNRESULT.StudentID = @studentid AND Grade = @grade";
                    command.Parameters.AddWithValue("@studentid", _studentID);
                    command.Parameters.AddWithValue("@grade", _grade);
                    score = new AverageScore(AverageScore.ScoreType.HK2);
                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        reader.Read();
                        if (!reader.IsDBNull(0))
                        {
                            score.Value = reader.GetDouble(0);
                        }
                    }
                    averageScores.Add(score);
                }
                using (SqlCommand command = connection.CreateCommand())
                {
                    command.CommandType = System.Data.CommandType.Text;
                    command.CommandText = "SELECT AverageScore FROM LEARNRESULT WHERE StudentID = @studentid AND Grade = @grade";
                    command.Parameters.AddWithValue("@studentid", _studentID);
                    command.Parameters.AddWithValue("@grade", _grade);
                    score = new AverageScore(AverageScore.ScoreType.CaNam);
                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        reader.Read();
                        if (!reader.IsDBNull(0))
                        {
                            score.Value = reader.GetDouble(0);
                        }
                    }
                    averageScores.Add(score);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return(false);
            }
            finally
            {
                Disconnect();
            }
            return(true);
        }
 public void TestInitialize()
 {
     score = new AverageScore();
 }