Game.Settings.SettingsUIDisableByConditionAttribute
Assembly: Assembly-CSharp
Namespace: Game.Settings
Type: public class
Base: System.Attribute
Summary:
Attribute used to mark a settings UI element (class or property) that should be disabled based on a runtime condition. You provide a Type that contains the check method and the name of the method to call; the method's boolean result controls whether the UI is disabled. The optional invert flag flips the meaning of the check result.
Fields
-
public readonly System.Type checkType
Type that contains the method used to evaluate the disabling condition. The class specified here is searched for the method named by checkMethod. -
public readonly string checkMethod
Name of the method on checkType that will be called to determine the condition. The method is expected to return a boolean indicating whether the UI element should be disabled (subject to invert). -
public readonly bool invert
If true, the boolean result from the check method is inverted before applying to the UI disabling logic (i.e., true -> false, false -> true).
Properties
- (none)
Constructors
-
public SettingsUIDisableByConditionAttribute(Type checkType, string checkMethod)
Create the attribute specifying the type and method name to call for the disable check. The invert flag defaults to false. -
public SettingsUIDisableByConditionAttribute(Type checkType, string checkMethod, bool invert)
Create the attribute specifying the type, method name, and whether to invert the check result.
Methods
- (none)
Usage Example
// Helper class that provides the condition method
public static class MySettingsChecker
{
// Example expected signature: returns bool
public static bool IsAdvancedModeEnabled()
{
// return true if advanced mode is enabled
return GameSettings.AdvancedMode;
}
}
// Apply to a settings class or property to disable its UI when IsAdvancedModeEnabled() returns true
[SettingsUIDisableByCondition(typeof(MySettingsChecker), "IsAdvancedModeEnabled")]
public class SomeSettingsGroup
{
// or on a single property:
[SettingsUIDisableByCondition(typeof(MySettingsChecker), "IsAdvancedModeEnabled", invert: true)]
public bool SomeToggle { get; set; }
}
Notes: - The attribute targets classes and properties and is inheritable (AttributeUsage: AttributeTargets.Class | AttributeTargets.Property, Inherited = true). - The expected behavior is that the method referenced by checkMethod returns a boolean. The exact accepted method signature (static vs instance, parameters) depends on the consuming UI framework; the most common pattern is a public static parameterless method returning bool. If you rely on a different signature, verify how the modding/UI framework invokes the method.