培训考核三期,新版培训,网页版培训登录器
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.
 
 

38 lines
806 B

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
[RequireComponent(typeof(Toggle))]
public class SelectionChangeColor : MonoBehaviour
{
public TextMeshProUGUI showText;
public Color normalColor;
public Color selectColor;
void Start()
{
GetComponent<Toggle>().onValueChanged.AddListener(selectChanged);
if (GetComponent<Toggle>().isOn)
{
showText.color = selectColor;
}
else
{
showText.color = normalColor;
}
}
private void selectChanged(bool Ison)
{
if (Ison)
{
showText.color = selectColor;
}
else
{
showText.color = normalColor;
}
}
}