/// <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++; } }
private static void AddScore(int Value, ScoreTextToken TextToken, double Duration, bool Count) { 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 World.Vector2D(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++; } }
private static void AddScore(int Value, ScoreTextToken TextToken, double Duration) { AddScore(Value, TextToken, Duration, true); }