Exemplo n.º 1
0
    public void EmFalta()
    {
        if (em_falta_btn.color != selected)
        {
            foreach (Transform child in todos.transform)
            {
                Destroy(child.gameObject);
            }

            foreach (Pacote p in pacotes)
            {
                if (!p.in_collection)
                {
                    GameObject pacote = (GameObject)Instantiate(pacote_prefab, pacote_prefab.transform.position, pacote_prefab.transform.rotation);
                    pacote.transform.SetParent(todos.transform, false);

                    PacotePrefab pa = pacote.GetComponent <PacotePrefab>();
                    pa.collection_id   = p.collection_id;
                    pa.pacote_id       = p.Id;
                    pa.toggle.isOn     = p.in_collection;
                    pa.num_pacote.text = "" + p.number;
                }
            }

            todos_btn.color      = unselected;
            em_falta_btn.color   = selected;
            adquiridos_btn.color = unselected;
        }
    }
Exemplo n.º 2
0
    void OnEnable()
    {
        Colection c = manager.ds.GetColection(coleccao_id);

        name_text.text = c.name;

        if (c.pacotes_in_collection < c.total_pacotes)
        {
            pacotes_total.text = c.pacotes_in_collection + "/" + c.total_pacotes;
        }

        foreach (Transform child in todos.transform)
        {
            Destroy(child.gameObject);
        }

        pacotes = manager.ds.GetPacotesInColection(coleccao_id);

        foreach (Pacote p in pacotes)
        {
            GameObject pacote = (GameObject)Instantiate(pacote_prefab, pacote_prefab.transform.position, pacote_prefab.transform.rotation);
            pacote.transform.SetParent(todos.transform, false);

            PacotePrefab pa = pacote.GetComponent <PacotePrefab>();
            pa.toggle.isOn     = p.in_collection;
            pa.num_pacote.text = "" + p.number;
            pa.collection_id   = p.collection_id;
            pa.pacote_id       = p.Id;
        }

        todos_btn.color      = selected;
        em_falta_btn.color   = unselected;
        adquiridos_btn.color = unselected;
    }