mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-27 23:44:35 +00:00
Removed readonly properties that can be more easily replicated with the indexer
This commit is contained in:
1 parent
b0be07192e
commit
be1d77bc6c
2 files changed
-54
No files matched your search
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using BepInEx.Configuration;
|
||||
using MiraAPI.PluginLoading;
|
||||
|
||||
@@ -15,36 +14,11 @@ public interface IModdedOptionList
|
||||
/// </summary>
|
||||
int Count { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the unique identifiers for the options.
|
||||
/// </summary>
|
||||
IReadOnlyList<uint> Ids { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the titles of the options.
|
||||
/// </summary>
|
||||
IReadOnlyList<string> Titles { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the StringName for the options, used for localization.
|
||||
/// </summary>
|
||||
IReadOnlyList<StringNames> StringNames { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the MiraPlugin that created these options.
|
||||
/// </summary>
|
||||
IMiraPlugin? ParentMod { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the game setting data for the options.
|
||||
/// </summary>
|
||||
IReadOnlyList<BaseGameSetting> Data { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the OptionBehaviour object of the options.
|
||||
/// </summary>
|
||||
IReadOnlyList<OptionBehaviour?> OptionBehaviours { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visibility function for the options.
|
||||
/// </summary>
|
||||
@@ -55,11 +29,6 @@ public interface IModdedOptionList
|
||||
/// </summary>
|
||||
bool IncludeInPreset { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the set of ConfigDefinition for the options, used for BepInEx configuration.
|
||||
/// </summary>
|
||||
IReadOnlyList<ConfigDefinition?> ConfigDefinitions { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Saves the options to a preset configuration file.
|
||||
/// </summary>
|
||||
|
||||
@@ -17,18 +17,6 @@ public class ModdedOptionList<T> : IModdedOptionList where T : IModdedOption
|
||||
/// <inheritdoc/>
|
||||
public int Count { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public IReadOnlyList<uint> Ids => FromOptions(o => o.Id);
|
||||
|
||||
/// <inheritdoc />
|
||||
public IReadOnlyList<string> Titles => FromOptions(o => o.Title);
|
||||
|
||||
/// <inheritdoc />
|
||||
public IReadOnlyList<StringNames> StringNames => FromOptions(o => o.StringName);
|
||||
|
||||
/// <inheritdoc />
|
||||
public IReadOnlyList<BaseGameSetting> Data => FromOptions(o => o.Data);
|
||||
|
||||
/// <inheritdoc />
|
||||
public IMiraPlugin? ParentMod
|
||||
{
|
||||
@@ -56,12 +44,6 @@ public class ModdedOptionList<T> : IModdedOptionList where T : IModdedOption
|
||||
/// <inheritdoc />
|
||||
public bool IncludeInPreset { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public IReadOnlyList<OptionBehaviour?> OptionBehaviours => FromOptions(o => o.OptionBehaviour);
|
||||
|
||||
/// <inheritdoc />
|
||||
public IReadOnlyList<ConfigDefinition?> ConfigDefinitions => FromOptions(o => o.ConfigDefinition);
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ModdedOptionList{T}"/> class.
|
||||
/// </summary>
|
||||
@@ -76,11 +58,6 @@ public class ModdedOptionList<T> : IModdedOptionList where T : IModdedOption
|
||||
Options = Enumerable.Range(0, Count).Select(optionFactory).ToArray();
|
||||
}
|
||||
|
||||
internal IReadOnlyList<TVal> FromOptions<TVal>(Func<T, TVal> getter)
|
||||
{
|
||||
return Options.Select(getter).ToArray();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void SaveToPreset(ConfigFile presetConfig, bool saveDefault = false)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user