Skip to content
Permalink
Browse files

MessageBus - add Output extension method

  • Loading branch information...
bobbymcr committed Dec 15, 2018
1 parent 2910aa8 commit 704c8e2f5660b6f48a5f2e707958c86423b9f3a6
Showing with 20 additions and 6 deletions.
  1. +1 −1 core/src/Inventory.cs
  2. +1 −1 core/src/Item.cs
  3. +1 −1 core/src/Items.cs
  4. +14 −0 core/src/Messages/MessageBusExtensions.cs
  5. +2 −2 core/src/Room.cs
  6. +1 −1 core/src/RoomMap.cs
@@ -83,7 +83,7 @@ private bool Look(Word noun)

private void Output(string text)
{
this.bus.Send(new OutputMessage(text));
this.bus.Output(text);
}
}
}
@@ -31,6 +31,6 @@ protected Item(MessageBus bus)

protected virtual bool DropCore() => true;

protected void Output(string text) => this.Bus.Send(new OutputMessage(text));
protected void Output(string text) => this.Bus.Output(text);
}
}
@@ -84,7 +84,7 @@ public Item Take(string name)

private void Output(string text)
{
this.bus.Send(new OutputMessage(text));
this.bus.Output(text);
}

private bool Do(SentenceMessage sentence)
@@ -0,0 +1,14 @@
// <copyright file="MessageBusExtensions.cs" company="Brian Rogers">
// Copyright (c) Brian Rogers. All rights reserved.
// </copyright>

namespace Adventure.Messages
{
public static class MessageBusExtensions
{
public static void Output(this MessageBus bus, string text)
{
bus.Send(new OutputMessage(text));
}
}
}
@@ -73,9 +73,9 @@ protected void Register(string verb, Action<Word, Word> handler)
this.verbs.Add(verb, handler);
}

protected void Output(string message)
protected void Output(string text)
{
this.bus.Send(new OutputMessage(message));
this.bus.Output(text);
}

protected void Inventory()
@@ -115,7 +115,7 @@ Point IPointPrivate.Go(string direction)
{
if (!this.targets.TryGetValue(direction, out Point target))
{
this.bus.Send(new OutputMessage($"You can't go {direction}."));
this.bus.Output($"You can't go {direction}.");
target = this;
}

0 comments on commit 704c8e2

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