37 lines
961 B
C#
37 lines
961 B
C#
// ***********************************************************************
|
|
// Assembly : Unity
|
|
// Author :
|
|
// Created : 2018-09-03
|
|
//
|
|
// Last Modified By :
|
|
// Last Modified On :
|
|
// ***********************************************************************
|
|
// <copyright file= "KUIGray" company="ddl"></copyright>
|
|
// <summary></summary>
|
|
// ***********************************************************************
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class KUIGray : MonoBehaviour
|
|
{
|
|
private readonly static List<Graphic> _Graphics = new List<Graphic>();
|
|
private bool _gray;
|
|
|
|
// Use this for initialization
|
|
public void SetGray(bool gray)
|
|
{
|
|
if (gray != _gray)
|
|
{
|
|
_gray = gray;
|
|
|
|
_Graphics.Clear();
|
|
GetComponentsInChildren(_Graphics);
|
|
foreach (var graphic in _Graphics)
|
|
{
|
|
graphic.material = gray ? Resources.Load<Material>("Materials/UIGray") : null;
|
|
}
|
|
}
|
|
}
|
|
}
|