Move classes into Program class.
This commit is contained in:
parent
497f5887bd
commit
eac331b4ee
|
@ -3,6 +3,8 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace IngameScript
|
namespace IngameScript
|
||||||
|
{
|
||||||
|
partial class Program
|
||||||
{
|
{
|
||||||
public class ConfigParser
|
public class ConfigParser
|
||||||
{
|
{
|
||||||
|
@ -42,3 +44,4 @@ namespace IngameScript
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -8,7 +8,15 @@ using System.Text;
|
||||||
|
|
||||||
namespace IngameScript
|
namespace IngameScript
|
||||||
{
|
{
|
||||||
public class Console
|
partial class Program
|
||||||
|
{
|
||||||
|
public interface IConsole
|
||||||
|
{
|
||||||
|
void Print(string text);
|
||||||
|
void PrintLower(string text);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Console : IConsole
|
||||||
{
|
{
|
||||||
private MyGridProgram _program;
|
private MyGridProgram _program;
|
||||||
private int _maxLines;
|
private int _maxLines;
|
||||||
|
@ -58,12 +66,12 @@ namespace IngameScript
|
||||||
|
|
||||||
// This class is necessary because we need to keep a *single* buffer
|
// This class is necessary because we need to keep a *single* buffer
|
||||||
// to write to. So we can ask the primary Console for a prefixer.
|
// to write to. So we can ask the primary Console for a prefixer.
|
||||||
public class PrefixedConsole
|
public class PrefixedConsole : IConsole
|
||||||
{
|
{
|
||||||
private Console _console;
|
private IConsole _console;
|
||||||
private string _prefix;
|
private string _prefix;
|
||||||
|
|
||||||
public PrefixedConsole(Console console, string prefix)
|
public PrefixedConsole(IConsole console, string prefix)
|
||||||
{
|
{
|
||||||
_console = console;
|
_console = console;
|
||||||
_prefix = prefix + ": ";
|
_prefix = prefix + ": ";
|
||||||
|
@ -73,5 +81,9 @@ namespace IngameScript
|
||||||
{
|
{
|
||||||
_console.Print(_prefix + text);
|
_console.Print(_prefix + text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sub-consoles can't print to the ephemeral display
|
||||||
|
public void PrintLower(string text) { }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user