Merge GetMissionPath to one function
This commit is contained in:
parent
56a5aa6869
commit
659843c743
|
@ -93,26 +93,24 @@ public class ResourcePathManager
|
||||||
return names;
|
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)
|
public string GetMissionPath(string campaignName, string missionName)
|
||||||
{
|
{
|
||||||
if (!_initialised) return null;
|
if (!_initialised) return null;
|
||||||
|
|
||||||
if (_fmResources.TryGetValue(campaignName, out var campaign) &&
|
if (campaignName == null || campaignName == "")
|
||||||
campaign.missionPathMap.TryGetValue(missionName, out var path))
|
|
||||||
{
|
{
|
||||||
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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,16 +50,8 @@ public partial class Mission : Node3D
|
||||||
var missionSelector = GetNode<Control>("%MissionSelector") as MissionSelector;
|
var missionSelector = GetNode<Control>("%MissionSelector") as MissionSelector;
|
||||||
missionSelector.pathManager = _installPaths;
|
missionSelector.pathManager = _installPaths;
|
||||||
missionSelector.MissionSelected += (string campaign, string mission) =>
|
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;
|
Build = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue