Table of Contents

Class ResoniteCancelableEventHandlerMonkey<TMonkey, TEvent>

Namespace
MonkeyLoader.Resonite
Assembly
MonkeyLoader.Resonite.Integration.dll

Represents the base class for patchers that run after Resonite's assemblies have been loaded and that hook into the game's lifecycle.
Specifically, to act as an event handler for cancelable TEvents.

public abstract class ResoniteCancelableEventHandlerMonkey<TMonkey, TEvent> : ResoniteMonkey<TMonkey>, IResoniteMonkey, IMonkey, IRun, IShutdown, IComparable<IMonkey>, INestedIdentifiable<Mod>, INestedIdentifiable, IIdentifiable, ICancelableEventHandler<TEvent>, IPrioritizable where TMonkey : ResoniteCancelableEventHandlerMonkey<TMonkey, TEvent>, new() where TEvent : CancelableSyncEvent

Type Parameters

TMonkey

The type of the actual patcher.

TEvent
Inheritance
MonkeyBase<TMonkey>
Monkey<TMonkey>
ResoniteCancelableEventHandlerMonkey<TMonkey, TEvent>
Implements
Derived
Inherited Members
Extension Methods

Remarks

Game assemblies and their types can be directly referenced from these.
Contains useful overridable methods that are hooked to different points in the game's lifecycle.

Constructors

ResoniteCancelableEventHandlerMonkey()

Allows creating only a single TMonkey instance.

protected ResoniteCancelableEventHandlerMonkey()

Properties

Priority

Gets the priority of this item. Use the Priority values as a base.

public abstract int Priority { get; }

Property Value

int

An interger used to sort the prioritizable items.
Higher comes first with the default comparer.

SkipCanceled

Gets whether this handler should be skipped for events that have been canceled by a previous event handler.

public abstract bool SkipCanceled { get; }

Property Value

bool

Methods

AppliesTo(TEvent)

Determines whether the given event should be handled by this event handler based on its data.

protected abstract bool AppliesTo(TEvent eventData)

Parameters

eventData TEvent

An object containing all the relevant information for the event.

Returns

bool

true if this event handler applies to the event; otherwise, false.

Handle(TEvent)

Handles the given event based on its data, if AppliesTo returned true.

protected abstract void Handle(TEvent eventData)

Parameters

eventData TEvent

An object containing all the relevant information for the applicable event.

OnEngineReady()

Override this method to be called when the FrooxEngine.Engine is ready.
This is the primary method for patching used by Resonite Mods as basic facilities of the game are ready to use, while most other code hasn't been run yet.
Return true if patching was successful.

protected override bool OnEngineReady()

Returns

bool

Whether the patching was successful.

Remarks

Override OnLoaded() to patch before anything is initialized, but strongly consider also overriding this method if you do that.
Otherwise your patches will be applied twice, if you're using [HarmonyPatchCategory(nameof(MyPatcher))] attributes.

By default:Registers this Monkey as an event handler and applies the Harmony patches of the category with this patcher's type's name.
Easy to apply by using [HarmonyPatchCategory(nameof(MyPatcher))] attribute.