Fix in managers
This commit is contained in:
parent
7574de93ab
commit
bcebb8599c
3 changed files with 11 additions and 6 deletions
|
@ -22,7 +22,7 @@ namespace OpenbveFcmbTrainPlugin
|
||||||
/// <summary>Shows a message to the player.</summary>
|
/// <summary>Shows a message to the player.</summary>
|
||||||
/// <param name="message">The message to be shown.</param>
|
/// <param name="message">The message to be shown.</param>
|
||||||
/// <param name="color">The color of the message.</param>
|
/// <param name="color">The color of the message.</param>
|
||||||
/// <param name="time">The time to show the message.</param>
|
/// <param name="time">The time to show the message, in seconds.</param>
|
||||||
internal static void ShowMessage(string message, OpenBveApi.Colors.MessageColor color, double time)
|
internal static void ShowMessage(string message, OpenBveApi.Colors.MessageColor color, double time)
|
||||||
{
|
{
|
||||||
MessageDelegate(message, color, time);
|
MessageDelegate(message, color, time);
|
||||||
|
@ -31,7 +31,7 @@ namespace OpenbveFcmbTrainPlugin
|
||||||
/// <summary>Shows a message to the player.</summary>
|
/// <summary>Shows a message to the player.</summary>
|
||||||
/// <param name="message">The message to be shown.</param>
|
/// <param name="message">The message to be shown.</param>
|
||||||
/// <param name="color">The color of the message.</param>
|
/// <param name="color">The color of the message.</param>
|
||||||
/// <param name="time">The time to show the message.</param>
|
/// <param name="time">The time to show the message, in seconds.</param>
|
||||||
/// <param name="score">The score for the player.</param>
|
/// <param name="score">The score for the player.</param>
|
||||||
internal static void ShowMessage( string message, OpenBveApi.Colors.MessageColor color, double time, int score)
|
internal static void ShowMessage( string message, OpenBveApi.Colors.MessageColor color, double time, int score)
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace OpenbveFcmbTrainPlugin
|
||||||
// Validate index before doing anything
|
// Validate index before doing anything
|
||||||
if (soundIndex < Sounds.Length && soundIndex >= 0)
|
if (soundIndex < Sounds.Length && soundIndex >= 0)
|
||||||
{
|
{
|
||||||
if (Sounds[soundIndex].Playing)
|
if (Playing(soundIndex))
|
||||||
{
|
{
|
||||||
// The sound is still playing, update volume and pitch
|
// The sound is still playing, update volume and pitch
|
||||||
Sounds[soundIndex].Volume = volume;
|
Sounds[soundIndex].Volume = volume;
|
||||||
|
@ -64,7 +64,7 @@ namespace OpenbveFcmbTrainPlugin
|
||||||
// Validate index before doing anything
|
// Validate index before doing anything
|
||||||
if (soundIndex < Sounds.Length && soundIndex >= 0)
|
if (soundIndex < Sounds.Length && soundIndex >= 0)
|
||||||
{
|
{
|
||||||
if (Sounds[soundIndex].Playing)
|
if (Playing(soundIndex))
|
||||||
{
|
{
|
||||||
// The sound is still playing, update volume and pitch
|
// The sound is still playing, update volume and pitch
|
||||||
Sounds[soundIndex].Volume = volume;
|
Sounds[soundIndex].Volume = volume;
|
||||||
|
@ -82,8 +82,7 @@ namespace OpenbveFcmbTrainPlugin
|
||||||
/// <param name="soundIndex">The index of the sound to be stopped.</param>
|
/// <param name="soundIndex">The index of the sound to be stopped.</param>
|
||||||
internal static void Stop(int soundIndex)
|
internal static void Stop(int soundIndex)
|
||||||
{
|
{
|
||||||
// Validate index before doing anything
|
if (Playing(soundIndex))
|
||||||
if (soundIndex < Sounds.Length && soundIndex >= 0 && Sounds[soundIndex] != null)
|
|
||||||
{
|
{
|
||||||
// Stop sound
|
// Stop sound
|
||||||
Sounds[soundIndex].Stop();
|
Sounds[soundIndex].Stop();
|
||||||
|
|
|
@ -28,6 +28,9 @@ namespace OpenbveFcmbTrainPlugin
|
||||||
/// <summary>The next station in the route.</summary>
|
/// <summary>The next station in the route.</summary>
|
||||||
internal Station NextStation;
|
internal Station NextStation;
|
||||||
|
|
||||||
|
/// <summary>The current time in the route.</summary>
|
||||||
|
internal Time CurrentTime { get; private set; } = new Time(0);
|
||||||
|
|
||||||
/// <summary>The current state of the train doors.</summary>
|
/// <summary>The current state of the train doors.</summary>
|
||||||
private DoorStates DoorState;
|
private DoorStates DoorState;
|
||||||
|
|
||||||
|
@ -38,6 +41,9 @@ namespace OpenbveFcmbTrainPlugin
|
||||||
/// <param name="data">The data passed to the plugin.</param>
|
/// <param name="data">The data passed to the plugin.</param>
|
||||||
internal void Elapse(ElapseData data)
|
internal void Elapse(ElapseData data)
|
||||||
{
|
{
|
||||||
|
// Update current time
|
||||||
|
CurrentTime = data.TotalTime;
|
||||||
|
|
||||||
if (OpenbveFcmbTrainPlugin.Initializing)
|
if (OpenbveFcmbTrainPlugin.Initializing)
|
||||||
{
|
{
|
||||||
// Get the list of stations and set the current station
|
// Get the list of stations and set the current station
|
||||||
|
|
Loading…
Add table
Reference in a new issue