mirror of
https://github.com/ZuneDev/ZuneModdingHelper.git
synced 2026-07-27 13:12:21 -07:00
38 lines
978 B
C#
38 lines
978 B
C#
using System.Collections.Generic;
|
|||
|
|
using ZuneModCore.Mods;
|
||
|
|
|
||
|
|
namespace ZuneModCore;
|
||
|
|
|
||
|
|
public class ModManager
|
||
|
|
{
|
||
|
|
/// <summary>
|
||
|
|
/// Factories for all available mods.
|
||
|
|
/// </summary>
|
||
|
|
public static readonly IReadOnlyList<IModFactory<Mod>> ModFactories = new List<IModFactory<Mod>>
|
||
|
|
{
|
||
|
|
new FeaturesOverrideModFactory(),
|
||
|
|
new VideoSyncModFactory(),
|
||
|
|
new WebservicesModFactory(),
|
||
|
|
new BackgroundImageModFactory(),
|
||
|
|
new MbidLocatorModFactory(),
|
||
|
|
}.AsReadOnly();
|
||
|
|
|
||
|
|
private static List<Mod>? _mods;
|
||
|
|
public static IReadOnlyList<Mod> GetAvailableMods()
|
||
|
|
{
|
||
|
|
if (_mods is null)
|
||
|
|
{
|
||
|
|
_mods = new(ModFactories.Count);
|
||
|
|
var services = CommunityToolkit.Mvvm.DependencyInjection.Ioc.Default;
|
||
|
|
|
||
|
|
foreach (var modType in ModFactories)
|
||
|
|
{
|
||
|
|
var mod = modType.Create(services);
|
||
|
|
_mods.Add(mod);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
return _mods;
|
||
|
|
}
|
||
|
|
}
|