public SimpleRuntimeInterface(IIFTextControl ui)
 {
     _ui = ui;
 }
Ejemplo n.º 2
0
        public async Task LoadAndRunAsync(IIFTextControl consoleControl)
        {
            SetupEngines();
            if(await OpenFileAndCreateFileServiceAsync())
            {
                var engines = IOC.GetValidGameEngines();
                var engine = engines.FirstOrDefault(i => i.CanRun == CanRunResult.Yes);

                // We don't have a clear cut engine, but there is only one potential match
                if (engine == null && engines.Length == 1)
                {
                    engine = engines[0];
                }
                // We don't have a clear cut engine, and there are several potential matches
                else if (engine == null && engines.Length > 1)
                {
                    // TODO: launch engine chooser
                }

                // We have an engine, so run
                if (engine != null)
                {
                    var runtime = new SimpleRuntimeInterface(consoleControl);
                    await engine.GameEngine.Start(runtime).AsTask();
                }
            }
        }