51 lines
1.3 KiB
C#
51 lines
1.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI ;
|
|
|
|
public class Column : MonoBehaviour
|
|
{
|
|
|
|
public Image Image_Column;
|
|
public Sprite Spr_1, Spr_2;
|
|
public GameObject[] ObjList;
|
|
[HideInInspector]
|
|
public bool ifShow = false;
|
|
int i;
|
|
|
|
//隐藏/显示
|
|
public void ShowDis()
|
|
{
|
|
ifShow = !ifShow;
|
|
if (ifShow)//显示
|
|
Image_Column.sprite = Spr_2;
|
|
else//隐藏
|
|
{
|
|
Image_Column.sprite = Spr_1;
|
|
for (i = 0; i < ObjList.Length; i++)
|
|
{
|
|
tempCol = ObjList[i].GetComponent<Column>();
|
|
if (tempCol != null)
|
|
ObjList[i].GetComponent<Column>().Dis();
|
|
}
|
|
}
|
|
for (i = 0; i < ObjList.Length; i++)
|
|
ObjList[i].SetActive(ifShow);
|
|
}
|
|
//隐藏
|
|
Column tempCol;
|
|
public void Dis()
|
|
{
|
|
ifShow = false;
|
|
Image_Column.sprite = Spr_1;
|
|
for (i = 0; i < ObjList.Length; i++)
|
|
{
|
|
tempCol = ObjList[i].GetComponent<Column>();
|
|
if (tempCol != null)
|
|
ObjList[i].GetComponent<Column>().Dis();
|
|
}
|
|
for (i = 0; i < ObjList.Length; i++)
|
|
ObjList[i].SetActive(ifShow);
|
|
}
|
|
}
|