public ZScreenForIFEngine(IIFRuntime runtime)
 {
     runtime = runtime;
 }
 public IAsyncOperation<ExecutionResult> Start(IIFRuntime runtime, bool debugMessages)
 {
     this.runtime = runtime;
     FastMem.main = this;
     return StartAsyncTask(debugMessages).AsAsyncOperation();
 }
 public IAsyncOperation<ExecutionResult> Start(IIFRuntime runtime)
 {
     return Start(runtime, false);
 }
        // Main Entry point
        async Task<ExecutionResult> Run(IIFRuntime runtime, bool debugMessages = false)
        {
            this.runtime = runtime;

            var datFileName = getDATFileName(runtime.FileIO);
            var intFileName = getINTFileName(runtime.FileIO);

            if (String.IsNullOrEmpty(datFileName) || String.IsNullOrEmpty(intFileName))
            {
                return await Task.FromResult(ExecutionResult.ERR_INVALID_STATE);
            }

            var result = ExecutionResult.ERR_NO_ERRORS;
            bool finished = false;
            string verb = new string(new char[255]);
            string noun = new string(new char[255]);

            result = await loaddatabaseAsync(datFileName, intFileName);
            player.moved = true;
            player.won = false;

            // Start the game!
            if (debugMessages)
            {
                printdatabase();
            }
            else
            {
                logDebug("Starting\n");
                start();

                while (!finished)
                {
                    if (player.moved)
                    {
                        displayroom(player.currentroom);
                    }
                    player.moved = false;

                    var inp = await getInputAsync();
                    verb = inp.Item1;
                    noun = inp.Item2;

                    finished = parse(verb, noun) == ExecutionResult.ERR_STATE_QUIT;

                    if (player.dead || player.won)
                    {
                        score();
                        finished = true;
                    }
                }
            }

            return await Task.FromResult(result);
        }
 public IAsyncOperation<ExecutionResult> Start(IIFRuntime runtime, bool debugMessages)
 {
     return Run(runtime, debugMessages).AsAsyncOperation();
 }
 public IAsyncOperation<ExecutionResult> Start(IIFRuntime runtime)
 {
     return Run(runtime).AsAsyncOperation();
 }