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.
65 lines
1.6 KiB
65 lines
1.6 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
public class BSbtn : MonoBehaviour
|
|
{
|
|
public GameObject[] listobj;
|
|
public bool curState;
|
|
public int greenhouse;
|
|
public int id;
|
|
Text uiText;
|
|
|
|
public string[] information;
|
|
public float[] changeInfo;
|
|
private void Awake()
|
|
{
|
|
curState = false;
|
|
uiText = transform.GetChild(0).GetComponent<Text>();
|
|
}
|
|
private void OnEnable()
|
|
{
|
|
curState = false;
|
|
uiText.text = "²¿Êð";
|
|
}
|
|
private void Start()
|
|
{
|
|
|
|
}
|
|
|
|
public void OnClicked()
|
|
{
|
|
if (curState)
|
|
{
|
|
if (greenhouse == 0) {
|
|
Canvasinit.Instance.one_active--;
|
|
} else if (greenhouse == 1) {
|
|
Canvasinit.Instance.two_active--;
|
|
} else if (greenhouse == 2) {
|
|
Canvasinit.Instance.three_active--;
|
|
}
|
|
curState = false;
|
|
uiText.text = "²¿Êð";
|
|
listobj[greenhouse].GetComponent<EquipmentPanel>().reduceList(id);
|
|
}
|
|
else
|
|
{
|
|
if (greenhouse == 0)
|
|
{
|
|
Canvasinit.Instance.one_active++;
|
|
}
|
|
else if (greenhouse == 1)
|
|
{
|
|
Canvasinit.Instance.two_active++;
|
|
}
|
|
else if (greenhouse == 2)
|
|
{
|
|
Canvasinit.Instance.three_active++;
|
|
}
|
|
curState = true;
|
|
uiText.text = "È¡Ïû²¿Êð";
|
|
listobj[greenhouse].GetComponent<EquipmentPanel>().addList(information, id, changeInfo);
|
|
}
|
|
}
|
|
}
|