66 lines
1.6 KiB
C#
66 lines
1.6 KiB
C#
using GLTFast;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
using UnityEngine.UI;
|
|
|
|
public class SelectInColor : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, IPointerClickHandler
|
|
{
|
|
public List<Image> _image;
|
|
private List<Vector4> old= new List<Vector4>();
|
|
public float InColor;
|
|
public float OutColor;
|
|
// Start is called before the first frame update
|
|
|
|
void Start()
|
|
{
|
|
for (int n = 0; n < _image.Count; n++)
|
|
{
|
|
old.Add(_image[n].color);
|
|
}
|
|
for (int n = 0; n < _image.Count; n++)
|
|
{
|
|
_image[n].GetComponent<Image>().color = new Vector4(old[n].x, old[n].y, old[n].z, OutColor);
|
|
}
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
|
|
public void OnPointerClick(PointerEventData eventData)
|
|
{
|
|
|
|
}
|
|
|
|
public void OnPointerEnter(PointerEventData eventData)
|
|
{
|
|
for (int n = 0; n < _image.Count; n++)
|
|
{
|
|
_image[n].GetComponent<Image>().color = new Vector4(old[n].x, old[n].y, old[n].z, InColor);
|
|
}
|
|
}
|
|
|
|
public void OnPointerExit(PointerEventData eventData)
|
|
{
|
|
for (int n = 0; n < _image.Count; n++)
|
|
{
|
|
_image[n].GetComponent<Image>().color = new Vector4(old[n].x, old[n].y, old[n].z, OutColor);
|
|
}
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
if (old.Count != 0)
|
|
{
|
|
for (int n = 0; n < _image.Count; n++)
|
|
{
|
|
_image[n].GetComponent<Image>().color = new Vector4(old[n].x, old[n].y, old[n].z, OutColor);
|
|
}
|
|
}
|
|
}
|
|
}
|