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
940 B
41 lines
940 B
4 years ago
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.UI;
|
||
|
|
||
|
public class ShowSelect : MonoBehaviour
|
||
|
{
|
||
|
public Toggle MyToggle;
|
||
|
public Color InitColor;
|
||
|
public Color SelectColor;
|
||
|
public Image MyShowImg;
|
||
|
void Awake()
|
||
|
{
|
||
|
//MyToggle = GetComponent<Toggle>();
|
||
|
MyShowImg = transform.Find("ShowImg").GetComponent<Image>();
|
||
|
//MyToggle = MyShowImg.GetComponent<Toggle>();
|
||
|
}
|
||
|
public void GetGroup(ToggleGroup group)
|
||
|
{
|
||
|
MyToggle.group = group;
|
||
|
}
|
||
|
// Update is called once per frame
|
||
|
void Update()
|
||
|
{
|
||
|
if (MyToggle.isOn)
|
||
|
{
|
||
|
if (MyShowImg.color != SelectColor)
|
||
|
{
|
||
|
MyShowImg.color = SelectColor;
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (MyShowImg.color != InitColor)
|
||
|
{
|
||
|
MyShowImg.color = InitColor;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|