|
@@ -7,7 +7,7 @@ namespace ET
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// Config组件会扫描所有的有ConfigAttribute标签的配置,加载进来
|
|
/// Config组件会扫描所有的有ConfigAttribute标签的配置,加载进来
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
- public class ConfigComponent: ProcessSingleton<ConfigComponent>
|
|
|
|
|
|
|
+ public class ConfigComponent: Singleton<ConfigComponent>
|
|
|
{
|
|
{
|
|
|
public struct GetAllConfigBytes
|
|
public struct GetAllConfigBytes
|
|
|
{
|
|
{
|
|
@@ -18,7 +18,7 @@ namespace ET
|
|
|
public string ConfigName;
|
|
public string ConfigName;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private readonly Dictionary<Type, IProcessSingleton> allConfig = new Dictionary<Type, IProcessSingleton>();
|
|
|
|
|
|
|
+ private readonly Dictionary<Type, ISingleton> allConfig = new();
|
|
|
|
|
|
|
|
public override void Dispose()
|
|
public override void Dispose()
|
|
|
{
|
|
{
|
|
@@ -30,7 +30,7 @@ namespace ET
|
|
|
|
|
|
|
|
public object LoadOneConfig(Type configType)
|
|
public object LoadOneConfig(Type configType)
|
|
|
{
|
|
{
|
|
|
- this.allConfig.TryGetValue(configType, out IProcessSingleton oneConfig);
|
|
|
|
|
|
|
+ this.allConfig.TryGetValue(configType, out ISingleton oneConfig);
|
|
|
if (oneConfig != null)
|
|
if (oneConfig != null)
|
|
|
{
|
|
{
|
|
|
oneConfig.Destroy();
|
|
oneConfig.Destroy();
|
|
@@ -39,7 +39,7 @@ namespace ET
|
|
|
byte[] oneConfigBytes = EventSystem.Instance.Invoke<GetOneConfigBytes, byte[]>(new GetOneConfigBytes() {ConfigName = configType.FullName});
|
|
byte[] oneConfigBytes = EventSystem.Instance.Invoke<GetOneConfigBytes, byte[]>(new GetOneConfigBytes() {ConfigName = configType.FullName});
|
|
|
|
|
|
|
|
object category = MongoHelper.Deserialize(configType, oneConfigBytes, 0, oneConfigBytes.Length);
|
|
object category = MongoHelper.Deserialize(configType, oneConfigBytes, 0, oneConfigBytes.Length);
|
|
|
- IProcessSingleton singleton = category as IProcessSingleton;
|
|
|
|
|
|
|
+ ISingleton singleton = category as ISingleton;
|
|
|
singleton.Register();
|
|
singleton.Register();
|
|
|
|
|
|
|
|
this.allConfig[configType] = singleton;
|
|
this.allConfig[configType] = singleton;
|
|
@@ -81,7 +81,7 @@ namespace ET
|
|
|
|
|
|
|
|
lock (this)
|
|
lock (this)
|
|
|
{
|
|
{
|
|
|
- IProcessSingleton singleton = category as IProcessSingleton;
|
|
|
|
|
|
|
+ ISingleton singleton = category as ISingleton;
|
|
|
singleton.Register();
|
|
singleton.Register();
|
|
|
this.allConfig[configType] = singleton;
|
|
this.allConfig[configType] = singleton;
|
|
|
}
|
|
}
|