From 1aeb815836d84ecfddf761a47862efebbba0ad03 Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期二, 12 二月 2019 21:55:16 +0800
Subject: [PATCH] 3335 配置表读取重构。

---
 Core/GameEngine/Model/ConfigManager.cs |   53 +++++------------------------------------------------
 1 files changed, 5 insertions(+), 48 deletions(-)

diff --git a/Core/GameEngine/Model/ConfigManager.cs b/Core/GameEngine/Model/ConfigManager.cs
index 83344de..f54bcfd 100644
--- a/Core/GameEngine/Model/ConfigManager.cs
+++ b/Core/GameEngine/Model/ConfigManager.cs
@@ -236,7 +236,7 @@
         AddAsyncTask<FestivalRedpackTaskConfig>();
         AddAsyncTask<HolidayHomingConfig>();
         AddAsyncTask<HolidayHomingPointConfig>();
-       
+
         while (!AllCompleted())
         {
             var completedCount = 0;
@@ -479,25 +479,14 @@
                     var container = _task.container as Dictionary<string, ConfigBase>;
                     for (int i = 3; i < _task.contentLines.Length; i++)
                     {
-                        var contents = _task.contentLines[i].Split(new string[] { "\t" }, StringSplitOptions.None);
-                        if (contents.Length <= 1)
-                        {
-                            continue;
-                        }
-
                         var newConfig = new T();
-                        newConfig.SetRawContent(contents);
-
-                        newConfig.Parse();
-                        newConfig.PostProcess();
+                        newConfig.Parse(_task.contentLines[i]);
                         if (newConfig is IConfigPostProcess)
                         {
                             (newConfig as IConfigPostProcess).OnConfigParseCompleted();
                         }
 
-                        newConfig.parsed = true;
-                        container[contents[0]] = newConfig;
-
+                        container[newConfig.getKey()] = newConfig;
                         count++;
                         if (count >= 500)
                         {
@@ -586,26 +575,15 @@
         {
             for (int i = 3; i < _task.contentLines.Length; i++)
             {
-                var contents = _task.contentLines[i].Split(new string[] { "\t" }, StringSplitOptions.None);
-                if (contents.Length <= 1)
-                {
-                    continue;
-                }
-
                 var newConfig = new T();
-                newConfig.SetRawContent(contents);
-
-                newConfig.Parse();
-                newConfig.PostProcess();
+                newConfig.Parse(_task.contentLines[i]);
 
                 if (newConfig is IConfigPostProcess)
                 {
                     (newConfig as IConfigPostProcess).OnConfigParseCompleted();
                 }
 
-                newConfig.parsed = true;
-
-                _task.container[contents[0]] = newConfig;
+                _task.container[newConfig.getKey()] = newConfig;
             }
         }
         catch (Exception ex)
@@ -643,13 +621,6 @@
         else
         {
             config = dic[_dwTemplateID];
-        }
-
-        if (config != null && !config.parsed)
-        {
-            config.Parse();
-            config.PostProcess();
-            config.parsed = true;
         }
 
         return config as T;
@@ -708,13 +679,6 @@
         var dicTemplate = configDictionary[token];
         foreach (var value in dicTemplate.Values)
         {
-            if (value != null && !value.parsed)
-            {
-                value.Parse();
-                value.PostProcess();
-                value.parsed = true;
-            }
-
             configs.Add(value as T);
         }
 
@@ -752,13 +716,6 @@
         ReadFileFailure = 3,
         ParseFailure = 4,
         ParseSuccess = 5,
-    }
-
-    public enum AssetPath
-    {
-        Resource,
-        ResourceOut,
-        External,
     }
 
     private void OnApplicationOut()

--
Gitblit v1.8.0