Class MonkeyTogglesConfigSection
- Namespace
- MonkeyLoader.Meta
- Assembly
- MonkeyLoader.dll
Specifies the toggles for the Monkeys of a Mod which support disabling.
public sealed class MonkeyTogglesConfigSection : ExpandoConfigSection, INestedIdentifiable<Config>, INestedIdentifiable, IIdentifiableOwner<ConfigSection, IDefiningConfigKey>, IIdentifiableOwner<IDefiningConfigKey>, IIdentifiable, IPrioritizable
- Inheritance
-
MonkeyTogglesConfigSection
- Implements
- Inherited Members
- Extension Methods
Properties
Description
Gets a description of the config items found in this section.
public override string Description { get; }
Property Value
Id
Gets the mod-unique identifier of this section.
public override string Id { get; }
Property Value
InternalAccessOnly
Gets whether only the owning mod should have access to this config item.
public override bool InternalAccessOnly { get; }
Property Value
Remarks
By default: false
.
Mod
Gets the Mod that these toggles are for.
public Mod Mod { get; }
Property Value
Version
Gets the semantic version for this config section.
This is used to check if the defined and saved configs are compatible.
public override Version Version { get; }
Property Value
Methods
GetTemplateKey(IMonkey)
Creates a template key for the toggle of the given (early) monkey.
public static ITypedConfigKey<bool> GetTemplateKey(IMonkey monkey)
Parameters
monkey
IMonkeyThe (early) monkey to create a template key for.
Returns
- ITypedConfigKey<bool>
The template key for the toggle of the (early) monkey.
GetToggle(IMonkey)
Gets or creates the toggle config item for the given (early) monkey, while passing along the given method to compute its default state.
public IDefiningConfigKey<bool> GetToggle(IMonkey monkey)
Parameters
monkey
IMonkeyThe (early) monkey to get the key for. Must belong to the same Mod and support being disabled.
Returns
- IDefiningConfigKey<bool>
The toggle config item for the given (early) monkey.
Remarks
The default for toggles created with this method is true
.
Exceptions
- ArgumentNullException
When the
monkey
isnull
.- ArgumentException
When the
monkey
is from another Mod or doesn't support being disabled.
GetToggle(IMonkey, Func<bool>)
Gets or creates the toggle config item for the given (early) monkey, while passing along the given method to compute its default state.
public IDefiningConfigKey<bool> GetToggle(IMonkey monkey, Func<bool> computeDefault)
Parameters
monkey
IMonkeyThe (early) monkey to get the key for. Must belong to the same Mod and support being disabled.
computeDefault
Func<bool>The function that computes the default state for this toggle.
Returns
- IDefiningConfigKey<bool>
The toggle config item for the given (early) monkey.
Exceptions
- ArgumentNullException
When the
monkey
isnull
.- ArgumentException
When the
monkey
is from another Mod or doesn't support being disabled.