BITKit/Src/Unity/Scripts/Config/ConfigProvider.cs

33 lines
667 B
C#
Raw Normal View History

2024-03-31 23:31:00 +08:00
using System;
2023-11-30 00:25:43 +08:00
using System.Collections;
using System.Collections.Generic;
2024-03-31 23:31:00 +08:00
using System.Linq;
2023-11-30 00:25:43 +08:00
using UnityEngine;
namespace BITKit
{
public interface IConfigProvider
{
string GetConfig(params object[] args);
void Configure(params object[] args);
}
2024-03-31 23:31:00 +08:00
[Serializable]
public sealed class ConfigProviders:IConfigProvider
{
[SerializeReference,SubclassSelector] private IConfigProvider[] providers;
public string GetConfig(params object[] args)
{
return string.Join("\n",providers.Select(x=>x.GetConfig(args)));
}
public void Configure(params object[] args)
{
foreach (var provider in providers)
{
provider.Configure(args);
}
}
}
2023-11-30 00:25:43 +08:00
}