Permalink
Browse files

Use SentenceParser in Adventure.Sample

  • Loading branch information...
bobbymcr committed Nov 29, 2018
1 parent 6977bc7 commit 1c337095aa2e67a3e4f74499cf71e6b7a2c7dbad
Showing with 4 additions and 3 deletions.
  1. +4 −3 sample/src/Game.cs
@@ -19,15 +19,16 @@ public Game(TextReader reader, TextWriter writer)

public void Run()
{
using (this.bus.Subscribe<InputMessage>(m => this.ProcessInput(m.Line)))
using (new SentenceParser(this.bus))
using (this.bus.Subscribe<SentenceMessage>(m => this.ProcessVerb(m.Verb)))
{
this.console.Run();
}
}

private void ProcessInput(string line)
private void ProcessVerb(string verb)
{
if (line == "hello")
if (verb == "hello")
{
this.bus.Send(new OutputMessage("world"));
}

0 comments on commit 1c33709

Please sign in to comment.