public void SongFinished() { decimal score = songProgress.GetResultingScore(); songProgress.Reset(); // Popup scorePopup.SetText(score); scorePopup.Show(); // Build Score object Score sc = new Score(); sc.Percentage = score; sc.UserID = WindowLoginController.LoggedInUser.UserID; sc.Date = DateTime.Now; // Toevoegen aan db using (DatabaseContext db = new DatabaseContext()) { sc.SongID = songPlayer.CurrentSong.SongID; db.Scores.Add(sc); Console.WriteLine("Added Score"); db.SaveChanges(); } windowLeerling.tempoToolStripMenuItem.Enabled = true; }
private void ShowScorePopup() { ScorePopup popup = scorePopup.GetComponent <ScorePopup> (); //set the score float score = (float)itemCounter.count / 6f; //(float)itemCountTotal;; int stars = (int)(score * 5f); string title = FeedbackCopies.GetTitle(stars); string message = FeedbackCopies.GetFeedback("SHOWER", stars); popup.SetStars(stars); popup.SetTitle(title); popup.SetMessage(message); popup.Show(); }
private void ShowScorePopup() { ScorePopup popup = scorePopup.GetComponent <ScorePopup> (); //set the score float timeWeight = 0.2f; float collectionWeight = 0.8f; float timePerformance = Mathf.Min(1f, (float)countDown.GetCount() / 20f); //(float)countDown.startCount; float collectionPerformance = (float)itemCounter.count / (float)itemCountGoal; float score = timePerformance * timeWeight + collectionPerformance * collectionWeight; int stars = (int)(score * 5f); string title = FeedbackCopies.GetTitle(stars); string message = FeedbackCopies.GetFeedback("LIGHT", stars); popup.SetStars(stars); popup.SetTitle(title); popup.SetMessage(message); popup.Show(); }