forked from hunterzonewu/unity-decompiled
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSetPropertyUtility.cs
More file actions
45 lines (40 loc) · 1.55 KB
/
SetPropertyUtility.cs
File metadata and controls
45 lines (40 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Decompiled with JetBrains decompiler
// Type: UnityEngine.UI.SetPropertyUtility
// Assembly: UnityEngine.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 2216A18B-AF52-44A5-85A0-A1CAA19C1090
// Assembly location: C:\Users\Blake\sandbox\unity\test-project\Library\UnityAssemblies\UnityEngine.UI.dll
using System;
namespace UnityEngine.UI
{
internal static class SetPropertyUtility
{
public static bool SetColor(ref Color currentValue, Color newValue)
{
if ((double) currentValue.r == (double) newValue.r && (double) currentValue.g == (double) newValue.g && ((double) currentValue.b == (double) newValue.b && (double) currentValue.a == (double) newValue.a))
return false;
currentValue = newValue;
return true;
}
public static bool SetEquatableStruct<T>(ref T currentValue, T newValue) where T : IEquatable<T>
{
if (currentValue.Equals(newValue))
return false;
currentValue = newValue;
return true;
}
public static bool SetStruct<T>(ref T currentValue, T newValue) where T : struct
{
if (currentValue.Equals((object) newValue))
return false;
currentValue = newValue;
return true;
}
public static bool SetClass<T>(ref T currentValue, T newValue) where T : class
{
if ((object) currentValue == null && (object) newValue == null || (object) currentValue != null && currentValue.Equals((object) newValue))
return false;
currentValue = newValue;
return true;
}
}
}