Пример #1
0
    public void Completas()
    {
        if (completas.color != selected)
        {
            foreach (Transform child in colecoes_incompletas.transform)
            {
                Destroy(child.gameObject);
            }

            foreach (Colection c in collections)
            {
                if (c.pacotes_in_collection == c.total_pacotes)
                {
                    GameObject collection = (GameObject)Instantiate(collection_prefab, collection_prefab.transform.position, collection_prefab.transform.rotation);
                    collection.transform.SetParent(colecoes_incompletas.transform, false);

                    CollectionPrefab cp = collection.GetComponent <CollectionPrefab>();
                    cp.name_text.text  = c.name;
                    cp.id              = c.Id;
                    cp.completion.text = "Completa";
                }
            }

            incompletas.color = unselected;
            completas.color   = selected;
            todas.color       = unselected;
        }
    }
    //-------------------------------------------
    /// <summary>
    /// Collection Buttonをリストに追加
    /// </summary>
    public void CreateCollectionButton()
    {
        for (int i = 0; i < GameData.CollectionInfo.GetLength(0); i++)
        {
            //  Button Prefab Object Create
            GameObject tmpObject = Instantiate(CollectionButton) as GameObject;

            //  Button Objectの内にあるScript
            CollectionPrefab tmpPrefab = tmpObject.GetComponent <CollectionPrefab>();

            //  名前を設定
            tmpObject.name = ("CollectionGame_" + GameData.CollectionInfo[i, 0]);

            //  Imageを出力
            Rect rect = new Rect(0, 0, image[i].width, image[i].height);

            tmpPrefab.image.sprite = Sprite.Create(image[i], rect, new Vector2(0.5f, 0.5f));

            //  title text 設定
            tmpPrefab.title.text = GameData.CollectionInfo[i, 2];

            //  writer 設定
            tmpPrefab.creator.text += GameData.CollectionInfo[i, 3];

            //  Parent Objectを設定
            tmpObject.transform.SetParent(Content);

            //  サイズを1に設定
            tmpObject.transform.localScale = new Vector3(1f, 1f, 1f);
        }
    }
Пример #3
0
    void OnEnable()
    {
        incompletas.color = selected;
        completas.color   = unselected;
        todas.color       = unselected;

        collections = manager.ds.GetAllCollections();
        foreach (Transform child in colecoes_incompletas.transform)
        {
            Destroy(child.gameObject);
        }

        if (collections != null)
        {
            foreach (Colection c in collections)
            {
                if (c.pacotes_in_collection < c.total_pacotes)
                {
                    GameObject collection = (GameObject)Instantiate(collection_prefab, collection_prefab.transform.position, collection_prefab.transform.rotation);
                    collection.transform.SetParent(colecoes_incompletas.transform, false);

                    CollectionPrefab cp = collection.GetComponent <CollectionPrefab>();
                    cp.name_text.text  = c.name;
                    cp.id              = c.Id;
                    cp.completion.text = c.pacotes_in_collection + "/" + c.total_pacotes;
                }
            }
        }
    }