Просмотр исходного кода

修复一个同步加载配置的bug

tanghai 3 лет назад
Родитель
Сommit
995207a646
1 измененных файлов с 3 добавлено и 6 удалено
  1. 3 6
      Unity/Assets/Scripts/Core/Module/Config/ConfigComponent.cs

+ 3 - 6
Unity/Assets/Scripts/Core/Module/Config/ConfigComponent.cs

@@ -73,11 +73,6 @@ namespace ET
 			}
 
 			await Task.WhenAll(listTasks.ToArray());
-
-			foreach (ISingleton category in this.allConfig.Values)
-			{
-				category.Register();
-			}
 		}
 		
 		private void LoadOneInThread(Type configType, byte[] oneConfigBytes)
@@ -86,7 +81,9 @@ namespace ET
 			
 			lock (this)
 			{
-				this.allConfig[configType] = category as ISingleton;	
+				ISingleton singleton = category as ISingleton;
+				singleton.Register();
+				this.allConfig[configType] = singleton;
 			}
 		}
 	}