ソースを参照

修复序列化LSInput报错的bug

tanghai 2 年 前
コミット
32836b8ad3

+ 1 - 4
Unity/Assets/Scripts/Core/Serialize/MongoHelper.cs

@@ -119,10 +119,7 @@ namespace ET
 
         public static void RegisterStruct<T>() where T : struct
         {
-            if (BsonSerializer.LookupSerializer(typeof (T)) == null)
-            {
-                BsonSerializer.RegisterSerializer(typeof (T), new StructBsonSerialize<T>());
-            }
+            BsonSerializer.RegisterSerializer(typeof (T), new StructBsonSerialize<T>());
         }
 
         public static string ToJson(object obj)

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

@@ -29,13 +29,29 @@ namespace ET
         {
             StartAsync().Coroutine();
         }
+
+        private static async ETTask Test1()
+        {
+            using (await CoroutineLockComponent.Instance.Wait(CoroutineLockType.DB, 1, 2000))
+            {
+                await TimerComponent.Instance.WaitAsync(100000);
+            }
+        }
+        
+        private static async ETTask Test2()
+        {
+            using (await CoroutineLockComponent.Instance.Wait(CoroutineLockType.DB, 1, 10000))
+            {
+                await TimerComponent.Instance.WaitAsync(100000);
+            }
+        }
         
         private static async ETTask StartAsync()
         {
             WinPeriod.Init();
             
-            MongoHelper.Register();
             MongoHelper.RegisterStruct<LSInput>();
+            MongoHelper.Register();
             
             Game.AddSingleton<EntitySystemSingleton>();
             Game.AddSingleton<LSEntitySystemSington>();