3 using System.Collections.Generic;
4 using System.Globalization;
8 using Microsoft.Xna.Framework;
23 element.GetAttributeIdentifier(
"identifier", Identifier.Empty),
24 element.GetAttributeInt(
"variant", -1)) { }
30 => a.JobIdentifier == b.JobIdentifier && a.Variant == b.Variant;
34 public override bool Equals(
object? obj)
42 public readonly List<JobPreference>
JobPreferences =
new List<JobPreference>();
46 public readonly HashSet<Identifier>
TagSet =
new HashSet<Identifier>();
59 private MultiplayerPreferences(IEnumerable<XElement> elements)
61 foreach (var element
in elements)
65 TagSet.UnionWith(element.GetAttributeIdentifierArray(
"tags", Array.Empty<Identifier>()));
75 foreach (var subElement
in element.GetChildElements(
"job"))
82 public static void Init(params XElement?[] elements)
91 element.SetAttributeValue(
"tags",
string.Join(
",",
TagSet));
103 element.Add(
new XElement(
"job",
104 new XAttribute(
"identifier", jobPreference.JobIdentifier.Value),
105 new XAttribute(
"variant", jobPreference.Variant.ToString(CultureInfo.InvariantCulture))));
readonly HashSet< Identifier > TagSet
bool AreJobPreferencesEqual(IReadOnlyList< JobPreference > other)
static void Init(params XElement?[] elements)
CharacterTeamType TeamPreference
static MultiplayerPreferences Instance
void SaveTo(XElement element)
readonly List< JobPreference > JobPreferences
JobPreference(Identifier jobIdentifier, int variant)
static bool operator!=(JobPreference a, JobPreference b)
readonly Identifier JobIdentifier
bool Equals(JobPreference other)
JobPreference(XElement element)
override int GetHashCode()
override bool Equals(object? obj)
static bool operator==(JobPreference a, JobPreference b)