Przeglądaj źródła

Game的Instance都加上自旋锁保证线程安全
如果需要热重载代码跟配置,需要整体替换Instance,不允许修改里面的内容

tanghai 2 lat temu
rodzic
commit
d59e35333f

+ 5 - 1
DotNet/Loader/Init.cs

@@ -28,12 +28,16 @@ namespace ET
 					.WithNotParsed(error => throw new Exception($"命令行格式错误! {error}"))
 					.WithNotParsed(error => throw new Exception($"命令行格式错误! {error}"))
 					.WithParsed(Game.Instance.AddSingleton);
 					.WithParsed(Game.Instance.AddSingleton);
 				Game.Instance.AddSingleton<Logger>().ILog = new NLogger(Options.Instance.AppType.ToString(), Options.Instance.Process, "../Config/NLog/NLog.config");
 				Game.Instance.AddSingleton<Logger>().ILog = new NLogger(Options.Instance.AppType.ToString(), Options.Instance.Process, "../Config/NLog/NLog.config");
+				Game.Instance.AddSingleton<EventSystem>();
+				ThreadPoolScheduler threadPoolScheduler = Game.Instance.AddSingleton<ThreadPoolScheduler>();
+				threadPoolScheduler.ThreadCount = 10;
+				
 				ETTask.ExceptionHandler += Log.Error;
 				ETTask.ExceptionHandler += Log.Error;
 				
 				
 				process.AddSingleton<TimeInfo>();
 				process.AddSingleton<TimeInfo>();
 				process.AddSingleton<ObjectPool>();
 				process.AddSingleton<ObjectPool>();
 				process.AddSingleton<IdGenerater>();
 				process.AddSingleton<IdGenerater>();
-				process.AddSingleton<EventSystem>();
+				
 				process.AddSingleton<TimerComponent>();
 				process.AddSingleton<TimerComponent>();
 				process.AddSingleton<CoroutineLockComponent>();
 				process.AddSingleton<CoroutineLockComponent>();
 				
 				

+ 14 - 14
Share/Tool/Init.cs

@@ -22,26 +22,26 @@ namespace ET.Server
                     .WithParsed(Game.Instance.AddSingleton);
                     .WithParsed(Game.Instance.AddSingleton);
                 Game.Instance.AddSingleton<Logger>().ILog = new NLogger(Options.Instance.AppType.ToString(), Options.Instance.Process, "../Config/NLog/NLog.config");
                 Game.Instance.AddSingleton<Logger>().ILog = new NLogger(Options.Instance.AppType.ToString(), Options.Instance.Process, "../Config/NLog/NLog.config");
                 
                 
-                Process process = Game.Instance.Create();
+                //Process process = Game.Instance.Create();
                 // 异步方法全部会回掉到主线程
                 // 异步方法全部会回掉到主线程
-                process.AddSingleton<MainThreadSynchronizationContext>();
-                process.AddSingleton<TimeInfo>();
-                process.AddSingleton<ObjectPool>();
-                process.AddSingleton<IdGenerater>();
+                //process.AddSingleton<MainThreadSynchronizationContext>();
+                //process.AddSingleton<TimeInfo>();
+                //process.AddSingleton<ObjectPool>();
+                //process.AddSingleton<IdGenerater>();
                 
                 
                 ETTask.ExceptionHandler += Log.Error;
                 ETTask.ExceptionHandler += Log.Error;
                 
                 
-                process.AddSingleton<EventSystem>();
-                Dictionary<string, Type> types = AssemblyHelper.GetAssemblyTypes(typeof (Process).Assembly);
-                EventSystem.Instance.Add(types);
+                //process.AddSingleton<EventSystem>();
+                //Dictionary<string, Type> types = AssemblyHelper.GetAssemblyTypes(typeof (Process).Assembly);
+                //EventSystem.Instance.Add(types);
+//
+                //process.AddSingleton<EntitySystemSingleton>();
+                //
+                //process.AddSingleton<Root>();
 
 
-                process.AddSingleton<EntitySystemSingleton>();
-                
-                process.AddSingleton<Root>();
-
-                MongoHelper.Register();
+                //MongoHelper.Register();
 				
 				
-                Log.Info($"server start........................ {Root.Instance.Scene.Id}");
+                Log.Info($"server start........................ ");
 				
 				
                 switch (Options.Instance.AppType)
                 switch (Options.Instance.AppType)
                 {
                 {

+ 38 - 28
Unity/Assets/Scripts/Core/Game/Game.cs

@@ -45,7 +45,7 @@ namespace ET
         private readonly Queue<ISingleton> schedulers = new();
         private readonly Queue<ISingleton> schedulers = new();
 
 
         private readonly Dictionary<int, Process> processes = new();
         private readonly Dictionary<int, Process> processes = new();
-
+        
         private int idGenerator;
         private int idGenerator;
 
 
         private Thread thread;
         private Thread thread;
@@ -74,6 +74,15 @@ namespace ET
             }
             }
         }
         }
 
 
