Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 34 additions & 30 deletions Rocket.Unturned/Chat/UnturnedChat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,12 @@ public static void Say(string message, Color color, bool rich)
ChatManager.serverSendMessage(m, color, fromPlayer: null, toPlayer: null, mode: EChatMode.GLOBAL, iconURL: null, useRichTextFormatting: rich);
}
}

public static void Say(string message, Color color)
{
Say(message, color, false);
}

public static void Say(IRocketPlayer player, string message, bool rich)
{
Say(player, message, Palette.SERVER, rich);
Expand Down Expand Up @@ -166,39 +166,43 @@ public static void Say(CSteamID CSteamID, string message, Color color, bool rich
}
}
}

public static void Say(CSteamID CSteamID, string message, Color color)
{
Say(CSteamID, message, color, false);
}

public static List<string> wrapMessage(string text)
{
if (text.Length == 0) return new List<string>();
string[] words = text.Split(' ');
List<string> lines = new List<string>();
string currentLine = "";
int maxLength = 90;
foreach (var currentWord in words)
{

if ((currentLine.Length > maxLength) ||
((currentLine.Length + currentWord.Length) > maxLength))
{
lines.Add(currentLine);
currentLine = "";
}

if (currentLine.Length > 0)
currentLine += " " + currentWord;
else
currentLine += currentWord;

}

if (currentLine.Length > 0)
lines.Add(currentLine);
return lines;
public static List<string> wrapMessage(string text)
{
if (text.Length == 0)
return new List<string>();

string[] words = text.Split(' ');
List<string> lines = new List<string>();
string currentLine = "";
int maxLength = ChatManager.MAX_MESSAGE_LENGTH;

foreach (var currentWord in words)
{

if ((currentLine.Length > maxLength) ||
((currentLine.Length + currentWord.Length) > maxLength))
{
lines.Add(currentLine);
currentLine = "";
}

if (currentLine.Length > 0)
currentLine += " " + currentWord;
else
currentLine += currentWord;

}

if (currentLine.Length > 0)
lines.Add(currentLine);

return lines;
}
}
}