Skip to content

Commit

Permalink
Merge pull request #443 from Aragas/dev
Browse files Browse the repository at this point in the history
v5.10.2
  • Loading branch information
Aragas authored Jul 2, 2024
2 parents ef0a019 + 1d3bc41 commit 9945911
Show file tree
Hide file tree
Showing 58 changed files with 247 additions and 313 deletions.
2 changes: 1 addition & 1 deletion build/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<PropertyGroup>
<GameVersion>1.0.0</GameVersion>
<GameVersionWithPrefix>v$(GameVersion)</GameVersionWithPrefix>
<Version>5.10.1</Version>
<Version>5.10.2</Version>
<HarmonyVersion>2.2.2</HarmonyVersion>
<ButterLibVersion>2.8.15</ButterLibVersion>
<UIExtenderExVersion>2.8.1</UIExtenderExVersion>
Expand Down
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
---------------------------------------------------------------------------------------------------
Version: 5.10.2
Game Versions: v1.0.0,v1.0.1,v1.0.2,v1.0.3,v1.1.0,v1.1.1,v1.1.2,v1.1.3,v1.1.4,v1.1.5,v1.1.6,v1.2.x
* Added the ability to set group order of empty groups
---------------------------------------------------------------------------------------------------
Version: 5.10.1
Game Versions: v1.0.0,v1.0.1,v1.0.2,v1.0.3,v1.1.0,v1.1.1,v1.1.2,v1.1.3,v1.1.4,v1.1.5,v1.1.6,v1.2.x
* Reverted Settings instance cache and cache invalidation
Expand Down
6 changes: 6 additions & 0 deletions docs/articles/MCMv5/mcmv5-attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ You can order properties via the [``Order``](xref:MCM.Abstractions.Attributes.Ba
[SettingPropertyText("Setting Name", Order = 6)]
public string SettingVariableName { get; set; } = "The textbox data is here";
```
If your group is empty (there are no properties that could indicate the group's order), you can use xref:MCM.Abstractions.Attributes.SettingPropertyGroupAttribute to order the group
```csharp
[SettingPropertyGroupMetadata]
[SettingPropertyGroup("EmptyGroup", GroupOrder = 3)]
public object EmptyGroupMetadata { get; set; } = new();
```

#### Require Restart
You can the game to restart when the property changes via the [``RequireRestart``](xref:MCM.Abstractions.Attributes.BaseSettingPropertyAttribute#collapsible-MCM_Abstractions_Attributes_BaseSettingPropertyAttribute_RequireRestart) attribute property
Expand Down

This file was deleted.

26 changes: 0 additions & 26 deletions src/MCM.Abstractions/Base/Global/BaseGlobalSettingsWrapper.cs

This file was deleted.

4 changes: 2 additions & 2 deletions src/MCM.Abstractions/Base/Global/FluentGlobalSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ public FluentGlobalSettings(string id, string displayName, string folderName, st

public void Register()
{
var containers = GenericServiceProvider.GetService<IEnumerable<IFluentGlobalSettingsContainer>>() ?? Enumerable.Empty<IFluentGlobalSettingsContainer>();
var containers = GenericServiceProvider.GetService<IEnumerable<IFluentGlobalSettingsContainer>>() ?? [];
foreach (var container in containers)
{
container?.Register(this);
}
}
public void Unregister()
{
var containers = GenericServiceProvider.GetService<IEnumerable<IFluentGlobalSettingsContainer>>() ?? Enumerable.Empty<IFluentGlobalSettingsContainer>();
var containers = GenericServiceProvider.GetService<IEnumerable<IFluentGlobalSettingsContainer>>() ?? [];
foreach (var container in containers)
{
container?.Unregister(this);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public FluentPerCampaignSettings(string id, string displayName, string folderNam
public void Register()
{
// TODO: check
var containers = GenericServiceProvider.GetService<IEnumerable<IFluentPerCampaignSettingsContainer>>() ?? Enumerable.Empty<IFluentPerCampaignSettingsContainer>();
var containers = GenericServiceProvider.GetService<IEnumerable<IFluentPerCampaignSettingsContainer>>() ?? [];
foreach (var container in containers)
{
container?.Register(this);
Expand All @@ -65,7 +65,7 @@ public void Register()
public void Unregister()
{
// TODO: check
var containers = GenericServiceProvider.GetService<IEnumerable<IFluentPerCampaignSettingsContainer>>() ?? Enumerable.Empty<IFluentPerCampaignSettingsContainer>();
var containers = GenericServiceProvider.GetService<IEnumerable<IFluentPerCampaignSettingsContainer>>() ?? [];
foreach (var container in containers)
{
container?.Unregister(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static T? Instance
return BaseSettingsProvider.Instance?.GetSettings(Cache[typeof(T)]) as T;
}
}

/*
/// <summary>
/// A modder flriendly way to get settings from any place
Expand Down
78 changes: 0 additions & 78 deletions src/MCM.Abstractions/Base/PerSave/BasePerSaveSettingsWrapper.cs

This file was deleted.

4 changes: 2 additions & 2 deletions src/MCM.Abstractions/Base/PerSave/FluentPerSaveSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public FluentPerSaveSettings(string id, string displayName, string folderName, s
public void Register()
{
// TODO: check
var containers = GenericServiceProvider.GetService<IEnumerable<IFluentPerSaveSettingsContainer>>() ?? Enumerable.Empty<IFluentPerSaveSettingsContainer>();
var containers = GenericServiceProvider.GetService<IEnumerable<IFluentPerSaveSettingsContainer>>() ?? [];
foreach (var container in containers)
{
container?.Register(this);
Expand All @@ -65,7 +65,7 @@ public void Register()
public void Unregister()
{
// TODO: check
var containers = GenericServiceProvider.GetService<IEnumerable<IFluentPerSaveSettingsContainer>>() ?? Enumerable.Empty<IFluentPerSaveSettingsContainer>();
var containers = GenericServiceProvider.GetService<IEnumerable<IFluentPerSaveSettingsContainer>>() ?? [];
foreach (var container in containers)
{
container?.Unregister(this);
Expand Down
2 changes: 1 addition & 1 deletion src/MCM.Abstractions/Base/PerSave/PerSaveSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static T? Instance
return BaseSettingsProvider.Instance?.GetSettings(Cache[typeof(T)]) as T;
}
}

/*
/// <summary>
/// A modder flriendly way to get settings from any place
Expand Down
2 changes: 1 addition & 1 deletion src/MCM.Abstractions/Base/SettingsWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public override void OnPropertyChanged([CallerMemberName] string? propertyName =
_methodOnPropertyChangedDelegate?.Invoke(propertyName);

public override IEnumerable<ISettingsPreset> GetBuiltInPresets() =>
_methodGetBuiltInPresetsDelegate?.Invoke()?.Cast<object>().Select(CreatePreset).OfType<ISettingsPreset>() ?? Enumerable.Empty<ISettingsPreset>();
_methodGetBuiltInPresetsDelegate?.Invoke()?.Cast<object>().Select(CreatePreset).OfType<ISettingsPreset>() ?? [];

public override BaseSettings CreateNew() => Create(_methodCreateNewDelegate?.Invoke());
public override BaseSettings CopyAsNew() => Create(_methodCopyAsNewDelegate?.Invoke());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;

// ReSharper disable once CheckNamespace
namespace MCM.Abstractions.Attributes.v2
{
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
#if !BANNERLORDMCM_INCLUDE_IN_CODE_COVERAGE
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage, global::System.Diagnostics.DebuggerNonUserCode]
#endif
#if !BANNERLORDMCM_PUBLIC
internal
#else
public
# endif
sealed class SettingPropertyGroupMetadataAttribute : BaseSettingPropertyAttribute,
IPropertyDefinitionGroupMetadata
{
public SettingPropertyGroupMetadataAttribute() : base(string.Empty) { }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace MCM.Abstractions
{
#if !BANNERLORDMCM_PUBLIC
internal
#else
public
# endif
interface IPropertyDefinitionGroupMetadata : IPropertyDefinitionBase
{ }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace MCM.Abstractions.Wrapper
{
#if !BANNERLORDMCM_INCLUDE_IN_CODE_COVERAGE
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage, global::System.Diagnostics.DebuggerNonUserCode]
#endif
#if !BANNERLORDMCM_PUBLIC
internal
#else
public
# endif
sealed class PropertyDefinitionGroupMetadataWrapper : BasePropertyDefinitionWrapper, IPropertyDefinitionGroupMetadata
{
public PropertyDefinitionGroupMetadataWrapper(object @object) : base(@object) { }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ class PropertyDropdownXmlModel : PropertyBaseXmlModel, IPropertyDefinitionDropdo
public int SelectedIndex { get; set; }

[XmlArray("Values")]
public string[] Values { get; set; } = Array.Empty<string>();
public string[] Values { get; set; } = [];
}
}
Loading

0 comments on commit 9945911

Please sign in to comment.