+        public Process Get(int id)
+        {
+            lock (this)
+            {
+                this.processes.TryGetValue(id, out Process process);
+                return process;
+            }
+        }
+
         public void Start()
         public void Start()
         {
         {
             this.thread = new Thread(() =>
             this.thread = new Thread(() =>
@@ -96,8 +105,7 @@ namespace ET
             lock (this)
             lock (this)
             {
             {
                 ISingleton singleton = new T();
                 ISingleton singleton = new T();
-                singleton.Register();
-
+                
                 singletons.Push(singleton);
                 singletons.Push(singleton);
 
 
                 if (singleton is ISingletonAwake awake)
                 if (singleton is ISingletonAwake awake)
@@ -125,6 +133,7 @@ namespace ET
                     this.schedulers.Enqueue(singleton);
                     this.schedulers.Enqueue(singleton);
                 }
                 }
 
 
+                singleton.Register();
                 return singleton as T;
                 return singleton as T;
             }
             }
         }
         }
@@ -133,8 +142,6 @@ namespace ET
         {
         {
             lock (this)
             lock (this)
             {
             {
-                singleton.Register();
-
                 singletons.Push(singleton);
                 singletons.Push(singleton);
 
 
                 if (singleton is ISingletonAwake awake)
                 if (singleton is ISingletonAwake awake)
@@ -161,6 +168,8 @@ namespace ET
                 {
                 {
                     this.schedulers.Enqueue(singleton);
                     this.schedulers.Enqueue(singleton);
                 }
                 }
+                
+                singleton.Register();
             }
             }
         }
         }
 
 
@@ -230,34 +239,35 @@ namespace ET
 
 
         public void Load()
         public void Load()
         {
         {
-            using Locker _ = new();  // 执行Load需要停止所有的Process执行
-            
-            int count = loads.Count;
-            while (count-- > 0)
+            lock(this)
             {
             {
-                if (!this.loads.TryDequeue(out ISingleton singleton))
+                int count = loads.Count;
+                while (count-- > 0)
                 {
                 {
-                    continue;
-                }
+                    if (!this.loads.TryDequeue(out ISingleton singleton))
+                    {
+                        continue;
+                    }
 
 
-                if (singleton.IsDisposed())
-                {
-                    continue;
-                }
+                    if (singleton.IsDisposed())
+                    {
+                        continue;
+                    }
 
 
-                if (singleton is not ISingletonLoad load)
-                {
-                    continue;
-                }
+                    if (singleton is not ISingletonLoad load)
+                    {
+                        continue;
+                    }
 
 
-                loads.Enqueue(singleton);
-                try
-                {
-                    load.Load();
-                }
-                catch (Exception e)
-                {
-                    Log.Error(e);
+                    loads.Enqueue(singleton);
+                    try
+                    {
+                        load.Load();
+                    }
+                    catch (Exception e)
+                    {
+                        Log.Error(e);
+                    }
                 }
                 }
             }
             }
         }
         }

+ 16 - 29
Unity/Assets/Scripts/Core/Game/Module/Config/ConfigComponent.cs

@@ -1,4 +1,5 @@
 using System;
 using System;
+using System.Collections.Concurrent;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 
 
@@ -18,40 +19,25 @@ namespace ET
             public string ConfigName;
             public string ConfigName;
         }
         }
 		
 		
