29 lines
753 B
C#
29 lines
753 B
C#
using System;
|
|
using greg.Sdk;
|
|
using MelonLoader;
|
|
|
|
namespace greg.Plugin.HookTemplate;
|
|
|
|
internal static class HookTemplateGameApiBridge
|
|
{
|
|
public static void Emit(string gregHook, string patchTarget, object instance, object result, object[] args)
|
|
{
|
|
try
|
|
{
|
|
var payload = new
|
|
{
|
|
patchTarget,
|
|
instanceType = instance?.GetType().FullName,
|
|
result,
|
|
argCount = args?.Length ?? 0,
|
|
args,
|
|
};
|
|
|
|
gregEventDispatcher.Emit(gregHook, payload);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MelonLogger.Warning($"[HookTemplate] Emit failed for '{gregHook}' ({patchTarget}): {ex.Message}");
|
|
}
|
|
}
|
|
} |