فهرست منبع

修复序列化LSInput报错的bug

tanghai 2 سال پیش
والد
کامیت
32836b8ad3
2فایلهای تغییر یافته به همراه18 افزوده شده و 5 حذف شده
  1. 1 4
      Unity/Assets/Scripts/Core/Serialize/MongoHelper.cs
  2. 17 1
      Unity/Assets/Scripts/Model/Share/Entry.cs

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

@@ -119,10 +119,7 @@ namespace ET
 
 
         public static void RegisterStruct<T>() where T : struct
         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)
         public static string ToJson(object obj)

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

@@ -29,13 +29,29 @@ namespace ET
         {
         {
             StartAsync().Coroutine();
             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()
         private static async ETTask StartAsync()
         {
         {
             WinPeriod.Init();
             WinPeriod.Init();
             
             
-            MongoHelper.Register();
             MongoHelper.RegisterStruct<LSInput>();
             MongoHelper.RegisterStruct<LSInput>();
+            MongoHelper.Register();
             
             
             Game.AddSingleton<EntitySystemSingleton>();
             Game.AddSingleton<EntitySystemSingleton>();
             Game.AddSingleton<LSEntitySystemSington>();
             Game.AddSingleton<LSEntitySystemSington>();