Ejemplo n.º 1
0
    public void createStats()
    {
        //Remove old items
        for (int i = listItemContainer.transform.childCount - 1; i >= 0; i--)
        {
            Destroy(listItemContainer.transform.GetChild(i).gameObject);
            //print(i);
        }

        loading.SetActive(true);

        //Create items
        GameObject prefab = Instantiate(listItemPrefab, listItemContainer.transform);

        prefab.GetComponent <StatsItemController>().myName.text   = "All tiles";
        prefab.GetComponent <StatsItemController>().quantity.text = countAll() + "";

        for (int i = 0; i < hub.getCount(); i++)
        {
            //string name = hub.getName(i);
            prefab = Instantiate(listItemPrefab, listItemContainer.transform);
            prefab.GetComponent <StatsItemController>().myName.text   = hub.getName(i);
            prefab.GetComponent <StatsItemController>().quantity.text = countTile(i) + "";
        }

        prefab = Instantiate(listItemPrefab, listItemContainer.transform);
        prefab.GetComponent <StatsItemController>().myName.text   = "Powered";
        prefab.GetComponent <StatsItemController>().quantity.text = countPowered() + "";

        prefab = Instantiate(listItemPrefab, listItemContainer.transform);
        prefab.GetComponent <StatsItemController>().myName.text   = "Unpowered";
        prefab.GetComponent <StatsItemController>().quantity.text = countUnpowered() + "";

        loading.SetActive(false);
    }
Ejemplo n.º 2
0
 private void showNameA()
 {
     switch (selectedA)
     {
         case 0:
             GC.changeItemName("Select");
             break;
         case 1:
             GC.changeItemName("Move");
             break;
         default:
             GC.changeItemName(tileHub.getName(activePrefabs[selectedA - firstUnavailableA].GetComponent<TileController>().ID));
             break;
     }
     StopAllCoroutines();
     closeTimer = MAX_CLOSE_TIMER;
     showName = true;
 }