Unstable 1.8.4.0
This commit is contained in:
@@ -19,7 +19,8 @@ namespace Barotrauma.Networking
|
||||
Order = 8,
|
||||
ServerLog = 9,
|
||||
ServerMessageBox = 10,
|
||||
ServerMessageBoxInGame = 11
|
||||
ServerMessageBoxInGame = 11,
|
||||
Team = 12,
|
||||
}
|
||||
|
||||
public enum PlayerConnectionChangeType { None = 0, Joined = 1, Kicked = 2, Disconnected = 3, Banned = 4 }
|
||||
@@ -50,7 +51,12 @@ namespace Barotrauma.Networking
|
||||
new Color(64, 240, 89), //private
|
||||
new Color(255, 255, 255), //console
|
||||
new Color(255, 255, 255), //messagebox
|
||||
new Color(255, 128, 0) //order
|
||||
new Color(255, 128, 0), //order
|
||||
new Color(), // ServerLog
|
||||
new Color(), // ServerMessageBox
|
||||
new Color(), // ServerMessageBoxInGame
|
||||
//new Color(128, 0, 255), // team
|
||||
new Color(86, 91, 205), // team
|
||||
};
|
||||
|
||||
public readonly string Text;
|
||||
@@ -224,15 +230,17 @@ namespace Barotrauma.Networking
|
||||
|
||||
public static string ApplyDistanceEffect(string text, float garbleAmount)
|
||||
{
|
||||
if (garbleAmount < 0.3f) return text;
|
||||
if (garbleAmount >= 1.0f) return "";
|
||||
if (garbleAmount < 0.3f) { return text; }
|
||||
if (garbleAmount >= 1.0f) { return ""; }
|
||||
|
||||
int startIndex = Math.Max(text.IndexOf(':') + 1, 1);
|
||||
string textWithoutColorTags = RichString.Rich(text).SanitizedValue;
|
||||
|
||||
int startIndex = Math.Max(textWithoutColorTags.IndexOf(':') + 1, 1);
|
||||
|
||||
StringBuilder sb = new StringBuilder(text.Length);
|
||||
for (int i = 0; i < text.Length; i++)
|
||||
for (int i = 0; i < textWithoutColorTags.Length; i++)
|
||||
{
|
||||
sb.Append((i > startIndex && Rand.Range(0.0f, 1.0f) < garbleAmount) ? '-' : text[i]);
|
||||
sb.Append((i > startIndex && Rand.Range(0.0f, 1.0f) < garbleAmount) ? '-' : textWithoutColorTags[i]);
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
|
||||
Reference in New Issue
Block a user