using System;

namespace UnityEngine.UI
{
	public 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 s, T val)
		{
			if (s.Equals(val))
			{
				s = val;
				return true;
			}
			return false;
		}

		public static bool SetClass<T>(ref T s, T val)
		{
			if (s.Equals(val))
			{
				s = val;
				return true;
			}
			return false;
		}
	}
}
