Search Results for

    Class ModBase

    Inheritance
    object
    ModBase
    ModTypeBase<T>
    Inherited Members
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: RedLoader
    Assembly: RedLoader.dll
    Syntax
    public abstract class ModBase

    Constructors

    ModBase()

    Declaration
    protected ModBase()

    Fields

    OnMelonInitializing

    Called before a Melon starts initializing.

    Declaration
    public static readonly MelonEvent<ModBase> OnMelonInitializing
    Field Value
    Type Description
    MelonEvent<ModBase>

    OnMelonRegistered

    Called once a Melon is fully registered.

    Declaration
    public static readonly MelonEvent<ModBase> OnMelonRegistered
    Field Value
    Type Description
    MelonEvent<ModBase>

    OnMelonUnregistered

    Called when a Melon unregisters.

    Declaration
    public static readonly MelonEvent<ModBase> OnMelonUnregistered
    Field Value
    Type Description
    MelonEvent<ModBase>

    OnRegister

    Declaration
    public readonly MelonEvent OnRegister
    Field Value
    Type Description
    MelonEvent

    OnUnregister

    Declaration
    public readonly MelonEvent OnUnregister
    Field Value
    Type Description
    MelonEvent

    Properties

    AdditionalCredits

    AdditionalCredits Attribute of the Melon

    Declaration
    public MelonAdditionalCreditsAttribute AdditionalCredits { get; }
    Property Value
    Type Description
    MelonAdditionalCreditsAttribute

    AuthorConsoleColor

    Console Color of the Author that made this melon.

    Declaration
    public Color AuthorConsoleColor { get; }
    Property Value
    Type Description
    Color

    ConsoleColor

    Console Color of the Melon.

    Declaration
    public Color ConsoleColor { get; }
    Property Value
    Type Description
    Color

    Description

    Description of the Mod.

    Declaration
    public string Description { get; }
    Property Value
    Type Description
    string

    HarmonyInstance

    Auto-Created Harmony Instance of the Melon.

    Declaration
    public Harmony HarmonyInstance { get; }
    Property Value
    Type Description
    Harmony

    ID

    Optional ID of the Melon.

    Declaration
    public string ID { get; }
    Property Value
    Type Description
    string

    LoggerInstance

    Auto-Created MelonLogger Instance of the Melon.

    Declaration
    public RLog.Instance LoggerInstance { get; }
    Property Value
    Type Description
    RLog.Instance

    MelonAssembly

    MelonAssembly of the Melon.

    Declaration
    public MelonAssembly MelonAssembly { get; }
    Property Value
    Type Description
    MelonAssembly

    MelonTypeName

    Name of the current Melon Type.

    Declaration
    public abstract string MelonTypeName { get; }
    Property Value
    Type Description
    string

    OptionalDependencies

    Optional Dependencies Attribute of the Melon.

    Declaration
    public string[] OptionalDependencies { get; }
    Property Value
    Type Description
    string[]

    Priority

    Priority of the Melon.

    Declaration
    public int Priority { get; }
    Property Value
    Type Description
    int

    Registered

    true if the Melon is registered.

    Declaration
    public bool Registered { get; }
    Property Value
    Type Description
    bool

    RegisteredMelons

    Declaration
    public static ReadOnlyCollection<ModBase> RegisteredMelons { get; }
    Property Value
    Type Description
    ReadOnlyCollection<ModBase>

    SupportedGameVersion

    Game Version Attributes of the Melon.

    Declaration
    public string SupportedGameVersion { get; }
    Property Value
    Type Description
    string

    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
    Type Name Description
    string name
    string author
    string version
    MelonGameAttribute[] games
    MelonProcessAttribute[] processes
    int priority
    Color? color
    Color? authorColor
    string id
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T

    ExecuteAll(LemonAction<ModBase>, bool, string)

    Declaration
    public static void ExecuteAll(LemonAction<ModBase> func, bool unregisterOnFail = false, string unregistrationReason = null)
    Parameters
    Type Name Description
    LemonAction<ModBase> func
    bool unregisterOnFail
    string unregistrationReason

    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 Name Description
    LemonAction<T> func
    List<T> melons
    bool unregisterOnFail
    string unregistrationReason
    Type Parameters
    Name Description
    T

    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
    Type Name Description
    MelonGameAttribute game
    string processName
    string gameVersion
    string mlVersion
    string mlBuildHashCode
    MelonPlatformAttribute.CompatiblePlatforms platform
    MelonPlatformDomainAttribute.CompatibleDomains domain
    Returns
    Type Description
    Incompatibility[]

    FindIncompatiblitiesFromContext()

    Declaration
    public ModBase.Incompatibility[] FindIncompatiblitiesFromContext()
    Returns
    Type Description
    Incompatibility[]

    FindMelon(string, string)

    Tries to find a registered Melon that matches the given Info.

    Declaration
    public static ModBase FindMelon(string melonName, string melonAuthor)
    Parameters
    Type Name Description
    string melonName
    string melonAuthor
    Returns
    Type Description
    ModBase

    OnApplicationQuit()

    Runs on a quit request. It is possible to abort the request in this callback.

    Declaration
    protected virtual void OnApplicationQuit()

    OnDeinitializeMod()

    Runs when the mod is unregistered. Also runs before the Application is closed (OnApplicationDefiniteQuit).

    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()
    Remarks

    Please note that this callback may run before the Support Module is loaded.
    As a result, using unhollowed assemblies may not be possible yet and you would have to override OnInitializeMod() instead.

    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()

    Runs after OnInitializeMod(). This callback waits until Unity has invoked the first 'Start' messages (OnApplicationLateStart).

    Declaration
    protected virtual void OnLateInitializeMod()

    OnLateUpdate()

    Runs once per frame, after OnUpdate().

    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()

    Runs once per frame.

    Declaration
    protected virtual void OnUpdate()

    PrintIncompatibilities(Incompatibility[], ModBase)

    Declaration
    public static void PrintIncompatibilities(ModBase.Incompatibility[] incompatibilities, ModBase mod)
    Parameters
    Type Name Description
    Incompatibility[] incompatibilities
    ModBase mod

    Register()

    Registers the Melon.

    Declaration
    public bool Register()
    Returns
    Type Description
    bool

    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 Name Description
    IEnumerable<T> melons
    Type Parameters
    Name Description
    T

    SendMessage(string, params object[])

    Declaration
    public object SendMessage(string name, params object[] arguments)
    Parameters
    Type Name Description
    string name
    object[] arguments
    Returns
    Type Description
    object

    SendMessageAll(string, params object[])

    Declaration
    public static void SendMessageAll(string name, params object[] arguments)
    Parameters
    Type Name Description
    string name
    object[] arguments

    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
    Type Name Description
    string reason
    bool silent