Fix console forwarding with infoboxes

This commit is contained in:
Michael 2017-02-06 16:00:01 -05:00
parent 481623e074
commit aa9234c681
2 changed files with 5 additions and 1 deletions

View file

@ -67,9 +67,11 @@ namespace ShiftOS.Engine
public static bool ShowYesNo(Dictionary<string, object> args)
{
bool forwarding = TerminalBackend.IsForwardingConsoleWrites;
var fGuid = TerminalBackend.ForwardGUID;
Action<bool> callback = (result) =>
{
TerminalBackend.IsForwardingConsoleWrites = forwarding;
TerminalBackend.ForwardGUID = (forwarding == true) ? fGuid : null;
string resultFriendly = (result == true) ? "yes" : "no";
Console.WriteLine($"{SaveSystem.CurrentSave.Username} says {resultFriendly}.");
TerminalBackend.IsForwardingConsoleWrites = false;
@ -88,9 +90,11 @@ namespace ShiftOS.Engine
public static bool ShowText(Dictionary<string, object> args)
{
bool forwarding = TerminalBackend.IsForwardingConsoleWrites;
var fGuid = TerminalBackend.ForwardGUID;
Action<string> callback = (result) =>
{
TerminalBackend.IsForwardingConsoleWrites = forwarding;
TerminalBackend.ForwardGUID = (forwarding == true) ? fGuid : null;
Console.WriteLine($"{SaveSystem.CurrentSave.Username} says \"{result}\".");
TerminalBackend.IsForwardingConsoleWrites = false;
};

View file

@ -317,7 +317,7 @@ namespace ShiftOS.Engine
}
public static bool IsForwardingConsoleWrites { get; internal set; }
public static string ForwardGUID { get; private set; }
public static string ForwardGUID { get; internal set; }
}
}