Fix colours in CLI/GUI console, fix console saying whole message multiple times instead of part

This commit is contained in:
UnknownShadow200 2017-12-11 08:34:58 +11:00
parent 67f45e8c81
commit 46d4d1cc47
4 changed files with 8 additions and 6 deletions

View File

@ -131,10 +131,11 @@ namespace MCGalaxy.Cli {
message = UIHelpers.Format(message);
while (index < message.Length) {
char curCol = col;
string part = UIHelpers.OutputPart(ref col, ref index, message);
if (part.Length > 0) {
Console.ForegroundColor = GetConsoleCol(col);
Console.Write(message);
Console.ForegroundColor = GetConsoleCol(curCol);
Console.Write(part);
}
}
}

View File

@ -168,8 +168,9 @@ namespace MCGalaxy.Gui.Components {
message = UIHelpers.Format(message);
while (index < message.Length) {
char curCol = col;
string part = UIHelpers.OutputPart(ref col, ref index, message);
if (part.Length > 0) AppendColoredText(part, GetCol(col, foreColor));
if (part.Length > 0) AppendColoredText(part, GetCol(curCol, foreColor));
}
}

View File

@ -134,7 +134,7 @@ namespace MCGalaxy.Commands.World {
public override void Help(Player p) {
Player.Message(p, "%T/Map [level] [option] <value> %H- Sets [option] on [level]");
Player.Message(p, "%HPossible options: %S{0}", LevelOptions.Options.Keys.Join());
Player.Message(p, "%HUse %T/Help map [option] %Hto see a description for that option.");
Player.Message(p, "%HUse %T/Help map [option] %Hto see description for that option.");
}
public override void Help(Player p, string message) {

View File

@ -96,7 +96,7 @@ namespace MCGalaxy.UI {
return message;
}
public static string OutputPart(ref char col, ref int start, string message) {
public static string OutputPart(ref char nextCol, ref int start, string message) {
int next = NextPart(start, message);
string part;
if (next == -1) {
@ -105,7 +105,7 @@ namespace MCGalaxy.UI {
} else {
part = message.Substring(start, next - start);
start = next + 2;
col = message[next + 1];
nextCol = message[next + 1];
}
return part;
}