Beispiel #1
0
        /// <summary>
        /// Applies the status
        /// </summary>
        /// <remarks>Calls only from the main UI thread.</remarks>
        internal static void Apply()
        {
            lock (LockObj)
            {
                if (!RequiredApply)
                {
                    return;
                }

                if (EnableSimulation)
                {
                    TrainBase train;

                    if (IsExtensionsCfg)
                    {
                        train = Program.TrainManager.Trains[0];
                    }
                    else
                    {
                        train = CreateDummyTrain();
                        Array.Resize(ref Program.TrainManager.Trains, 1);
                        Program.TrainManager.Trains[0] = train;
                        TrainManagerBase.PlayerTrain   = train;
                    }

                    Status.Apply(train);
                }
                else
                {
                    // Initialize
                    if (IsExtensionsCfg)
                    {
                        NearestTrainStatus.Initialize(Program.TrainManager.Trains[0]);
                    }
                    else
                    {
                        Program.TrainManager.Trains  = new TrainBase[0];
                        TrainManagerBase.PlayerTrain = null;
                    }

                    EnablePluginSimulation            = false;
                    PluginManager.CurrentPlugin.Panel = new int[0];
                }

                RequiredApply = false;
            }
        }
Beispiel #2
0
 static NearestTrain()
 {
     LockObj = new object();
     Specs   = new NearestTrainSpecs();
     Status  = new NearestTrainStatus();
 }