46 lines
1.2 KiB
C#
Raw Normal View History

using System.Linq;
using OWML.Common;
using UnityEngine;
namespace QSB.Utility
2020-02-15 20:48:02 +01:00
{
public class DebugLog : MonoBehaviour
{
private static string JoinAll(params object[] logObjects)
{
return string.Join(" ", logObjects.Select(o => o.ToString()).ToArray());
}
public static void ToConsole(string message)
2020-02-15 20:48:02 +01:00
{
QSB.Helper.Console.WriteLine(message, MessageType.Message);
}
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)
{
return;
}
2020-07-28 15:59:24 +02:00
var data = new NotificationData(NotificationTarget.Player, JoinAll(logObjects));
NotificationManager.SharedInstance.PostNotification(data);
}
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);
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);
}
}
}