Пример #1
0
    private void FillStateButtons()
    {
        for (int i = 0; i < 36; i++)
        {
            StateData  stateData = stateDataManager.GetStateData(i);
            GameObject temp      = Instantiate(buttonPrefab);

            if (i > 17)
            {
                temp.transform.SetParent(buttonsParentPanel1);
            }
            else
            {
                temp.transform.SetParent(buttonsParentPanel2);
            }

            temp.GetComponentInChildren <Text>().text = stateData.name;
            int tempIndex = i;
            temp.GetComponent <Button>().onClick.AddListener(() => ShowState(tempIndex));
        }
    }
Пример #2
0
    public void ShowState(int index_)
    {
        StateData stateData = stateDataManager.GetStateData(index_);

        PopulateStateUI(stateData);
    }