Merge GetMissionPath to one function
This commit is contained in:
parent
56a5aa6869
commit
659843c743
|
@ -93,26 +93,24 @@ public class ResourcePathManager
|
|||
return names;
|
||||
}
|
||||
|
||||
public string GetMissionPath(string missionName)
|
||||
{
|
||||
if (!_initialised) return null;
|
||||
|
||||
if (_omResources.missionPathMap.TryGetValue(missionName, out var path))
|
||||
{
|
||||
return path;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public string GetMissionPath(string campaignName, string missionName)
|
||||
{
|
||||
if (!_initialised) return null;
|
||||
|
||||
if (_fmResources.TryGetValue(campaignName, out var campaign) &&
|
||||
campaign.missionPathMap.TryGetValue(missionName, out var path))
|
||||
if (campaignName == null || campaignName == "")
|
||||
{
|
||||
return path;
|
||||
if (_omResources.missionPathMap.TryGetValue(missionName, out var omPath))
|
||||
{
|
||||
return omPath;
|
||||
}
|
||||
}
|
||||
else if (
|
||||
_fmResources.TryGetValue(campaignName, out var campaign) &&
|
||||
campaign.missionPathMap.TryGetValue(missionName, out var fmPath))
|
||||
{
|
||||
return fmPath;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,15 +51,7 @@ public partial class Mission : Node3D
|
|||
missionSelector.pathManager = _installPaths;
|
||||
missionSelector.MissionSelected += (string campaign, string mission) =>
|
||||
{
|
||||
if (campaign == null)
|
||||
{
|
||||
FileName = _installPaths.GetMissionPath(mission);
|
||||
}
|
||||
else
|
||||
{
|
||||
FileName = _installPaths.GetMissionPath(campaign, mission);
|
||||
}
|
||||
|
||||
FileName = _installPaths.GetMissionPath(campaign, mission);
|
||||
Build = true;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue