@@ -3,7 +3,7 @@ using System.Collections.Generic;
namespace ET
{
- public class EntitySystemSingleton: SingletonLock<EntitySystemSingleton>, ISingletonAwake
+ public class EntitySystemSingleton: SingletonReload<EntitySystemSingleton>, ISingletonAwake
public TypeSystems TypeSystems { get; private set; }
@@ -19,7 +19,7 @@ namespace ET
/// <summary>
/// Actor消息分发组件
/// </summary>
- public class ActorMessageDispatcherComponent: SingletonLock<ActorMessageDispatcherComponent>, ISingletonAwake
+ public class ActorMessageDispatcherComponent: SingletonReload<ActorMessageDispatcherComponent>, ISingletonAwake
private readonly Dictionary<Type, List<ActorMessageDispatcherInfo>> ActorMessageHandlers = new();
@@ -10,24 +10,15 @@ namespace ET
[StaticField]
private static T instance;
- [StaticField]
- private static object lockObj = new();
-
public static T Instance
get
- lock (lockObj)
- {
- return instance;
- }
+ return instance;
}
private set
- instance = value;
+ instance = value;
@@ -56,31 +56,22 @@ namespace ET
- public abstract class SingletonLock<T>: ISingleton, ISingletonLoad where T: SingletonLock<T>, new()
+ public abstract class SingletonReload<T>: ISingleton, ISingletonLoad where T: SingletonReload<T>, new()
private bool isDisposed;
namespace ET.Server
- public class HttpDispatcher: SingletonLock<HttpDispatcher>, ISingletonAwake
+ public class HttpDispatcher: SingletonReload<HttpDispatcher>, ISingletonAwake
private readonly Dictionary<string, Dictionary<int, IHttpHandler>> dispatcher = new();
@@ -11,7 +11,7 @@ namespace ET
public const int Max = 1;
- public class LSEntitySystemSingleton: SingletonLock<LSEntitySystemSingleton>, ISingletonAwake
+ public class LSEntitySystemSingleton: SingletonReload<LSEntitySystemSingleton>, ISingletonAwake
- public class AIDispatcherComponent: SingletonLock<AIDispatcherComponent>, ISingletonAwake
+ public class AIDispatcherComponent: SingletonReload<AIDispatcherComponent>, ISingletonAwake
private readonly Dictionary<string, AAIHandler> aiHandlers = new();
- public class ConsoleDispatcher: SingletonLock<ConsoleDispatcher>, ISingletonAwake
+ public class ConsoleDispatcher: SingletonReload<ConsoleDispatcher>, ISingletonAwake
private readonly Dictionary<string, IConsoleHandler> handlers = new();
@@ -15,7 +15,7 @@ namespace ET
- public class MessageDispatcherComponent: SingletonLock<MessageDispatcherComponent>, ISingletonAwake
+ public class MessageDispatcherComponent: SingletonReload<MessageDispatcherComponent>, ISingletonAwake
private readonly Dictionary<ushort, List<MessageDispatcherInfo>> handlers = new();
@@ -18,7 +18,7 @@ namespace ET
/// 监视数值变化组件,分发监听
- public class NumericWatcherComponent : SingletonLock<NumericWatcherComponent>, ISingletonAwake
+ public class NumericWatcherComponent : SingletonReload<NumericWatcherComponent>, ISingletonAwake
private readonly Dictionary<int, List<NumericWatcherInfo>> allWatchers = new();
@@ -7,7 +7,7 @@ namespace ET.Client
/// 管理所有UI GameObject
- public class UIEventComponent: SingletonLock<UIEventComponent>, ISingletonAwake
+ public class UIEventComponent: SingletonReload<UIEventComponent>, ISingletonAwake
public Dictionary<string, AUIEvent> UIEvents { get; } = new();