Merge GetTexturePath implementations
This commit is contained in:
parent
be205897bb
commit
85599b4069
|
@ -133,28 +133,32 @@ public class ResourcePathManager
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetTexturePath(string textureName)
|
// 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=??
|
||||||
if (!_initialised) return null;
|
|
||||||
|
|
||||||
textureName = textureName.ToLower();
|
|
||||||
if (_omResources.texturePathMap.TryGetValue(textureName, out var path))
|
|
||||||
{
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GetTexturePath(string campaignName, string textureName)
|
public string GetTexturePath(string campaignName, string textureName)
|
||||||
{
|
{
|
||||||
if (!_initialised) return null;
|
if (!_initialised) return null;
|
||||||
|
|
||||||
textureName = textureName.ToLower();
|
textureName = textureName.ToLower();
|
||||||
if (_fmResources.TryGetValue(campaignName, out var campaign) &&
|
if (campaignName == null || campaignName == "")
|
||||||
campaign.texturePathMap.TryGetValue(textureName, out var path))
|
{
|
||||||
|
if (_omResources.texturePathMap.TryGetValue(textureName, out var path))
|
||||||
{
|
{
|
||||||
return 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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,16 +29,7 @@ public partial class TextureLoader
|
||||||
public bool Load(ResourcePathManager installManager, int id, string path)
|
public bool Load(ResourcePathManager installManager, int id, string path)
|
||||||
{
|
{
|
||||||
var loaded = false;
|
var loaded = false;
|
||||||
string texPath;
|
string texPath = installManager.GetTexturePath(_fmName, path);
|
||||||
if (_fmName != null)
|
|
||||||
{
|
|
||||||
texPath = installManager.GetTexturePath(_fmName, path);
|
|
||||||
texPath ??= installManager.GetTexturePath(path);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
texPath = installManager.GetTexturePath(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (texPath != null)
|
if (texPath != null)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue