1using Microsoft.Xna.Framework;
3using System.ComponentModel;
10 [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Class)]
15 this.color =
new Color(r, g, b, a);
22 [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Class)]
27 this.color =
new Color(r, g, b, a);
34 [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
43 [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Class)]
50 public string Label =>
label.StartsWith(
"$") ? Localization.Language.GetTextValue(
label.Substring(1)) :
label;
57 [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
71 [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
84 [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Class | AttributeTargets.Enum)]
107 [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
113 this.value = TypeDescriptor.GetConverter(type).ConvertFromInvariantString(
value);
116 Logging.tML.Error(
"Default value attribute of type " + type.FullName +
" threw converting from the string '" +
value +
"'.");
133 public override bool Equals(
object obj) {
140 return Value.Equals(other.Value);
143 return (other.Value ==
null);
159 [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
165 this.value = TypeDescriptor.GetConverter(type).ConvertFromInvariantString(
value);
168 Logging.tML.Error(
"Default value attribute of type " + type.FullName +
" threw converting from the string '" +
value +
"'.");
185 public override bool Equals(
object obj) {
192 return Value.Equals(other.Value);
195 return (other.Value ==
null);
211 [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
234 [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
246 [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
259 [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
280 [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
308 [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
316 [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
324 [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
332 [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
344 [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Class)]
352 [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Class)]
Specifies a background color to be used for the property, field, or class in the ModConfig UI.
BackgroundColorAttribute(int r, int g, int b, int a=255)
Add this attribute to a Color item and the UI will present a Hue, Saturation, and Lightness sliders r...
ColorHSLSliderAttribute(bool showSaturationAndLightness=true)
bool showSaturationAndLightness
Add this attribute to a Color item and Alpha will not be presented in the UI and will remain as 255 u...
Use this attribute to specify a custom UI element to be used for the annotated property,...
CustomModConfigItemAttribute(Type t)
Defines the default key value to be added when using the ModConfig UI to add elements to a Dictionary...
DefaultDictionaryKeyValueAttribute(Type type, string value)
DefaultDictionaryKeyValueAttribute(float value)
DefaultDictionaryKeyValueAttribute(byte value)
DefaultDictionaryKeyValueAttribute(bool value)
DefaultDictionaryKeyValueAttribute(long value)
DefaultDictionaryKeyValueAttribute(string value)
DefaultDictionaryKeyValueAttribute(short value)
override int GetHashCode()
DefaultDictionaryKeyValueAttribute(char value)
void SetValue(object value)
override bool Equals(object obj)
DefaultDictionaryKeyValueAttribute(double value)
DefaultDictionaryKeyValueAttribute(object value)
DefaultDictionaryKeyValueAttribute(int value)
Defines the default value to be added when using the ModConfig UI to add elements to a Collection (Li...
DefaultListValueAttribute(short value)
override bool Equals(object obj)
override int GetHashCode()
DefaultListValueAttribute(char value)
DefaultListValueAttribute(byte value)
DefaultListValueAttribute(object value)
DefaultListValueAttribute(int value)
DefaultListValueAttribute(double value)
DefaultListValueAttribute(bool value)
DefaultListValueAttribute(long value)
DefaultListValueAttribute(float value)
DefaultListValueAttribute(Type type, string value)
void SetValue(object value)
DefaultListValueAttribute(string value)
Add this attribute and the sliders will show white tick marks at each increment.
Use this to set an increment for sliders. The slider will move by the amount assigned....
IncrementAttribute(uint increment)
IncrementAttribute(byte increment)
IncrementAttribute(int increment)
IncrementAttribute(float increment)
Similar to JsonDefaultListValueAttribute, but for assigning to the Dictionary Key rather than the Val...
JsonDefaultDictionaryKeyValueAttribute(string json)
Similar to DefaultListValueAttribute but for reference types. It uses a json string that will be used...
JsonDefaultListValueAttribute(string json)
Similar to DefaultValueAttribute but for reference types. It uses a json string that will be used pop...
JsonDefaultValueAttribute(string json)
This attribute sets a label for the property, field, or class for use in the ModConfig UI....
LabelAttribute(string label)
This attribute means the annotated item can possibly be null. This will allow the UI to make the item...
By default, string fields will provide the user with a text input field. Use this attribute to restri...
OptionStringsAttribute(string[] optionLabels)
Specifies a range for primitive data values. Without this, default min and max are as follows: float:...
RangeAttribute(int min, int max)
RangeAttribute(byte min, byte max)
RangeAttribute(float min, float max)
RangeAttribute(uint min, uint max)
This attribute hints that changing the value of the annotated property or field will put the config i...
This specifies that the annotated item will appear as a button that leads to a separate page in the U...
Affects whether this data will be presented as a slider of an input field. Add this attribute to use ...
Specifies a slider color for ModConfig elements that use a slider. The default color is white.
SliderColorAttribute(int r, int g, int b, int a=255)