Update ScenePartitionSO.cs

This commit is contained in:
max 2023-07-30 01:47:12 +02:00
parent 83776072c9
commit ebee93d107

View File

@ -164,14 +164,10 @@ public void Save()
string id = match.Groups[1].Value;
ulong objectId = ulong.Parse(id);
string extraInfo = "";
if (TryGetObjectInfo(in sceneData, in sceneObjectNameById, i, lastIndex, objectId, out string objectInfo))
{
extraInfo = $"-{objectInfo}";
}
GetObjectInfo(in sceneData, in sceneObjectNameById, i, lastIndex, objectId, out string objectInfo);
// Write data to disk.
File.WriteAllLines($"{dataPath}/{SceneName}-{id}{extraInfo}.yaml", sceneData[i..lastIndex]);
File.WriteAllLines($"{dataPath}/{SceneName}-{id}{objectInfo}.yaml", sceneData[i..lastIndex]);
}
lastIndex = i;
@ -489,9 +485,9 @@ private bool TryGetObjectTypeName(string data, out string objectTypeName)
return true;
}
private bool TryGetObjectInfo(in string[] sceneData, in Dictionary<ulong, string> sceneObjectNameById, int index, int lastIndex, ulong objectId, out string objectInfo)
private void GetObjectInfo(in string[] sceneData, in Dictionary<ulong, string> sceneObjectNameById, int index, int lastIndex, ulong objectId, out string objectInfo)
{
using ProfilerUtility.ProfilerScope profilerScope = new(nameof(TryGetObjectInfo));
using ProfilerUtility.ProfilerScope profilerScope = new(nameof(GetObjectInfo));
objectInfo = "";
@ -560,16 +556,11 @@ private bool TryGetObjectInfo(in string[] sceneData, in Dictionary<ulong, string
}
}
bool foundObjectTypeName = false;
// Try get object type name.
if (TryGetObjectTypeName(sceneData[index + 1], out string objectTypeName))
{
objectInfo += $"-{objectTypeName}";
foundObjectTypeName = true;
}
return foundSceneObjectName || foundObjectTypeName;
}
}
}