(client) fix: 修复Define加载时的逻辑错误(错误从about文件中筛选define,加载文件不再构建完整路径)
This commit is contained in:
@ -616,6 +616,7 @@ GameObject:
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1371068282}
|
||||
- component: {fileID: 1371068283}
|
||||
m_Layer: 0
|
||||
m_Name: Loader
|
||||
m_TagString: Untagged
|
||||
@ -638,6 +639,18 @@ Transform:
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1371068283
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1371068281}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 147e91e6929d90a4fb877c0b0a6b608c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1660057539 &9223372036854775807
|
||||
SceneRoots:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -160,27 +160,25 @@ namespace Configs
|
||||
|
||||
foreach (var path in paths)
|
||||
{
|
||||
// 获取程序所在的目录路径
|
||||
var appDirectory = AppDomain.CurrentDomain.BaseDirectory;
|
||||
|
||||
// 构建目标目录的完整路径
|
||||
var dataDirectory = Path.Combine(appDirectory, path);
|
||||
|
||||
try
|
||||
{
|
||||
// 检查目录是否存在
|
||||
if (Directory.Exists(dataDirectory))
|
||||
if (!Directory.Exists(path))
|
||||
{
|
||||
// 获取目录下的所有子文件夹
|
||||
var subDirectories = Directory.GetDirectories(dataDirectory);
|
||||
|
||||
// 遍历并收集每个子文件夹中的 XML 文件
|
||||
foreach (var dir in subDirectories)
|
||||
{
|
||||
var xmlFiles = Directory.GetFiles(dir, "*.xml", SearchOption.AllDirectories);
|
||||
xmlFilePaths.AddRange(xmlFiles);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// 获取目录下的所有子文件夹
|
||||
var subDirectories = Directory.GetDirectories(path);
|
||||
|
||||
// 遍历并收集每个子文件夹中的 XML 文件
|
||||
foreach (var dir in subDirectories)
|
||||
{
|
||||
var xmlFiles = Directory.GetFiles(dir, "*.xml", SearchOption.AllDirectories);
|
||||
xmlFilePaths.AddRange(xmlFiles);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -123,9 +123,9 @@ namespace Data
|
||||
packID = packAbout.packID;
|
||||
if (aboutXmls.Count > 1) Debug.LogWarning($"{packAbout.name}包拥有多个配置文件,系统选择了加载序的第一个,请避免这种情况");
|
||||
|
||||
var defineXmls = FindDocumentsWithRootName(aboutXmls, "Define");
|
||||
var defineXmls = FindDocumentsWithRootName(packDatas, "Define");
|
||||
// Debug.Log($"Define文件数量{defineXmls.Count}");
|
||||
foreach (var defineXml in defineXmls) LoadDefines(defineXml);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -140,12 +140,15 @@ namespace Data
|
||||
var className = element.Name.ToString();
|
||||
if (string.IsNullOrEmpty(className))
|
||||
continue;
|
||||
// Debug.Log("1");
|
||||
var def = LoadDefineClass(element);
|
||||
if (def == null)
|
||||
continue;
|
||||
// Debug.Log("2");
|
||||
if (!defines.ContainsKey(className))
|
||||
defines.Add(className, new List<Define>());
|
||||
defines[className].Add(def);
|
||||
// Debug.Log($"插入{className},{def.defName}");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@ namespace Test
|
||||
{
|
||||
public class ClockTest : MonoBehaviour
|
||||
{
|
||||
private static float timer = 0;
|
||||
//private static float timer = 0;
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
private void Start()
|
||||
|
Reference in New Issue
Block a user