mirror of
https://github.com/tym1116/BH3.git
synced 2025-12-18 09:24:39 +01:00
36 lines
834 B
C#
36 lines
834 B
C#
namespace UnityEngine.UI
|
|
{
|
|
internal static class SetPropertyUtility
|
|
{
|
|
public static bool SetColor(ref Color currentValue, Color newValue)
|
|
{
|
|
if (currentValue.r == newValue.r && currentValue.g == newValue.g && currentValue.b == newValue.b && currentValue.a == newValue.a)
|
|
{
|
|
return false;
|
|
}
|
|
currentValue = newValue;
|
|
return true;
|
|
}
|
|
|
|
public static bool SetStruct<T>(ref T currentValue, T newValue) where T : struct
|
|
{
|
|
if (currentValue.Equals(newValue))
|
|
{
|
|
return false;
|
|
}
|
|
currentValue = newValue;
|
|
return true;
|
|
}
|
|
|
|
public static bool SetClass<T>(ref T currentValue, T newValue) where T : class
|
|
{
|
|
if ((currentValue == null && newValue == null) || (currentValue != null && currentValue.Equals(newValue)))
|
|
{
|
|
return false;
|
|
}
|
|
currentValue = newValue;
|
|
return true;
|
|
}
|
|
}
|
|
}
|