- ConfigService.cs alpha testing.

This commit is contained in:
MapleWheels
2026-01-22 14:58:03 -05:00
committed by Maplewheels
parent cc07db941f
commit 7e0e671539
27 changed files with 795 additions and 546 deletions
@@ -67,9 +67,8 @@ public record ConfigInfo : IConfigInfo
{
public string InternalName { get; init; }
public ContentPackage OwnerPackage { get; init; }
public Type DataType { get; init; }
public OneOf<string, XElement> DefaultValue { get; init; }
public OneOf<string, XElement> Value { get; init; }
public string DataType { get; init; }
public XElement Element { get; init; }
public RunState EditableStates { get; init; }
public NetSync NetSync { get; init; }
@@ -79,7 +78,7 @@ public record ConfigInfo : IConfigInfo
public string DisplayCategory { get; init; }
public bool ShowInMenus { get; init; }
public string Tooltip { get; init; }
public string ImageIconPath { get; init; }
public ContentPath ImageIconPath { get; init; }
#endif
}
@@ -87,7 +86,7 @@ public record ConfigProfileInfo : IConfigProfileInfo
{
public string InternalName { get; init; }
public ContentPackage OwnerPackage { get; init; }
public IReadOnlyList<(string ConfigName, OneOf<string, XElement> Value)> ProfileValues { get; init; }
public IReadOnlyList<(string ConfigName, XElement Element)> ProfileValues { get; init; }
}
#endregion
@@ -13,26 +13,18 @@ public partial interface IConfigInfo : IDataInfo
/// <summary>
/// Specifies the type initializer that will be used to instantiate the config var.
/// </summary>
Type DataType { get; }
string DataType { get; }
/// <summary>
/// The default value.
/// The 'Setting' XML element.
/// </summary>
OneOf.OneOf<string, XElement> DefaultValue { get; }
/// <summary>
/// The value the last time this config was saved. If not found, returns the default value.
/// <br/><b>[If(Type='<see cref="string"/>')]</b><br/>
/// The value is from the 'Value' Attribute. Typically used for types with single/simple values, such as primitives.
/// <br/><b>[If(Type='<see cref="XElement"/>')]</b><br/>
/// The value is from the first 'Value' child element. Typically used with complex config types, such as range and list.
/// </summary>
OneOf.OneOf<string, XElement> Value { get; }
XElement Element { get; }
/// <summary>
/// In what <see cref="RunState"/>(s) is this config editable. Will be editable in the selected state, and lower value states.
/// <br/><br/>
/// <b>[Important]</b><br/> Setting this to value lower than 'Configuration` will render this config read-only.
/// <br/><br/><b>Expected Behaviour</b>:
/// <br/><b>[<see cref="RunState.Unloaded"/>|<see cref="RunState.Parsed"/>]</b>: Read-Only.
/// <br/><b>[<see cref="RunState.Configuration"/>]</b>: Can only be changed at the Main Menu (not in a lobby).
/// <br/><b>[<see cref="RunState.Unloaded"/>|<see cref="RunState.Unloaded"/>]</b>: Read-Only.
/// <br/><b>[<see cref="RunState.LoadedNoExec"/>]</b>: Can only be changed at the Main Menu (not in a lobby).
/// <br/><b>[<see cref="RunState.Running"/>]</b>: Can be changed at the Main Menu and while a lobby is active.
/// </summary>
RunState EditableStates { get; }
@@ -5,5 +5,5 @@ namespace Barotrauma.LuaCs.Data;
public interface IConfigProfileInfo : IDataInfo
{
IReadOnlyList<(string ConfigName, OneOf.OneOf<string, XElement> Value)> ProfileValues { get; }
IReadOnlyList<(string ConfigName, XElement Element)> ProfileValues { get; }
}