Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 4
0
        // 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);
        }
Ejemplo n.º 5
0
 public IAsyncOperation<ExecutionResult> Start(IIFRuntime runtime, bool debugMessages)
 {
     return Run(runtime, debugMessages).AsAsyncOperation();
 }
Ejemplo n.º 6
0
 public IAsyncOperation<ExecutionResult> Start(IIFRuntime runtime)
 {
     return Run(runtime).AsAsyncOperation();
 }