52 lines
844 B
C#
52 lines
844 B
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class ShowContent : MonoBehaviour
|
|
{
|
|
public Toggle toggle;
|
|
|
|
public Image toggle_image;
|
|
|
|
public Sprite image_on;
|
|
|
|
public Sprite image_off;
|
|
|
|
public List<Element> Objects = new List<Element>();
|
|
|
|
private void Start()
|
|
{
|
|
toggle.onValueChanged.AddListener(OnToggleValueChanged);
|
|
}
|
|
|
|
private void OnToggleValueChanged(bool value)
|
|
{
|
|
if (value)
|
|
{
|
|
toggle_image.sprite = image_off;
|
|
{
|
|
foreach (Element @object in Objects)
|
|
{
|
|
if (@object.ShowElement)
|
|
{
|
|
@object.gameObject.SetActive(value: true);
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
toggle_image.sprite = image_on;
|
|
foreach (Element object2 in Objects)
|
|
{
|
|
if (object2.ShowElement)
|
|
{
|
|
object2.gameObject.SetActive(value: false);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
}
|
|
}
|