2025-07-08 10:46:31 +00:00
|
|
|
|
using System;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
|
|
namespace Superlazy.UI
|
|
|
|
|
{
|
|
|
|
|
public class SLUIColorSelect : SLUIComponent
|
|
|
|
|
{
|
|
|
|
|
public SLValueComparison[] comparisons;
|
|
|
|
|
public Color[] colors;
|
|
|
|
|
|
|
|
|
|
[NonSerialized]
|
|
|
|
|
public Graphic graphic;
|
|
|
|
|
|
|
|
|
|
protected override void Validate()
|
|
|
|
|
{
|
|
|
|
|
graphic = GetComponent<Graphic>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void Init()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void Enable()
|
|
|
|
|
{
|
|
|
|
|
foreach (var c in comparisons)
|
|
|
|
|
{
|
|
|
|
|
c.OnEnable(bindParent.BindPath, OnChange);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void Disable()
|
|
|
|
|
{
|
|
|
|
|
foreach (var c in comparisons)
|
|
|
|
|
{
|
|
|
|
|
c.OnDisable();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnChange()
|
|
|
|
|
{
|
|
|
|
|
if (bindParent.Active == false) return;
|
|
|
|
|
var sessionRoot = SLGame.SessionGet(bindParent.BindPath);
|
|
|
|
|
if (sessionRoot == false) return; // TEMP: 세션루트가 삭제되었지만, 삭제되되기전 코루틴 처리가 있을 수 있음
|
|
|
|
|
|
|
|
|
|
var idx = 0;
|
|
|
|
|
foreach (var c in comparisons)
|
|
|
|
|
{
|
|
|
|
|
if (c.Result)
|
|
|
|
|
{
|
|
|
|
|
graphic.color = colors[idx];
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
idx++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (colors.Length > idx)
|
|
|
|
|
{
|
|
|
|
|
graphic.color = colors[idx];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|