32 lines
1.2 KiB
C#
32 lines
1.2 KiB
C#
using Aki.Reflection.Utils;
|
|
using EFT.Communications;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using UnityEngine;
|
|
|
|
namespace SamSWAT.TimeWeatherChanger.Utils
|
|
{
|
|
static class Notifier
|
|
{
|
|
private static readonly MethodInfo notifierMessageMethod;
|
|
private static readonly MethodInfo notifierWarningMessageMethod;
|
|
|
|
static Notifier()
|
|
{
|
|
var notifierType = PatchConstants.EftTypes.Single(x => x.GetMethod("DisplayMessageNotification") != null);
|
|
notifierMessageMethod = notifierType.GetMethod("DisplayMessageNotification");
|
|
notifierWarningMessageMethod = notifierType.GetMethod("DisplayWarningNotification");
|
|
}
|
|
|
|
public static void DisplayMessageNotification(string message, ENotificationDurationType duration = ENotificationDurationType.Default, ENotificationIconType iconType = ENotificationIconType.Default, Color? textColor = null)
|
|
{
|
|
notifierMessageMethod.Invoke(null, new object[] { message, duration, iconType, textColor });
|
|
}
|
|
|
|
public static void DisplayWarningNotification(string message, ENotificationDurationType duration = ENotificationDurationType.Default)
|
|
{
|
|
notifierWarningMessageMethod.Invoke(null, new object[] { message, duration });
|
|
}
|
|
}
|
|
}
|