LoadAsynchronously() static private method

static private LoadAsynchronously ( string RouteFile, Encoding RouteEncoding ) : void
RouteFile string
RouteEncoding System.Text.Encoding
return void
Beispiel #1
0
        protected override void OnLoad(EventArgs e)
        {
            Program.FileSystem.AppendToLogFile("Game window initialised successfully.");
            Renderer.DetermineMaxAFLevel();
            //Initialise the loader thread queues
            jobs  = new Queue <ThreadStart>(10);
            locks = new Queue <object>(10);
            LibRender.Renderer.Initialize();
            HUD.LoadHUD();
            LoadingScreen.InitLoading(Program.FileSystem.GetDataFolder("In-game"), typeof(Renderer).Assembly.GetName().Version.ToString());
            Renderer.UpdateViewport(ViewPortChangeMode.NoChange);
            LibRender.MotionBlur.Initialize(Interface.CurrentOptions.MotionBlur);
            Loading.LoadAsynchronously(MainLoop.currentResult.RouteFile, MainLoop.currentResult.RouteEncoding, MainLoop.currentResult.TrainFolder, MainLoop.currentResult.TrainEncoding);
            LoadingScreenLoop();
            //Add event handler hooks for keyboard and mouse buttons
            //Do this after the renderer has init and the loop has started to prevent timing issues
            KeyDown    += MainLoop.keyDownEvent;
            KeyUp      += MainLoop.keyUpEvent;
            MouseDown  += MainLoop.mouseDownEvent;
            MouseUp    += MainLoop.mouseUpEvent;
            MouseMove  += MainLoop.mouseMoveEvent;
            MouseWheel += MainLoop.mouseWheelEvent;

            for (int i = 0; i < InputDevicePlugin.AvailablePluginInfos.Count; i++)
            {
                if (InputDevicePlugin.AvailablePluginInfos[i].Status == InputDevicePlugin.PluginInfo.PluginStatus.Enable)
                {
                    int AddControlsLength           = InputDevicePlugin.AvailablePlugins[i].Controls.Length;
                    Interface.Control[] AddControls = new Interface.Control[AddControlsLength];
                    for (int j = 0; j < AddControlsLength; j++)
                    {
                        AddControls[j].Command = InputDevicePlugin.AvailablePlugins[i].Controls[j].Command;
                        AddControls[j].Method  = Interface.ControlMethod.InputDevicePlugin;
                        AddControls[j].Option  = InputDevicePlugin.AvailablePlugins[i].Controls[j].Option;
                    }
                    Interface.CurrentControls = Interface.CurrentControls.Concat(AddControls).ToArray();
                    foreach (var Train in TrainManager.Trains)
                    {
                        if (Train.State != TrainState.Bogus)
                        {
                            if (Train == TrainManager.PlayerTrain)
                            {
                                InputDevicePlugin.AvailablePlugins[i].SetMaxNotch(Train.Handles.Power.MaximumDriverNotch, Train.Handles.Brake.MaximumDriverNotch);
                            }
                        }
                    }
                    InputDevicePlugin.AvailablePlugins[i].KeyDown += MainLoop.InputDevicePluginKeyDown;
                    InputDevicePlugin.AvailablePlugins[i].KeyUp   += MainLoop.InputDevicePluginKeyUp;
                }
            }
        }
Beispiel #2
0
 // load
 internal static void Load(string RouteFile, Encoding RouteEncoding)
 {
     // members
     LoadingScreen.InitLoading(Program.FileSystem.GetDataFolder("In-game"), typeof(Renderer).Assembly.GetName().Version.ToString());
     RouteProgress              = 0.0;
     TrainProgress              = 0.0;
     TrainProgressCurrentSum    = 0.0;
     TrainProgressCurrentWeight = 1.0;
     Cancel               = false;
     Complete             = false;
     CurrentRouteFile     = RouteFile;
     CurrentRouteEncoding = RouteEncoding;
     // thread
     Loading.LoadAsynchronously(CurrentRouteFile, Encoding.UTF8);
     RouteViewer.LoadingScreenLoop();
 }
Beispiel #3
0
 // load
 internal static void Load(string RouteFile, Encoding RouteEncoding)
 {
     // members
     Renderer.InitLoading();
     RouteProgress              = 0.0;
     TrainProgress              = 0.0;
     TrainProgressCurrentSum    = 0.0;
     TrainProgressCurrentWeight = 1.0;
     Cancel               = false;
     Complete             = false;
     CurrentRouteFile     = RouteFile;
     CurrentRouteEncoding = RouteEncoding;
     // thread
     Loading.LoadAsynchronously(CurrentRouteFile, Encoding.UTF8);
     RouteViewer.LoadingScreenLoop();
 }
Beispiel #4
0
 // load
 internal static void Load(string RouteFile, Encoding RouteEncoding, Bitmap bitmap = null)
 {
     // reset
     Game.Reset();
     Program.Renderer.Loading.InitLoading(Program.FileSystem.GetDataFolder("In-game"), typeof(NewRenderer).Assembly.GetName().Version.ToString(), Interface.CurrentOptions.LoadingLogo, Interface.CurrentOptions.LoadingProgressBar);
     if (bitmap != null)
     {
         Program.Renderer.Loading.SetLoadingBkg(Program.Renderer.TextureManager.RegisterTexture(bitmap, new TextureParameters(null, null)));
     }
     // members
     Cancel               = false;
     Complete             = false;
     CurrentRouteFile     = RouteFile;
     CurrentRouteEncoding = RouteEncoding;
     // thread
     Loading.LoadAsynchronously(CurrentRouteFile, CurrentRouteEncoding);
     RouteViewer.LoadingScreenLoop();
 }
Beispiel #5
0
 protected override void OnLoad(EventArgs e)
 {
     Renderer.DetermineMaxAFLevel();
     //Initialise the loader thread queues
     jobs  = new Queue <ThreadStart>(10);
     locks = new Queue <object>(10);
     Renderer.Initialize();
     MainLoop.UpdateViewport(MainLoop.ViewPortChangeMode.NoChange);
     Renderer.InitializeMotionBlur();
     Loading.LoadAsynchronously(MainLoop.currentResult.RouteFile, MainLoop.currentResult.RouteEncoding, MainLoop.currentResult.TrainFolder, MainLoop.currentResult.TrainEncoding);
     LoadingScreenLoop();
     //Add event handler hooks for keyboard and mouse buttons
     //Do this after the renderer has init and the loop has started to prevent timing issues
     KeyDown    += MainLoop.keyDownEvent;
     KeyUp      += MainLoop.keyUpEvent;
     MouseDown  += MainLoop.mouseDownEvent;
     MouseMove  += MainLoop.mouseMoveEvent;
     MouseWheel += MainLoop.mouseWheelEvent;
 }