Files
LuaCsForBarotraumaEP/Barotrauma/BarotraumaShared/SharedSource/ContentManagement/ContentFile/UpgradeModulesFile.cs
2022-02-26 02:43:01 +09:00

32 lines
1.1 KiB
C#

using System.Xml.Linq;
namespace Barotrauma
{
[RequiredByCorePackage]
sealed class UpgradeModulesFile : GenericPrefabFile<UpgradeContentPrefab>
{
public UpgradeModulesFile(ContentPackage contentPackage, ContentPath path) : base(contentPackage, path) { }
protected override bool MatchesSingular(Identifier identifier) =>
identifier == "upgrademodule" ||
identifier == "upgradecategory";
protected override bool MatchesPlural(Identifier identifier) =>
identifier == "upgrademodules";
protected override PrefabCollection<UpgradeContentPrefab> prefabs => UpgradeContentPrefab.PrefabsAndCategories;
protected override UpgradeContentPrefab CreatePrefab(ContentXElement element)
{
Identifier elemName = element.NameAsIdentifier();
if (elemName == "upgradecategory")
{
return new UpgradeCategory(element, this);
}
else
{
return new UpgradePrefab(element, this);
}
}
}
}