Files
LuaCsForBarotraumaEP/Barotrauma/BarotraumaShared/SharedSource/ContentManagement/ContentFile/SoundsFile.cs
Markus Isberg 7547a9b78a Build 0.18.0.0
2022-05-13 00:55:52 +09:00

38 lines
1.3 KiB
C#

using System;
using System.Collections.Immutable;
using System.Reflection;
using System.Xml.Linq;
namespace Barotrauma
{
[RequiredByCorePackage]
#if CLIENT
sealed class SoundsFile : GenericPrefabFile<SoundPrefab>
{
public SoundsFile(ContentPackage contentPackage, ContentPath path) : base(contentPackage, path) { }
protected override PrefabCollection<SoundPrefab> Prefabs => SoundPrefab.Prefabs;
protected override SoundPrefab CreatePrefab(ContentXElement element)
{
var elemName = element.NameAsIdentifier();
if (SoundPrefab.TagToDerivedPrefab.ContainsKey(elemName))
{
return Activator.CreateInstance(SoundPrefab.TagToDerivedPrefab[elemName], new object[] { element, this }) as SoundPrefab;
}
return new SoundPrefab(element, this);
}
protected override bool MatchesPlural(Identifier identifier) => identifier == "sounds";
protected override bool MatchesSingular(Identifier identifier) => !MatchesPlural(identifier);
public override Md5Hash CalculateHash() => Md5Hash.Blank;
}
#else
sealed class SoundsFile : OtherFile
{
public SoundsFile(ContentPackage contentPackage, ContentPath path) : base(contentPackage, path) { }
}
#endif
}