Class ResoniteCancelableAsyncEventSourceMonkey<TMonkey, TEvent1, TEvent2, TEvent3, TEvent4, TEvent5, TEvent6>
- 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 a cancelable async event source for the TEvent generic parameter(s).
public abstract class ResoniteCancelableAsyncEventSourceMonkey<TMonkey, TEvent1, TEvent2, TEvent3, TEvent4, TEvent5, TEvent6> : ResoniteCancelableAsyncEventSourceMonkey<TMonkey, TEvent1, TEvent2, TEvent3, TEvent4, TEvent5>, IResoniteMonkey, IMonkey, IRun, IShutdown, IComparable<IMonkey>, INestedIdentifiable<Mod>, INestedIdentifiable, IIdentifiable, IAuthorable, IDisplayable, ICancelableAsyncEventSource<TEvent1>, ICancelableAsyncEventSource<TEvent2>, ICancelableAsyncEventSource<TEvent3>, ICancelableAsyncEventSource<TEvent4>, ICancelableAsyncEventSource<TEvent5>, ICancelableAsyncEventSource<TEvent6> where TMonkey : ResoniteCancelableAsyncEventSourceMonkey<TMonkey, TEvent1, TEvent2, TEvent3, TEvent4, TEvent5, TEvent6>, new() where TEvent1 : CancelableAsyncEvent where TEvent2 : CancelableAsyncEvent where TEvent3 : CancelableAsyncEvent where TEvent4 : CancelableAsyncEvent where TEvent5 : CancelableAsyncEvent where TEvent6 : CancelableAsyncEvent
Type Parameters
TMonkeyThe type of the actual patcher.
TEvent1The first CancelableAsyncEvent type to dispatch.
TEvent2The second CancelableAsyncEvent type to dispatch.
TEvent3The third CancelableAsyncEvent type to dispatch.
TEvent4The fourth CancelableAsyncEvent type to dispatch.
TEvent5The fifth CancelableAsyncEvent type to dispatch.
TEvent6The sixth CancelableAsyncEvent type to dispatch.
- Inheritance
-
MonkeyBase<TMonkey>Monkey<TMonkey>ResoniteMonkey<TMonkey>ResoniteCancelableAsyncEventSourceMonkey<TMonkey, TEvent1>ResoniteCancelableAsyncEventSourceMonkey<TMonkey, TEvent1, TEvent2>ResoniteCancelableAsyncEventSourceMonkey<TMonkey, TEvent1, TEvent2, TEvent3>ResoniteCancelableAsyncEventSourceMonkey<TMonkey, TEvent1, TEvent2, TEvent3, TEvent4>ResoniteCancelableAsyncEventSourceMonkey<TMonkey, TEvent1, TEvent2, TEvent3, TEvent4, TEvent5>ResoniteCancelableAsyncEventSourceMonkey<TMonkey, TEvent1, TEvent2, TEvent3, TEvent4, TEvent5, TEvent6>
- Implements
-
ICancelableAsyncEventSource<TEvent1>ICancelableAsyncEventSource<TEvent2>ICancelableAsyncEventSource<TEvent3>ICancelableAsyncEventSource<TEvent4>ICancelableAsyncEventSource<TEvent5>ICancelableAsyncEventSource<TEvent6>
- 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
ResoniteCancelableAsyncEventSourceMonkey()
Allows creating only a single TMonkey instance.
protected ResoniteCancelableAsyncEventSourceMonkey()
Methods
DispatchAsync(TEvent6)
Dispatches the TEvent6 with the given data.
protected static Task DispatchAsync(TEvent6 eventData)
Parameters
eventDataTEvent6The event data to dispatch.
Returns
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.
Easy to apply by using
[HarmonyPatchCategory(nameof(MyPatcher))] attribute.
OnShutdown(bool)
Lets this monkey cleanup and shutdown.
protected override bool OnShutdown(bool applicationExiting)
Parameters
applicationExitingboolWhether the shutdown was caused by the application exiting.
Returns
- bool
trueif it ran successfully; otherwise,false.
Remarks
By default: Unregisters
this monkey as an event source for TEvents
and removes all Harmony patches done
using this Monkey's Harmony instance,
if not exiting, and returns true.