Skip to content

Commit b0e668f

Browse files
committed
AssetManager conflict fix
1 parent c40d5a8 commit b0e668f

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

Assets/MapEditor/Managers/AssetManager.cs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public static class AssetManager
1010

1111
public const string ManifestPath = "assets/manifest.asset";
1212
public const string AssetDumpPath = "AssetDump.txt";
13-
public const string MaterialsList = "MaterialsList.txt";
13+
public const string MaterialsListPath = "MaterialsList.txt";
1414

1515
public static AssetBundleManifest AssetManifest { get; private set; }
1616

@@ -21,6 +21,8 @@ public static class AssetManager
2121
public static Dictionary<string, AssetBundle> AssetPaths { get; private set; } = new Dictionary<string, AssetBundle>(System.StringComparer.OrdinalIgnoreCase);
2222
public static Dictionary<string, Object> Cache { get; private set; } = new Dictionary<string, Object>();
2323

24+
public static List<string> ManifestStrings { get => IsInitialised ? GetManifestStrings() : new List<string>(); private set => ManifestStrings = value; }
25+
2426
public static bool IsInitialised { get; private set; }
2527

2628
/// <summary>Loads the prefabs from the Rust prefab bundle.</summary>
@@ -105,9 +107,7 @@ public static void Initialise(string bundlesRoot)
105107

106108
private static T GetAsset<T>(string filePath) where T : Object
107109
{
108-
AssetBundle bundle = null;
109-
110-
if (!AssetPaths.TryGetValue(filePath, out bundle))
110+
if (!AssetPaths.TryGetValue(filePath, out AssetBundle bundle))
111111
return null;
112112

113113
return bundle.LoadAsset<T>(filePath);
@@ -185,8 +185,7 @@ public static string ToPath(uint i)
185185
{
186186
if ((int)i == 0)
187187
return i.ToString();
188-
string str;
189-
if (IDLookup.TryGetValue(i, out str))
188+
if (IDLookup.TryGetValue(i, out string str))
190189
return str;
191190
return i.ToString();
192191
}
@@ -195,8 +194,7 @@ public static uint ToID(string str)
195194
{
196195
if (string.IsNullOrEmpty(str))
197196
return 0;
198-
uint num;
199-
if (PathLookup.TryGetValue(str, out num))
197+
if (PathLookup.TryGetValue(str, out uint num))
200198
return num;
201199
return 0;
202200
}
@@ -208,13 +206,13 @@ public static void FixMaterials()
208206
Shader std = Shader.Find("Standard");
209207
Shader spc = Shader.Find("Standard (Specular setup)");
210208

211-
if (File.Exists(MaterialsList))
209+
if (File.Exists(MaterialsListPath))
212210
{
213-
foreach (var item in File.ReadAllLines(MaterialsList))
211+
foreach (var item in File.ReadAllLines(MaterialsListPath))
214212
{
215213
var lineSplit = item.Split(':');
216-
lineSplit[0] = lineSplit[0].Trim(' ');
217-
lineSplit[1] = lineSplit[1].Trim(' ');
214+
lineSplit[0] = lineSplit[0].Trim(' '); // Shader Name
215+
lineSplit[1] = lineSplit[1].Trim(' '); // Material Path
218216
switch (lineSplit[0])
219217
{
220218
case "Standard":

0 commit comments

Comments
 (0)