2 using System.Collections.Generic;
3 using System.Collections.Immutable;
10 public string Name {
get;
protected set; }
22 Name = $
"{nameof(ExtraSubmarineInfo)} ({submarineInfo.Name})";
28 Name = $
"{nameof(ExtraSubmarineInfo)} ({submarineInfo.Name})";
36 foreach (KeyValuePair<Identifier, SerializableProperty> kvp
in original.SerializableProperties)
41 kvp.Value.TrySetValue(
this, kvp.Value.GetValue(original));
46 public virtual void Save(XElement element)
68 Name = $
"{nameof(BeaconStationInfo)} ({submarineInfo.Name})";
73 Name = $
"{nameof(BeaconStationInfo)} ({submarineInfo.Name})";
89 Name = $
"{nameof(WreckInfo)} ({submarineInfo.Name})";
90 TryDetermineThalamusIfUnknown(element);
95 Name = $
"{nameof(WreckInfo)} ({submarineInfo.Name})";
102 private void TryDetermineThalamusIfUnknown(XElement element)
113 foreach (var subElement
in element.Elements())
115 if (!
string.Equals(subElement.Name.ToString(), nameof(Item), StringComparison.InvariantCultureIgnoreCase)) {
continue; }
117 var tags = subElement.GetAttributeIdentifierImmutableHashSet(nameof(ItemPrefab.Tags), ImmutableHashSet<Identifier>.Empty);
119 if (tags.Contains(Tags.Thalamus))
138 private readonly HashSet<Identifier> missionTags =
new HashSet<Identifier>();
144 Name = $
"{nameof(EnemySubmarineInfo)} ({submarineInfo.Name})";
146 foreach (var missionTag
in element.GetAttributeIdentifierArray(nameof(
MissionTags), Array.Empty<Identifier>()))
148 missionTags.Add(missionTag);
154 Name = $
"{nameof(EnemySubmarineInfo)} ({submarineInfo.Name})";
159 foreach (var missionTag
in original.missionTags)
161 missionTags.Add(missionTag);
165 public override void Save(XElement element)
168 element.Add(
new XAttribute(nameof(
MissionTags),
string.Join(
',', missionTags)));
BeaconStationInfo(BeaconStationInfo original)
bool AllowDisconnectedWires
Level.PlacementType Placement
BeaconStationInfo(SubmarineInfo submarineInfo, XElement element)
BeaconStationInfo(SubmarineInfo submarineInfo)
HashSet< Identifier > MissionTags
EnemySubmarineInfo(EnemySubmarineInfo original)
override void Save(XElement element)
float PreferredDifficulty
EnemySubmarineInfo(SubmarineInfo submarineInfo)
EnemySubmarineInfo(SubmarineInfo submarineInfo, XElement element)
static Dictionary< Identifier, SerializableProperty > DeserializeProperties(object obj, XElement element=null)
static string GetSupportedTypeName(Type type)
static void SerializeProperties(ISerializableEntity obj, XElement element, bool saveIfDefault=false, bool ignoreEditable=false)
XElement SubmarineElement
WreckInfo(WreckInfo original)
HasThalamus WreckContainsThalamus
WreckInfo(SubmarineInfo submarineInfo)
WreckInfo(SubmarineInfo submarineInfo, XElement element)