- Moved video screen into its own separate movie tent. - Adjusted stable post-processing volume. - Chickens are now at full volume. - Added button to toggle chickens off and on.
62 lines
2.1 KiB
C#
62 lines
2.1 KiB
C#
using UdonSharp;
|
|
using UnityEngine;
|
|
|
|
namespace VRCBilliardsCE.Packages.com.vrcbilliards.vrcbce.Runtime.Scripts
|
|
{
|
|
/// <summary>
|
|
/// Originally credited to Phasedragon, this logger can be placed in world to be hooked into.
|
|
/// </summary>
|
|
[UdonBehaviourSyncMode(BehaviourSyncMode.None)]
|
|
public class Logger : UdonSharpBehaviour
|
|
{
|
|
public TMPro.TextMeshProUGUI text;
|
|
public int maxChars;
|
|
|
|
[Tooltip("Print Log calls to console. Enable to make logs easier to see.")]
|
|
public bool printLogsToConsole;
|
|
|
|
public void Start()
|
|
{
|
|
_Log("TestLogger", "Start");
|
|
}
|
|
|
|
public void _Log(string source, string log)
|
|
{
|
|
if (printLogsToConsole)
|
|
{
|
|
Debug.Log($"[{Time.timeSinceLevelLoad:N2}] [<color=green>{source}</color>] {log}");
|
|
}
|
|
|
|
text.text += $"\n[{Time.timeSinceLevelLoad:N2}] [<color=green>{source}</color>] {log}";
|
|
while (text.text.Length > maxChars && text.text.Contains("\n"))
|
|
{
|
|
text.text = text.text.Substring(text.text.IndexOf("\n") + 1);
|
|
}
|
|
}
|
|
|
|
public void _Warning(string source, string log)
|
|
{
|
|
Debug.LogWarning($"[{Time.timeSinceLevelLoad:N2}] [<color=red>{source}</color>] {log}");
|
|
text.text += $"\n[{Time.timeSinceLevelLoad:N2}] [<color=yellow>{source}</color>] {log}";
|
|
while (text.text.Length > maxChars && text.text.Contains("\n"))
|
|
{
|
|
text.text = text.text.Substring(text.text.IndexOf("\n") + 1);
|
|
}
|
|
}
|
|
|
|
public void _Error(string source, string log)
|
|
{
|
|
Debug.LogError($"[{Time.timeSinceLevelLoad:N2}] [<color=red>{source}</color>] {log}");
|
|
text.text += $"\n[{Time.timeSinceLevelLoad:N2}] [<color=red>{source}</color>] {log}";
|
|
while (text.text.Length > maxChars && text.text.Contains("\n"))
|
|
{
|
|
text.text = text.text.Substring(text.text.IndexOf("\n") + 1);
|
|
}
|
|
}
|
|
|
|
public void Clear()
|
|
{
|
|
text.text = string.Empty;
|
|
}
|
|
}
|
|
} |