Skip to content
Permalink
Browse files

Game - remove QuitHandler, use EndOfGame instead

  • Loading branch information...
bobbymcr committed Dec 22, 2018
1 parent dca9d00 commit 58a860fe42355f72a7554d3315024e0a6f41e62f
Showing with 4 additions and 89 deletions.
  1. +0 −42 core/src/QuitHandler.cs
  2. +1 −1 core/src/Room.cs
  3. +0 −44 core/test/QuitHandlerTest.cs
  4. +2 −2 sample/src/Game.cs
  5. +1 −0 sample/src/RoomBase.cs

This file was deleted.

@@ -59,7 +59,7 @@ public void Add(string name, Item item)
this.items.Add(name, item);
}

public void End(string text)
public void End(string text = null)
{
this.bus.Send(new EndOfGameMessage(text));
}

This file was deleted.

@@ -21,12 +21,12 @@ public void Run(TextReader reader, TextWriter writer)
{
using (new TextConsole(this.bus, reader, writer))
using (new SentenceParser(this.bus, this.words))
using (QuitHandler quit = new QuitHandler(this.bus, Verb.Quit))
using (EndOfGame endOfGame = new EndOfGame(this.bus))
using (InputLoop loop = new InputLoop(this.bus, ">"))
using (new Inventory(this.bus))
using (this.InitializeMap())
{
loop.Run(quit.Token);
loop.Run(endOfGame.Token);
}
}

@@ -18,6 +18,7 @@ protected override void EnterCore()
this.Register(Verb.Greet, (_, __) => this.Output("You say, \"Hello,\" to no one in particular. No one answers."));
this.Register(Verb.Look, (_, n) => this.Look(n));
this.Register(Verb.Inventory, (_, __) => this.Inventory());
this.Register(Verb.Quit, (_, __) => this.End());
this.Register(Verb.Take, this.Take);
}
}

0 comments on commit 58a860f

Please sign in to comment.
You can’t perform that action at this time.