-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIngredientScript.cs
More file actions
71 lines (63 loc) · 1.58 KB
/
IngredientScript.cs
File metadata and controls
71 lines (63 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
using TMPro;
using UnityEngine;
public class IngredientScript : MonoBehaviour
{
public TMP_Text value;
public GameObject green;
public GameObject up;
public GameObject down;
public GameObject content;
public GameObject space;
public GameObject line;
public GameObject ingPref;
Ingrediens_cat _iCat;
private bool opened = false;
public void OpenORClose()
{
if (!opened)
{
Open();
}
else
{
Close();
}
}
public void Open()
{
value.color = Color.white;
green.SetActive(true);
content.SetActive(true);
down.SetActive(false);
up.SetActive(true);
space.SetActive(true);
line.SetActive(false);
opened = true;
content.transform.ClearChildren();
ViewPref(_iCat);
}
public void Close()
{
value.color = Color.black;
green.SetActive(false);
content.SetActive(false);
down.SetActive(true);
up.SetActive(false);
space.SetActive(false);
line.SetActive(true);
opened = false;
}
public void CreatePref(Ingrediens_cat iCat)
{
value.text = iCat.name;
_iCat = iCat;
}
public void ViewPref(Ingrediens_cat iCat)
{
for (int i = 0; i < iCat.nids.Count; i++)
{
var ingr = Instantiate(ingPref, content.transform);
ingr.GetComponent<IngrScript>().CreatePref(iCat.nids[i]);
}
}
}