// show score log private void ShowScoreLog(bool PenaltiesOnly) { System.Globalization.CultureInfo Culture = System.Globalization.CultureInfo.InvariantCulture; listviewScore.Items.Clear(); int sum = 0; for (int i = 0; i < Game.ScoreLogCount; i++) { sum += Game.ScoreLogs[i].Value; if (!PenaltiesOnly | Game.ScoreLogs[i].Value < 0) { double x = Game.ScoreLogs[i].Time; int h = (int)Math.Floor(x / 3600.0); x -= 3600.0 * (double)h; int m = (int)Math.Floor(x / 60.0); x -= 60.0 * (double)m; int s = (int)Math.Floor(x); ListViewItem Item = listviewScore.Items.Add(h.ToString("00", Culture) + ":" + m.ToString("00", Culture) + ":" + s.ToString("00", Culture)); Item.SubItems.Add(Game.ScoreLogs[i].Position.ToString("0", Culture)); Item.SubItems.Add(Game.ScoreLogs[i].Value.ToString(Culture)); Item.SubItems.Add(sum.ToString(Culture)); Item.SubItems.Add(Interface.GetScoreText(Game.ScoreLogs[i].TextToken)); } } listviewScore.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); }
/// <summary>Is called by the update function to add a new score event to the log</summary> /// <param name="Value">The value of the score event</param> /// <param name="TextToken">The token type which caused the score event</param> /// <param name="Duration">The duration of the score event (e.g. overspeed)</param> /// <param name="Count">Whether this should be counted as a unique event (NOTE: Scheduled stops are the only case which are not)</param> private void AddScore(int Value, ScoreTextToken TextToken, double Duration, bool Count = true) { if (Interface.CurrentOptions.GameMode == Interface.GameMode.Arcade) { int n = ScoreMessages.Length; Array.Resize <ScoreMessage>(ref ScoreMessages, n + 1); ScoreMessages[n].Value = Value; ScoreMessages[n].Text = Interface.GetScoreText(TextToken) + ": " + Value.ToString(System.Globalization.CultureInfo.InvariantCulture); ScoreMessages[n].Timeout = SecondsSinceMidnight + Duration; ScoreMessages[n].RendererPosition = new Vector2(0.0, 0.0); ScoreMessages[n].RendererAlpha = 0.0; if (Value < 0.0) { ScoreMessages[n].Color = MessageColor.Red; } else if (Value > 0.0) { ScoreMessages[n].Color = MessageColor.Green; } else { ScoreMessages[n].Color = MessageColor.White; } } if (Value != 0 & Count) { if (ScoreLogCount == ScoreLogs.Length) { Array.Resize <ScoreLog>(ref ScoreLogs, ScoreLogs.Length << 1); } ScoreLogs[ScoreLogCount].Value = Value; ScoreLogs[ScoreLogCount].TextToken = TextToken; ScoreLogs[ScoreLogCount].Position = TrainManager.PlayerTrain.Cars[0].FrontAxle.Follower.TrackPosition; ScoreLogs[ScoreLogCount].Time = SecondsSinceMidnight; ScoreLogCount++; } }