Class ModBase
Assembly: RedLoader.dll
Syntax
public abstract class ModBase
Constructors
ModBase()
Declaration
Fields
OnMelonInitializing
Called before a Melon starts initializing.
Declaration
public static readonly MelonEvent<ModBase> OnMelonInitializing
Field Value
OnMelonRegistered
Called once a Melon is fully registered.
Declaration
public static readonly MelonEvent<ModBase> OnMelonRegistered
Field Value
OnMelonUnregistered
Called when a Melon unregisters.
Declaration
public static readonly MelonEvent<ModBase> OnMelonUnregistered
Field Value
OnRegister
Declaration
public readonly MelonEvent OnRegister
Field Value
OnUnregister
Declaration
public readonly MelonEvent OnUnregister
Field Value
Properties
AdditionalCredits
AdditionalCredits Attribute of the Melon
Declaration
public MelonAdditionalCreditsAttribute AdditionalCredits { get; }
Property Value
AuthorConsoleColor
Console Color of the Author that made this melon.
Declaration
public Color AuthorConsoleColor { get; }
Property Value
ConsoleColor
Console Color of the Melon.
Declaration
public Color ConsoleColor { get; }
Property Value
Description
Declaration
public string Description { get; }
Property Value
HarmonyInstance
Auto-Created Harmony Instance of the Melon.
Declaration
public Harmony HarmonyInstance { get; }
Property Value
ID
Optional ID of the Melon.
Declaration
public string ID { get; }
Property Value
LoggerInstance
Auto-Created MelonLogger Instance of the Melon.
Declaration
public RLog.Instance LoggerInstance { get; }
Property Value
MelonAssembly
MelonAssembly of the Melon.
Declaration
public MelonAssembly MelonAssembly { get; }
Property Value
MelonTypeName
Name of the current Melon Type.
Declaration
public abstract string MelonTypeName { get; }
Property Value
OptionalDependencies
Optional Dependencies Attribute of the Melon.
Declaration
public string[] OptionalDependencies { get; }
Property Value
Priority
Declaration
public int Priority { get; }
Property Value
Registered
true if the Melon is registered.
Declaration
public bool Registered { get; }
Property Value
RegisteredMelons
Declaration
public static ReadOnlyCollection<ModBase> RegisteredMelons { get; }
Property Value
SupportedGameVersion
Game Version Attributes of the Melon.
Declaration
public string SupportedGameVersion { get; }
Property Value
Methods
CreateWrapper<T>(string, string, string, MelonGameAttribute[], MelonProcessAttribute[], int, Color?, Color?, string)
Creates a new Melon instance for a Wrapper.
Declaration
public static T CreateWrapper<T>(string name, string author, string version, MelonGameAttribute[] games = null, MelonProcessAttribute[] processes = null, int priority = 0, Color? color = null, Color? authorColor = null, string id = null) where T : ModBase, new()
Parameters
Returns
Type Parameters
ExecuteAll(LemonAction<ModBase>, bool, string)
Declaration
public static void ExecuteAll(LemonAction<ModBase> func, bool unregisterOnFail = false, string unregistrationReason = null)
Parameters
ExecuteList<T>(LemonAction<T>, List<T>, bool, string)
Declaration
public static void ExecuteList<T>(LemonAction<T> func, List<T> melons, bool unregisterOnFail = false, string unregistrationReason = null) where T : ModBase
Parameters
Type Parameters
FindIncompatiblities(MelonGameAttribute, string, string, string, string, CompatiblePlatforms, CompatibleDomains)
Declaration
public ModBase.Incompatibility[] FindIncompatiblities(MelonGameAttribute game, string processName, string gameVersion, string mlVersion, string mlBuildHashCode, MelonPlatformAttribute.CompatiblePlatforms platform, MelonPlatformDomainAttribute.CompatibleDomains domain)
Parameters
Returns
FindIncompatiblitiesFromContext()
Declaration
public ModBase.Incompatibility[] FindIncompatiblitiesFromContext()
Returns
FindMelon(string, string)
Tries to find a registered Melon that matches the given Info.
Declaration
public static ModBase FindMelon(string melonName, string melonAuthor)
Parameters
Returns
OnApplicationQuit()
Runs on a quit request. It is possible to abort the request in this callback.
Declaration
protected virtual void OnApplicationQuit()
OnDeinitializeMod()
Declaration
protected virtual void OnDeinitializeMod()
OnEarlyInitializeMelon()
Runs when the Melon is registered. Executed before the Melon's info is printed to the console. This callback should only be used a constructor for the Melon.
Declaration
protected virtual void OnEarlyInitializeMelon()
OnFixedUpdate()
Can run multiple times per frame. Mostly used for Physics.
Declaration
protected virtual void OnFixedUpdate()
OnGUI()
Can run multiple times per frame. Mostly used for Unity's IMGUI.
Declaration
protected virtual void OnGUI()
OnInitializeMod()
Runs after the Mod has registered. This callback waits until the loader has fully initialized (OnApplicationStart).
Declaration
protected virtual void OnInitializeMod()
OnLateInitializeMod()
Declaration
protected virtual void OnLateInitializeMod()
OnLateUpdate()
Declaration
protected virtual void OnLateUpdate()
OnPreSupportModule()
Runs before Support Module Initialization and after Assembly Generation for Il2Cpp Games.
Declaration
protected virtual void OnPreSupportModule()
OnPreferencesLoaded()
Runs when Melon Preferences get loaded.
Declaration
protected virtual void OnPreferencesLoaded()
OnPreferencesLoaded(string)
Runs when Melon Preferences get loaded. Gets passed the Preferences's File Path.
Declaration
protected virtual void OnPreferencesLoaded(string filepath)
Parameters
Type |
Name |
Description |
string |
filepath |
|
OnPreferencesSaved()
Runs when Melon Preferences get saved.
Declaration
protected virtual void OnPreferencesSaved()
OnPreferencesSaved(string)
Runs when Melon Preferences get saved. Gets passed the Preferences's File Path.
Declaration
protected virtual void OnPreferencesSaved(string filepath)
Parameters
Type |
Name |
Description |
string |
filepath |
|
OnUpdate()
Declaration
protected virtual void OnUpdate()
PrintIncompatibilities(Incompatibility[], ModBase)
Declaration
public static void PrintIncompatibilities(ModBase.Incompatibility[] incompatibilities, ModBase mod)
Parameters
Register()
Declaration
Returns
RegisterSorted<T>(IEnumerable<T>)
Registers a List of Melons in the right order.
Declaration
public static void RegisterSorted<T>(IEnumerable<T> melons) where T : ModBase
Parameters
Type Parameters
SendMessage(string, params object[])
Declaration
public object SendMessage(string name, params object[] arguments)
Parameters
Returns
SendMessageAll(string, params object[])
Declaration
public static void SendMessageAll(string name, params object[] arguments)
Parameters
Unregister(string, bool)
Unregisters the Melon and all other Melons located in the same Assembly.
This only unsubscribes the Melons from all Callbacks/MelonEvents and unpatches all Methods that were patched by Harmony, but doesn't actually unload the whole Assembly.
Declaration
public void Unregister(string reason = null, bool silent = false)
Parameters