- [Core] Fix bug with assets parsing.

This commit is contained in:
Razmoth
2023-11-24 21:17:13 +04:00
parent 2568e4be08
commit 4c0f1ec44b
45 changed files with 725 additions and 672 deletions

View File

@@ -22,44 +22,44 @@ namespace AssetStudio
public class UnityPropertySheet
{
public KeyValuePair<string, UnityTexEnv>[] m_TexEnvs;
public KeyValuePair<string, int>[] m_Ints;
public KeyValuePair<string, float>[] m_Floats;
public KeyValuePair<string, Color>[] m_Colors;
public List<KeyValuePair<string, UnityTexEnv>> m_TexEnvs;
public List<KeyValuePair<string, int>> m_Ints;
public List<KeyValuePair<string, float>> m_Floats;
public List<KeyValuePair<string, Color>> m_Colors;
public UnityPropertySheet(ObjectReader reader)
{
var version = reader.version;
int m_TexEnvsSize = reader.ReadInt32();
m_TexEnvs = new KeyValuePair<string, UnityTexEnv>[m_TexEnvsSize];
m_TexEnvs = new List<KeyValuePair<string, UnityTexEnv>>();
for (int i = 0; i < m_TexEnvsSize; i++)
{
m_TexEnvs[i] = new(reader.ReadAlignedString(), new UnityTexEnv(reader));
m_TexEnvs.Add(new(reader.ReadAlignedString(), new UnityTexEnv(reader)));
}
if (version[0] >= 2021) //2021.1 and up
{
int m_IntsSize = reader.ReadInt32();
m_Ints = new KeyValuePair<string, int>[m_IntsSize];
m_Ints = new List<KeyValuePair<string, int>>();
for (int i = 0; i < m_IntsSize; i++)
{
m_Ints[i] = new(reader.ReadAlignedString(), reader.ReadInt32());
m_Ints.Add(new(reader.ReadAlignedString(), reader.ReadInt32()));
}
}
int m_FloatsSize = reader.ReadInt32();
m_Floats = new KeyValuePair<string, float>[m_FloatsSize];
m_Floats = new List<KeyValuePair<string, float>>();
for (int i = 0; i < m_FloatsSize; i++)
{
m_Floats[i] = new(reader.ReadAlignedString(), reader.ReadSingle());
m_Floats.Add(new(reader.ReadAlignedString(), reader.ReadSingle()));
}
int m_ColorsSize = reader.ReadInt32();
m_Colors = new KeyValuePair<string, Color>[m_ColorsSize];
m_Colors = new List<KeyValuePair<string, Color>>();
for (int i = 0; i < m_ColorsSize; i++)
{
m_Colors[i] = new(reader.ReadAlignedString(), reader.ReadColor4());
m_Colors.Add(new(reader.ReadAlignedString(), reader.ReadColor4()));
}
}
}