-        private readonly Dictionary<Type, object> allConfig = new();
+        private readonly ConcurrentDictionary<Type, ISingleton> allConfig = new();
 
 
-		public override void Dispose()
+		public void ReloadOneConfig(string configName)
 		{
 		{
-		}
-
-		public T GetOneConfig<T>() where T: class
-		{
-			Type configType = typeof (T);
-			lock (this)
-			{
-				if (this.allConfig.TryGetValue(configType, out object oneConfig))
-				{
-					return oneConfig as T;
-				}
-				
-				byte[] oneConfigBytes =
-						EventSystem.Instance.Invoke<GetOneConfigBytes, byte[]>(new GetOneConfigBytes() { ConfigName = configType.FullName });
-
-				object category = MongoHelper.Deserialize(configType, oneConfigBytes, 0, oneConfigBytes.Length);
-				ISingleton singleton = category as ISingleton;
-				singleton.Register();
+			Type configType = EventSystem.Instance.GetType(configName);
+			
+			byte[] oneConfigBytes =
+					EventSystem.Instance.Invoke<GetOneConfigBytes, byte[]>(new GetOneConfigBytes() { ConfigName = configType.FullName });
 
 
-				this.allConfig[configType] = singleton;
-				return category as T;
-			}
+			object category = MongoHelper.Deserialize(configType, oneConfigBytes, 0, oneConfigBytes.Length);
+			ISingleton singleton = category as ISingleton;
+			this.allConfig[configType] = singleton;
+			
+			singleton.Register();
 		}
 		}
 
 
 		public void RemoveOneConfig(Type configType)
 		public void RemoveOneConfig(Type configType)
 		{
 		{
-			lock (this)
-			{
-				this.allConfig.Remove(configType);
-			}
+			this.allConfig.Remove(configType, out _);
 		}
 		}
 		
 		
 		// 程序开始的时候调用,不加锁
 		// 程序开始的时候调用,不加锁
@@ -92,9 +78,10 @@ namespace ET
 			lock (this)
 			lock (this)
 			{
 			{
 				ISingleton singleton = category as ISingleton;
 				ISingleton singleton = category as ISingleton;
-				singleton.Register();
 				this.allConfig[configType] = singleton;
 				this.allConfig[configType] = singleton;
+				
+				singleton.Register();
 			}
 			}
 		}
 		}
-	}
+    }
 }
 }

+ 8 - 6
Unity/Assets/Scripts/Core/Game/Module/Config/ConfigSingleton.cs

@@ -1,15 +1,17 @@
 using System;
 using System;
+using System.ComponentModel;
 
 
 namespace ET
 namespace ET
 {
 {
-    public abstract class ConfigSingleton<T>: ProtoObject where T: ConfigSingleton<T>, new()
+    public abstract class ConfigSingleton<T>: Singleton<T>, ISupportInitialize where T: ConfigSingleton<T>, new()
     {
     {
-        public static T Instance
+        public virtual void BeginInit()
+        {
+        }
+        
+        
+        public virtual void EndInit()
         {
         {
-            get
-            {
-                return ConfigComponent.Instance.GetOneConfig<T>();
-            }
         }
         }
     }
     }
 }
 }

+ 1 - 1
Unity/Assets/Scripts/Core/Game/Module/EventSystem/EventSystem.cs

