private static string GetColorName(DebugColors color) { switch (color) { case DebugColors.Black: return("black"); case DebugColors.Blue: return("blue"); case DebugColors.Cyan: return("cyan"); case DebugColors.Green: return("green"); case DebugColors.Gray: return("gray"); case DebugColors.Magenta: return("magenta"); case DebugColors.Red: return("red"); case DebugColors.Yellow: return("yellow"); case DebugColors.Teal: return("teal"); } return(null); }
public static void LogError(object message, DebugColors color, Object context = default) { #if FULL_LOG || (POST_BUILD_HASH && UNITY_EDITOR) string newMessage = FormatMessage(message, color); Debug.LogError(newMessage, context); #endif }
public static void LogWarning(object message, DebugColors color, Object context = default) { #if !FULL_LOG return; #endif string newMessage = FormatMessage(message, color); Debug.LogWarning(newMessage, context); }
private void LoadDefaults() { this.colors = new DebugColors(); colors.Default = DEFAULT_DEFAULT; colors.Warning = DEFAULT_WARNING; colors.Error = DEFAULT_ERROR; colors.Critical = DEFAULT_CRITICAL; colors.Attention = DEFAULT_ATTENTION; clearOnLoad = DEFAULT_CLEAR_LOG_FILE_ON_LOAD; }
private static string FormatMessage(object message, DebugColors color) { string colorName = GetColorName(color); var newLineSplit = message.ToString().Split('\n'); var newMessage = string.Empty; foreach (string str in newLineSplit) { newMessage += $"<color={colorName}>{str}</color>\n"; } return(newMessage); }
/// <summary> /// Sets all chunks to use debug colors. /// </summary> /// <param name="colors"></param> public void SetDebugColors(DebugColors colors) { switch (colors) { case DebugColors.Constrained: foreach (Chunk chunk in _activeChunks) { chunk.GetComponent <MeshRenderer>().material = WorldManager.Instance.TerrainDebugMaterial; chunk.SetDebugColors(colors); } break; } }
/// <summary> /// Sets the color of the text according to the parameter value. /// </summary> /// <param name="message">Message.</param> /// <param name="color">Color.</param> public static string StrColored(this string message, DebugColors color) { return(string.Format("<color={0}>{1}</color>", color.ToString(), message)); }