You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
914 B
41 lines
914 B
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class tglCheck : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
Toggle toggle;
|
|
[SerializeField]
|
|
public Image image;
|
|
[SerializeField]
|
|
TextMeshProUGUI text;
|
|
|
|
[SerializeField]
|
|
Material[] txtMat;
|
|
|
|
void Start()
|
|
{
|
|
toggle.onValueChanged.AddListener(ColorChange);
|
|
|
|
ColorChange(toggle.isOn);
|
|
}
|
|
|
|
public virtual void ColorChange(bool toggle)
|
|
{
|
|
if (toggle)
|
|
{
|
|
image.color = new Color(1f, 1f, 1f);
|
|
text.color = new Color(0f, 0f, 0f);
|
|
//text.fontMaterial = txtMat[0];
|
|
}
|
|
else
|
|
{
|
|
image.color = new Color(166f / 255f, 166f / 255f, 166f / 255f, 178f / 255f);
|
|
text.color = new Color(0f, 0f, 0f);
|
|
//text.fontMaterial = txtMat[1];
|
|
}
|
|
}
|
|
}
|