Merge GetTexturePath implementations
This commit is contained in:
parent
be205897bb
commit
85599b4069
|
@ -133,28 +133,32 @@ public class ResourcePathManager
|
|||
return null;
|
||||
}
|
||||
|
||||
public string GetTexturePath(string textureName)
|
||||
{
|
||||
if (!_initialised) return null;
|
||||
|
||||
textureName = textureName.ToLower();
|
||||
if (_omResources.texturePathMap.TryGetValue(textureName, out var path))
|
||||
{
|
||||
return path;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// TODO: OMs fail to find a path, but FMs using OM textures do find them
|
||||
// The OMs still fail even if I put them in a folder with FMs that work=??
|
||||
public string GetTexturePath(string campaignName, string textureName)
|
||||
{
|
||||
if (!_initialised) return null;
|
||||
|
||||
textureName = textureName.ToLower();
|
||||
if (_fmResources.TryGetValue(campaignName, out var campaign) &&
|
||||
campaign.texturePathMap.TryGetValue(textureName, out var path))
|
||||
if (campaignName == null || campaignName == "")
|
||||
{
|
||||
if (_omResources.texturePathMap.TryGetValue(textureName, out var path))
|
||||
{
|
||||
return path;
|
||||
}
|
||||
}
|
||||
else if (_fmResources.TryGetValue(campaignName, out var campaign))
|
||||
{
|
||||
if (campaign.texturePathMap.TryGetValue(textureName, out var fmPath))
|
||||
{
|
||||
return fmPath;
|
||||
}
|
||||
else if (_omResources.texturePathMap.TryGetValue(textureName, out var omPath))
|
||||
{
|
||||
return omPath;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,16 +29,7 @@ public partial class TextureLoader
|
|||
public bool Load(ResourcePathManager installManager, int id, string path)
|
||||
{
|
||||
var loaded = false;
|
||||
string texPath;
|
||||
if (_fmName != null)
|
||||
{
|
||||
texPath = installManager.GetTexturePath(_fmName, path);
|
||||
texPath ??= installManager.GetTexturePath(path);
|
||||
}
|
||||
else
|
||||
{
|
||||
texPath = installManager.GetTexturePath(path);
|
||||
}
|
||||
string texPath = installManager.GetTexturePath(_fmName, path);
|
||||
|
||||
if (texPath != null)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue