This commit is contained in:
SoulliesOfficial
2026-04-01 12:23:27 -04:00
parent aff7ac0e03
commit c3b1561375
933 changed files with 114333 additions and 119360 deletions

View File

@@ -43,6 +43,46 @@ namespace Continentis.MainGame.Card
}
}
/// <summary>
/// 根据颜色智能更新提示阴影null 关闭,非 null 启用对应颜色。
/// 避免相同颜色重复 tween 导致闪烁。
/// </summary>
public void UpdateHintShadow(Color? color)
{
if (color == null)
{
if (hintShadow.gameObject.activeSelf)
{
DisableHintShadow();
}
return;
}
Color targetColor = color.Value;
if (hintShadow.gameObject.activeSelf)
{
// 已启用:仅在颜色差异足够大时 tween避免每帧闪烁
if (!ApproximatelyEqualColor(hintShadow.color, targetColor))
{
hintShadowTweener?.Kill();
hintShadowTweener = hintShadow.DOColor(targetColor, 0.2f).Play();
}
}
else
{
EnableHintShadow(targetColor);
}
}
private static bool ApproximatelyEqualColor(Color a, Color b, float tolerance = 0.01f)
{
return Mathf.Abs(a.r - b.r) < tolerance
&& Mathf.Abs(a.g - b.g) < tolerance
&& Mathf.Abs(a.b - b.b) < tolerance
&& Mathf.Abs(a.a - b.a) < tolerance;
}
public void EnableSelectShadow()
{
selectShadow.gameObject.SetActive(true);