@@ -3,7 +3,7 @@ using System.Collections.Generic;
 
 
 namespace ET
 namespace ET
 {
 {
-    public class EventSystem: ProcessSingleton<EventSystem>
+    public class EventSystem: Singleton<EventSystem>
     {
     {
         private class EventInfo
         private class EventInfo
         {
         {

+ 8 - 6
Unity/Assets/Scripts/Core/Game/Module/GameActor/GameActor.cs

@@ -59,19 +59,21 @@ namespace ET
             queue.Enqueue(messageObject);
             queue.Enqueue(messageObject);
         }
         }
         
         
-        public MessageObject Fetch(int processId)
+        public void Fetch(int processId, int count, List<MessageObject> list)
         {
         {
             if (!this.messages.TryGetValue(processId, out var queue))
             if (!this.messages.TryGetValue(processId, out var queue))
             {
             {
-                return null;
+                return;
             }
             }
 
 
-            if (!queue.TryDequeue(out var message))
+            for (int i = 0; i < count; ++i)
             {
             {
-                return null;
+                if (!queue.TryDequeue(out var message))
+                {
+                    break;
+                }
+                list.Add(message);
             }
             }
-
-            return message;
         }
         }
 
 
         public void AddActor(int processId)
         public void AddActor(int processId)

+ 3 - 12
Unity/Assets/Scripts/Core/Game/Module/ProcessScheduler/ThreadPoolScheduler.cs

@@ -13,8 +13,6 @@ namespace ET
         
         
         public int ThreadCount { get; set; }
         public int ThreadCount { get; set; }
 
 
-        private readonly ConcurrentDictionary<int, Process> dictionary = new();
-
         private readonly ConcurrentQueue<int> idQueue = new();
         private readonly ConcurrentQueue<int> idQueue = new();
 
 
         public void StartScheduler()
         public void StartScheduler()
@@ -43,7 +41,8 @@ namespace ET
                         continue;
                         continue;
                     }
                     }
 
 
-                    if (!this.dictionary.TryGetValue(id, out Process process))
+                    Process process = Game.Instance.Get(id);
+                    if (process == null)
                     {
                     {
                         Thread.Sleep(1);
                         Thread.Sleep(1);
                         continue;
                         continue;
@@ -77,21 +76,13 @@ namespace ET
 
 
         public void Add(Process process)
         public void Add(Process process)
         {
         {
-            int id = 0;
             lock (Game.Instance)
             lock (Game.Instance)
             {
             {
-                id = process.Id;
+                int id = process.Id;
                 if (id == 0)
                 if (id == 0)
                 {
                 {
                     return;
                     return;
                 }
                 }
-                
-                if (this.dictionary.ContainsKey(id))
-                {
-                    return;
-                }
-
-                this.dictionary[id] = process;
                 this.idQueue.Enqueue(id);
                 this.idQueue.Enqueue(id);
             }
             }
         }
         }

+ 60 - 0
Unity/Assets/Scripts/Core/Game/Module/ProcessScheduler/ThreadScheduler.cs

@@ -0,0 +1,60 @@
+using System;
+using System.Collections.Concurrent;
+using System.Collections.Generic;
+using System.Threading;
+
+namespace ET
+{
+    // 一个Process一个固定的线程
+    public class ThreadScheduler: Singleton<ThreadScheduler>, ISingletonScheduler
+    {
+        private bool isStart;
+        
+        private readonly ConcurrentDictionary<Process, Thread> dictionary = new();
+
+        public void StartScheduler()
+        {
+            this.isStart = true;
+        }
+
+        private void Loop(Process process)
+        {
+            while (this.isStart)
+            {
+                try
+                {
+                    process.LoopOnce();
+                    
+                    Thread.Sleep(1);
+                }
+                catch (Exception e)
+                {
+                    Log.Error(e);
+                }
+            }
+        }
+
+        public void StopScheduler()
+        {
+            this.isStart = false;
+            foreach (var kv in this.dictionary)
+            {
+                kv.Value.Join();
+            }
+        }
+
+        public void Add(Process process)
+        {
+            lock (Game.Instance)
+            {
+                if (process.Id == 0)
+                {
+                    return;
+                }
+
+                Thread thread = new(()=>this.Loop(process));
+                thread.Start();
+            }
+        }
+    }
+}

+ 1 - 1
Unity/Assets/Scripts/Loader/UnityScheduler.cs.meta → Unity/Assets/Scripts/Core/Game/Module/ProcessScheduler/ThreadScheduler.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
 fileFormatVersion: 2
-guid: e6b7b7ad555485d43855104539376d94
+guid: be7f088b694f6e14fbb523ab58ae904d
 MonoImporter:
 MonoImporter:
   externalObjects: {}
   externalObjects: {}
   serializedVersion: 2
   serializedVersion: 2

+ 71 - 13
Unity/Assets/Scripts/Core/Game/Singleton.cs

@@ -1,4 +1,5 @@
 using System;
 using System;
+using System.Threading;
 
 
 namespace ET
 namespace ET
 {
 {
@@ -12,42 +13,99 @@ namespace ET
     public abstract class Singleton<T>: ISingleton where T: Singleton<T>, new()
     public abstract class Singleton<T>: ISingleton where T: Singleton<T>, new()
     {
     {
         private bool isDisposed;
         private bool isDisposed;
+
+        [StaticField]
+        private static SpinLock spinLock;
         
         
         [StaticField]
         [StaticField]
         private static T instance;
         private static T instance;
 
 
+        // 自旋锁保证线程安全
         public static T Instance
         public static T Instance
         {
         {
             get
             get
             {
             {
-                return instance;
+                bool lockTaken = false;
+                try
+                {
+                    spinLock.Enter(ref lockTaken);
+                    return instance;
+                }
+                finally
+                {
+                    if (lockTaken)
+                    {
+                        spinLock.Exit();
+                    }
+                }
+            }
+            set
+            {
+                bool lockTaken = false;
+                try
+                {
+                    spinLock.Enter(ref lockTaken);
+                    instance = value;
+                }
+                finally
+                {
+                    if (lockTaken)
+                    {
+                        spinLock.Exit();
+                    }
+                }
             }
             }
         }
         }
 
 
         void ISingleton.Register()
         void ISingleton.Register()
         {
         {
-            if (instance != null)
-            {
-                throw new Exception($"singleton register twice! {typeof (T).Name}");
-            }
-            instance = (T)this;
+            Instance = (T)this;
         }
         }
 
 
         void ISingleton.Destroy()
         void ISingleton.Destroy()
         {
         {
-            if (this.isDisposed)
+            bool lockTaken = false;
+            try
             {
             {
-                return;
+                spinLock.Enter(ref lockTaken);
+                
+                if (this.isDisposed)
+                {
+                    return;
+                }
+                this.isDisposed = true;
+                
+                T t = instance;
+                instance = null;
+                t.Dispose();
+            }
+            finally
+            {
+                if (lockTaken)
+                {
+                    spinLock.Exit();
+                }
             }
             }
-            this.isDisposed = true;
-            
-            instance.Dispose();
-            instance = null;
         }
         }
 
 
         bool ISingleton.IsDisposed()
         bool ISingleton.IsDisposed()
         {
         {
-            return this.isDisposed;
+            bool lockTaken = false;
+            try
+            {
+                spinLock.Enter(ref lockTaken);
+                
+                return this.isDisposed;
+            }
+            finally
+            {
+                if (lockTaken)
+                {
+                    spinLock.Exit();
+                }
+            }
+            
+            
         }
         }
 
 
         public virtual void Dispose()
         public virtual void Dispose()

+ 7 - 8
Unity/Assets/Scripts/Core/Process/Module/ProcessActor/ProcessActor.cs

@@ -5,7 +5,9 @@ namespace ET
     public class ProcessActor: ProcessSingleton<ProcessActor>, IProcessSingletonUpdate, IProcessSingletonAwake
     public class ProcessActor: ProcessSingleton<ProcessActor>, IProcessSingletonUpdate, IProcessSingletonAwake
     {
     {
         private readonly Dictionary<int, ETTask<IResponse>> requestCallbacks = new();
         private readonly Dictionary<int, ETTask<IResponse>> requestCallbacks = new();
-        
+
+        private readonly List<MessageObject> list = new();
+
         private int rpcId;
         private int rpcId;
         
         
         public void Awake()
         public void Awake()
@@ -20,14 +22,11 @@ namespace ET
 
 
         public void Update()
         public void Update()
         {
         {
-            while (true)
+            this.list.Clear();
+            GameActor.Instance.Fetch(this.Process.Id, 1000, this.list);
+            foreach (MessageObject messageObject in this.list)
             {
             {
-                MessageObject messageObject = GameActor.Instance.Fetch(this.Process.Id);
-                if (messageObject == null)
-                {
-                    return;
-                }
-                this.HandleMessage(messageObject);
+                this.HandleMessage(messageObject);    
             }
             }
         }
         }
         
         

+ 2 - 0
Unity/Assets/Scripts/Core/Process/Process.cs

@@ -26,6 +26,8 @@ namespace ET
         private readonly Queue<IProcessSingleton> loads = new();
         private readonly Queue<IProcessSingleton> loads = new();
 
 
         private readonly Queue<ETTask> frameFinishTask = new();
         private readonly Queue<ETTask> frameFinishTask = new();
+        
+        private ThreadSynchronizationContext ThreadSynchronizationContext = new();
 
 
         private void Register()
         private void Register()
         {
         {

+ 11 - 17
Unity/Assets/Scripts/Loader/MonoBehaviour/Init.cs

@@ -1,5 +1,6 @@
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
+using System.Threading;
 using CommandLine;
 using CommandLine;
 using UnityEngine;
 using UnityEngine;
 
 
@@ -9,11 +10,9 @@ namespace ET
 	{
 	{
 		public static Init Instance { get; private set; }
 		public static Init Instance { get; private set; }
 
 
-		public ThreadSynchronizationContext ThreadSynchronizationContext = new();
-
 		public bool IsStart;
 		public bool IsStart;
-		
-		public Process Process;
+
+		private Process process;
 		
 		
 		private void Start()
 		private void Start()
 		{
 		{
@@ -32,9 +31,12 @@ namespace ET
 				.WithNotParsed(error => throw new Exception($"命令行格式错误! {error}"))
 				.WithNotParsed(error => throw new Exception($"命令行格式错误! {error}"))
 				.WithParsed(Game.Instance.AddSingleton);
 				.WithParsed(Game.Instance.AddSingleton);
 			Game.Instance.AddSingleton<Logger>().ILog = new UnityLogger();
 			Game.Instance.AddSingleton<Logger>().ILog = new UnityLogger();
-			Game.Instance.AddSingleton<UnityScheduler>();
+			Game.Instance.AddSingleton<EventSystem>();
+			Game.Instance.AddSingleton<ThreadScheduler>();
+			
+			ETTask.ExceptionHandler += Log.Error;
 			
 			
-			Process process = Game.Instance.Create();
+			process = Game.Instance.Create();
 			
 			
 			process.AddSingleton<MainThreadSynchronizationContext>();
 			process.AddSingleton<MainThreadSynchronizationContext>();
 
 
@@ -45,33 +47,25 @@ namespace ET
 			process.AddSingleton<TimeInfo>();
 			process.AddSingleton<TimeInfo>();
 			process.AddSingleton<ObjectPool>();
 			process.AddSingleton<ObjectPool>();
 			process.AddSingleton<IdGenerater>();
 			process.AddSingleton<IdGenerater>();
-			process.AddSingleton<EventSystem>();
 			process.AddSingleton<TimerComponent>();
 			process.AddSingleton<TimerComponent>();
 			process.AddSingleton<CoroutineLockComponent>();
 			process.AddSingleton<CoroutineLockComponent>();
-			
-			UnityScheduler.Instance.Add(process);
-
-			ETTask.ExceptionHandler += Log.Error;
-
 			process.AddSingleton<CodeLoader>().Start();
 			process.AddSingleton<CodeLoader>().Start();
 		}
 		}
 
 
 		private void Update()
 		private void Update()
 		{
 		{
-			this.ThreadSynchronizationContext.Update();
-
 			if (!this.IsStart)
 			if (!this.IsStart)
 			{
 			{
 				return;
 				return;
 			}
 			}
 			
 			
-			this.Process.Update();
+			this.process.Update();
 		}
 		}
 
 
 		private void LateUpdate()
 		private void LateUpdate()
 		{
 		{
-			this.Process.LateUpdate();
-			this.Process.FrameFinishUpdate();
+			this.process.LateUpdate();
+			this.process.FrameFinishUpdate();
 		}
 		}
 
 
 		private void OnApplicationQuit()
 		private void OnApplicationQuit()

+ 0 - 39
Unity/Assets/Scripts/Loader/UnityScheduler.cs

@@ -1,39 +0,0 @@
-using System.Collections.Generic;
-
-namespace ET
-{
-    public class UnityScheduler: Singleton<UnityScheduler>, ISingletonScheduler
-    {
-        public bool IsStart;
-
-        private Process process;
-
-        public void StartScheduler()
-        {
-            Init.Instance.IsStart = true;
-        }
-
-        public void StopScheduler()
-        {
-            Init.Instance.ThreadSynchronizationContext.Post(() => { Init.Instance.IsStart = false; });
-            
-            // Process Loop完成
-            while (true)
-            {
-                if (process.IsRuning)
-                {
-                    break;
-                }
-            }
-        }
-
-        public void Add(Process process)
-        {
-            lock (Game.Instance)
-            {
-                this.process = process;
-                Init.Instance.ThreadSynchronizationContext.Post(() => { Init.Instance.Process = process; });
-            }
-        }
-    }
-}

+ 1 - 1
Unity/Assets/Scripts/Model/Share/Entry.cs

@@ -37,7 +37,7 @@ namespace ET
             MongoHelper.RegisterStruct<LSInput>();
             MongoHelper.RegisterStruct<LSInput>();
             MongoHelper.Register();
             MongoHelper.Register();
             
             
-            Process process = EventSystem.Instance.Process;
+            Process process = CoroutineLockComponent.Instance.Process;
             process.AddSingleton<EntitySystemSingleton>();
             process.AddSingleton<EntitySystemSingleton>();
             process.AddSingleton<LSEntitySystemSington>();
             process.AddSingleton<LSEntitySystemSington>();