1+ using System ;
2+ using System . Collections . Generic ;
3+ using System . Diagnostics ;
4+
5+ using I = Newtonsoft . Json . JsonIgnoreAttribute ;
6+ using J = Newtonsoft . Json . JsonPropertyAttribute ;
7+
8+ namespace Fortnite_API . Objects . V2
9+ {
10+ [ DebuggerDisplay ( "{" + nameof ( Id ) + "}" ) ]
11+ public class BrMaterialInstanceV2 : IEquatable < BrMaterialInstanceV2 >
12+ {
13+ [ J ] public string Id { get ; private set ; }
14+ [ J ] public Dictionary < string , Uri > Images { get ; private set ; }
15+ [ J ] public Dictionary < string , BrMaterialInstanceV2Color > Colors { get ; private set ; }
16+ [ J ] public Dictionary < string , float > Scalings { get ; private set ; }
17+
18+ [ I ] public bool HasImages => Images != null && Images . Count != 0 ;
19+ [ I ] public bool HasColors => Colors != null && Colors . Count != 0 ;
20+ [ I ] public bool HasScalings => Scalings != null && Scalings . Count != 0 ;
21+
22+ public bool Equals ( BrMaterialInstanceV2 other )
23+ {
24+ if ( ReferenceEquals ( null , other ) )
25+ {
26+ return false ;
27+ }
28+
29+ if ( ReferenceEquals ( this , other ) )
30+ {
31+ return true ;
32+ }
33+
34+ return Id == other . Id && Equals ( Images , other . Images ) && Equals ( Colors , other . Colors ) && Equals ( Scalings , other . Scalings ) ;
35+ }
36+
37+ public override bool Equals ( object obj )
38+ {
39+ if ( ReferenceEquals ( null , obj ) )
40+ {
41+ return false ;
42+ }
43+
44+ if ( ReferenceEquals ( this , obj ) )
45+ {
46+ return true ;
47+ }
48+
49+ if ( obj . GetType ( ) != GetType ( ) )
50+ {
51+ return false ;
52+ }
53+
54+ return Equals ( ( BrMaterialInstanceV2 ) obj ) ;
55+ }
56+
57+ public override int GetHashCode ( )
58+ {
59+ unchecked
60+ {
61+ var hashCode = Id != null ? Id . GetHashCode ( ) : 0 ;
62+ hashCode = hashCode * 397 ^ ( Images != null ? Images . GetHashCode ( ) : 0 ) ;
63+ hashCode = hashCode * 397 ^ ( Colors != null ? Colors . GetHashCode ( ) : 0 ) ;
64+ hashCode = hashCode * 397 ^ ( Scalings != null ? Scalings . GetHashCode ( ) : 0 ) ;
65+ return hashCode ;
66+ }
67+ }
68+
69+ public static bool operator == ( BrMaterialInstanceV2 left , BrMaterialInstanceV2 right )
70+ {
71+ return Equals ( left , right ) ;
72+ }
73+
74+ public static bool operator != ( BrMaterialInstanceV2 left , BrMaterialInstanceV2 right )
75+ {
76+ return ! Equals ( left , right ) ;
77+ }
78+ }
79+ }
0 commit comments