2020-08-16 17:35:27 +02:00
|
|
|
|
using System.Linq;
|
2020-07-30 22:27:14 +02:00
|
|
|
|
using OWML.Common;
|
2020-02-14 22:14:24 +01:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
2020-07-30 22:27:14 +02:00
|
|
|
|
namespace QSB.Utility
|
2020-02-15 20:48:02 +01:00
|
|
|
|
{
|
|
|
|
|
public class DebugLog : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
private static string JoinAll(params object[] logObjects)
|
|
|
|
|
{
|
2020-02-15 20:59:18 +01:00
|
|
|
|
return string.Join(" ", logObjects.Select(o => o.ToString()).ToArray());
|
2020-02-14 22:14:24 +01:00
|
|
|
|
}
|
|
|
|
|
|
2020-07-28 00:13:43 +01:00
|
|
|
|
public static void ToConsole(string message)
|
2020-02-15 20:48:02 +01:00
|
|
|
|
{
|
2020-07-28 00:13:43 +01:00
|
|
|
|
QSB.Helper.Console.WriteLine(message, MessageType.Message);
|
2020-02-14 22:14:24 +01:00
|
|
|
|
}
|
|
|
|
|
|
2020-07-28 00:13:43 +01:00
|
|
|
|
public static void ToConsole(string message, MessageType type)
|
|
|
|
|
{
|
|
|
|
|
QSB.Helper.Console.WriteLine(message, type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void ToHud(params object[] logObjects)
|
2020-02-15 20:48:02 +01:00
|
|
|
|
{
|
|
|
|
|
if (Locator.GetPlayerBody() == null)
|
|
|
|
|
{
|
2020-02-14 22:14:24 +01:00
|
|
|
|
return;
|
|
|
|
|
}
|
2020-07-28 15:59:24 +02:00
|
|
|
|
var data = new NotificationData(NotificationTarget.Player, JoinAll(logObjects));
|
|
|
|
|
NotificationManager.SharedInstance.PostNotification(data);
|
2020-02-14 22:14:24 +01:00
|
|
|
|
}
|
2020-02-15 20:48:02 +01:00
|
|
|
|
|
2020-08-10 18:17:54 +02:00
|
|
|
|
public static void ToAll(MessageType type, params object[] logObjects)
|
2020-03-04 21:46:16 +01:00
|
|
|
|
{
|
2020-08-10 18:17:54 +02:00
|
|
|
|
ToConsole(JoinAll(logObjects), type);
|
2020-07-28 00:13:43 +01:00
|
|
|
|
ToHud(logObjects);
|
2020-03-04 21:46:16 +01:00
|
|
|
|
}
|
2020-08-10 18:17:54 +02:00
|
|
|
|
|
|
|
|
|
public static void ToAll(params object[] logObjects)
|
|
|
|
|
{
|
|
|
|
|
ToAll(MessageType.Message, logObjects);
|
|
|
|
|
}
|
2020-02-14 22:14:24 +01:00
|
|
|
|
}
|
|
|
|
|
}
|