Explorar el Código

客户端资源加载修改

tanghai hace 3 años
padre
commit
b8b316cb26

+ 1 - 3
Codes/ModelView/Client/Demo/Config/ConfigLoader.cs

@@ -14,12 +14,10 @@ namespace ET.Client
                 const string configBundleName = "config.unity3d";
                 ResourcesComponent.Instance.LoadBundle(configBundleName);
                 
-                Dictionary<string, UnityEngine.Object> keys = ResourcesComponent.Instance.GetBundleAll(configBundleName);
-
                 HashSet<Type> configTypes = Game.EventSystem.GetTypes(typeof (ConfigAttribute));
                 foreach (Type configType in configTypes)
                 {
-                    TextAsset v = keys[configType.Name] as TextAsset;
+                    TextAsset v = ResourcesComponent.Instance.GetAsset(configBundleName, configType.Name) as TextAsset;
                     output[configType.Name] = v.bytes;
                 }
             }

+ 0 - 11
Codes/ModelView/Client/Module/Resource/ResourcesComponent.cs

@@ -216,17 +216,6 @@ namespace ET.Client
             return self.bundles.ContainsKey(bundleName);
         }
 
-        public static Dictionary<string, UnityEngine.Object> GetBundleAll(this ResourcesComponent self, string bundleName)
-        {
-            Dictionary<string, UnityEngine.Object> dict;
-            if (!self.resourceCache.TryGetValue(bundleName.BundleNameToLower(), out dict))
-            {
-                throw new Exception($"not found asset: {bundleName}");
-            }
-
-            return dict;
-        }
-
         public static UnityEngine.Object GetAsset(this ResourcesComponent self, string bundleName, string prefab)
         {
             Dictionary<string, UnityEngine.Object> dict;

+ 7 - 0
Unity/Assets/Bundles/Config/AIConfigCategory.bytes.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 277d58db3067742a7b32f9994984b3bc
+TextScriptImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 8 - 0
Unity/Assets/Bundles/Config/StartConfig.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: b4a5929ed1616464d8af53eede1db838
+folderAsset: yes
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 8 - 0
Unity/Assets/Bundles/Config/StartConfig/Localhost.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: d15979c0a72d7f94e8d463f0c1af9788
+folderAsset: yes
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 7 - 0
Unity/Assets/Bundles/Config/StartConfig/Localhost/StartMachineConfigCategory.bytes.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: d6a19dec94ad49b4bb4590b0ec870ea9
+TextScriptImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 7 - 0
Unity/Assets/Bundles/Config/StartConfig/Localhost/StartProcessConfigCategory.bytes.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: c3552219078c36349831be9b76a5bed2
+TextScriptImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 7 - 0
Unity/Assets/Bundles/Config/StartConfig/Localhost/StartSceneConfigCategory.bytes.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 0e0b063e760dd85439a5034b9559cb9d
+TextScriptImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 7 - 0
Unity/Assets/Bundles/Config/StartConfig/Localhost/StartZoneConfigCategory.bytes.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 4a2ef77ab3fb8144281a8c92484bfeca
+TextScriptImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 7 - 0
Unity/Assets/Bundles/Config/UnitConfigCategory.bytes.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 3f452063ceb5f4150bbbfe795c0aca90
+TextScriptImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 2 - 1
Unity/Assets/Scripts/Editor/BuildEditor/BuildEditor.cs

@@ -135,8 +135,9 @@ namespace ET
 			
 			if (GUILayout.Button("ExcelExporter"))
 			{
-				Directory.Delete("Assets/Bundles/Config", true);
+				//Directory.Delete("Assets/Bundles/Config", true);
 				ToolsEditor.ExcelExporter();
+				// 如果是ClientServer,那么客户端要使用服务端配置
 				if (this.globalConfig.CodeMode == CodeMode.ClientServer)
 				{
 					FileHelper.CopyDirectory("../Config/StartConfig/Localhost", "Assets/Bundles/Config/StartConfig/Localhost");