mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-11 16:17:43 -04:00
Fix colours in CLI/GUI console, fix console saying whole message multiple times instead of part
This commit is contained in:
parent
67f45e8c81
commit
46d4d1cc47
@ -131,10 +131,11 @@ namespace MCGalaxy.Cli {
|
|||||||
message = UIHelpers.Format(message);
|
message = UIHelpers.Format(message);
|
||||||
|
|
||||||
while (index < message.Length) {
|
while (index < message.Length) {
|
||||||
|
char curCol = col;
|
||||||
string part = UIHelpers.OutputPart(ref col, ref index, message);
|
string part = UIHelpers.OutputPart(ref col, ref index, message);
|
||||||
if (part.Length > 0) {
|
if (part.Length > 0) {
|
||||||
Console.ForegroundColor = GetConsoleCol(col);
|
Console.ForegroundColor = GetConsoleCol(curCol);
|
||||||
Console.Write(message);
|
Console.Write(part);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -168,8 +168,9 @@ namespace MCGalaxy.Gui.Components {
|
|||||||
message = UIHelpers.Format(message);
|
message = UIHelpers.Format(message);
|
||||||
|
|
||||||
while (index < message.Length) {
|
while (index < message.Length) {
|
||||||
|
char curCol = col;
|
||||||
string part = UIHelpers.OutputPart(ref col, ref index, message);
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ namespace MCGalaxy.Commands.World {
|
|||||||
public override void Help(Player p) {
|
public override void Help(Player p) {
|
||||||
Player.Message(p, "%T/Map [level] [option] <value> %H- Sets [option] on [level]");
|
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, "%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) {
|
public override void Help(Player p, string message) {
|
||||||
|
@ -96,7 +96,7 @@ namespace MCGalaxy.UI {
|
|||||||
return message;
|
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);
|
int next = NextPart(start, message);
|
||||||
string part;
|
string part;
|
||||||
if (next == -1) {
|
if (next == -1) {
|
||||||
@ -105,7 +105,7 @@ namespace MCGalaxy.UI {
|
|||||||
} else {
|
} else {
|
||||||
part = message.Substring(start, next - start);
|
part = message.Substring(start, next - start);
|
||||||
start = next + 2;
|
start = next + 2;
|
||||||
col = message[next + 1];
|
nextCol = message[next + 1];
|
||||||
}
|
}
|
||||||
return part;
|
return part;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user