Пример #1
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Id;
         hashCode = (hashCode * 397) ^ MaxScore;
         hashCode = (hashCode * 397) ^ (CriticalObjectives?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (BonusObjectives?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (OptionalObjectives?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Skulls?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (AwardedPacks?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (DisplayInfo != null ? DisplayInfo.GetHashCode() : 0);
         return(hashCode);
     }
 }
Пример #2
0
        public bool Equals(CampaignLevel other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return(Id == other.Id &&
                   MaxScore == other.MaxScore &&
                   CriticalObjectives.OrderBy(o => o.Id).SequenceEqual(other.CriticalObjectives.OrderBy(o => o.Id)) &&
                   BonusObjectives.OrderBy(o => o.Id).SequenceEqual(other.BonusObjectives.OrderBy(o => o.Id)) &&
                   OptionalObjectives.OrderBy(o => o.Id).SequenceEqual(other.OptionalObjectives.OrderBy(o => o.Id)) &&
                   Skulls.OrderBy(s => s.Id).SequenceEqual(other.Skulls.OrderBy(s => s.Id)) &&
                   AwardedPacks.OrderBy(s => s.Id).SequenceEqual(other.AwardedPacks.OrderBy(s => s.Id)) &&
                   Equals(DisplayInfo, other.DisplayInfo));
        }