com.alicizax.unity.ui.exten.../Runtime/UXComponent/Selectable/SetPropertyUtility.cs
陈思海 32c0fc13fd 重构
1.重构UXButton
2.主Transition有UXSeletable负责 ,同时兼具导航
3.新增UXSlider  支持平滑过渡 适配手柄
4.优化部分逻辑bug
2025-12-09 15:08:41 +08:00

36 lines
1.0 KiB
C#

using System.Collections.Generic;
using UnityEngine;
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 (EqualityComparer<T>.Default.Equals(currentValue, 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;
}
}
}