Синтаксис:
Используется csharp
public List<int> buttonPress = new List<int>();
public Vector2 scrolPoss = Vector2.zero;
public struct dataInfo
{
public GameObject go;
public string name;
public string kill;
public string death;
public string[] stringArray;
}
public List<dataInfo> spisok = new List<dataInfo>();
void Start()
{
for (int i = 0; i < 10; i++)
{
dataInfo dataInfo = new dataInfo();
dataInfo.go = new GameObject("gameObj" + i.ToString());
dataInfo.name = "name_" + i.ToString();
dataInfo.kill = "kill_" + i.ToString();
dataInfo.death = "death_" + i.ToString();
int r = Random.Range(0, 10);
dataInfo.stringArray = new string[r];
for (int j = 0; j < r; j++)
dataInfo.stringArray[j] = "string_array_" + i.ToString() + "_" + j.ToString();
spisok.Add(dataInfo);
buttonPress.Add(-1);
}
}
private void OnGUI()
{
scrolPoss = GUILayout.BeginScrollView(scrolPoss,"window");
for (int i = 0; i < spisok.Count; i++)
{
if (GUILayout.Button(spisok[i].go.name)) buttonPress[i] = buttonPress[i] * -1;
if (buttonPress[i] ==1)
{
GUILayout.Label(spisok[i].name);
GUILayout.Label(spisok[i].kill);
GUILayout.Label(spisok[i].death);
for (int j = 0; j < spisok[i].stringArray.Length; j++)
GUILayout.Label(" " + spisok[i].stringArray[j]);
}
}
GUILayout.EndScrollView();
}
public Vector2 scrolPoss = Vector2.zero;
public struct dataInfo
{
public GameObject go;
public string name;
public string kill;
public string death;
public string[] stringArray;
}
public List<dataInfo> spisok = new List<dataInfo>();
void Start()
{
for (int i = 0; i < 10; i++)
{
dataInfo dataInfo = new dataInfo();
dataInfo.go = new GameObject("gameObj" + i.ToString());
dataInfo.name = "name_" + i.ToString();
dataInfo.kill = "kill_" + i.ToString();
dataInfo.death = "death_" + i.ToString();
int r = Random.Range(0, 10);
dataInfo.stringArray = new string[r];
for (int j = 0; j < r; j++)
dataInfo.stringArray[j] = "string_array_" + i.ToString() + "_" + j.ToString();
spisok.Add(dataInfo);
buttonPress.Add(-1);
}
}
private void OnGUI()
{
scrolPoss = GUILayout.BeginScrollView(scrolPoss,"window");
for (int i = 0; i < spisok.Count; i++)
{
if (GUILayout.Button(spisok[i].go.name)) buttonPress[i] = buttonPress[i] * -1;
if (buttonPress[i] ==1)
{
GUILayout.Label(spisok[i].name);
GUILayout.Label(spisok[i].kill);
GUILayout.Label(spisok[i].death);
for (int j = 0; j < spisok[i].stringArray.Length; j++)
GUILayout.Label(" " + spisok[i].stringArray[j]);
}
}
GUILayout.EndScrollView();
}