2024-09-05 02:31:07 +08:00
|
|
|
|
using DB;
|
|
|
|
|
using HarmonyLib;
|
|
|
|
|
using Manager;
|
|
|
|
|
using MelonLoader;
|
|
|
|
|
using Process;
|
|
|
|
|
|
|
|
|
|
namespace AquaMai.Helpers;
|
|
|
|
|
|
|
|
|
|
public class MessageHelper
|
|
|
|
|
{
|
|
|
|
|
private static IGenericManager _genericManager = null;
|
|
|
|
|
|
|
|
|
|
[HarmonyPostfix]
|
|
|
|
|
[HarmonyPatch(typeof(ProcessManager), "SetMessageManager")]
|
|
|
|
|
private static void OnSetMessageManager(IGenericManager genericManager)
|
|
|
|
|
{
|
|
|
|
|
_genericManager = genericManager;
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-06 11:39:54 +08:00
|
|
|
|
public static void ShowMessage(string message, WindowSizeID size = WindowSizeID.Middle, string title = null)
|
2024-09-05 02:31:07 +08:00
|
|
|
|
{
|
|
|
|
|
if (_genericManager is null)
|
|
|
|
|
{
|
|
|
|
|
MelonLogger.Error($"[MessageHelper] Unable to show message: `{message}` GenericManager is null");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_genericManager.Enqueue(0, WindowMessageID.CollectionAttentionEmptyFavorite, new WindowParam()
|
|
|
|
|
{
|
2024-11-06 11:39:54 +08:00
|
|
|
|
hideTitle = title is null,
|
|
|
|
|
replaceTitle = true,
|
|
|
|
|
title = title,
|
2024-09-05 02:31:07 +08:00
|
|
|
|
replaceText = true,
|
|
|
|
|
text = message,
|
|
|
|
|
changeSize = true,
|
2024-09-28 16:30:19 +08:00
|
|
|
|
sizeID = size,
|
2024-09-05 02:31:07 +08:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|