コード例 #1
0
        // add shop item with position and animation
        public UIShopItem AddShopItem(GameObject prefab, int id, int i)
        {
            GameObject go = (GameObject)Instantiate(prefab, Vector3.zero, Quaternion.identity);

            go.transform.SetParent(contents[id].transform);
            go.transform.localScale = Vector3.one;
            RectTransform rt = go.GetComponent <RectTransform>();

            rt.anchoredPosition = new Vector2(i * 320 + 150 + 10, 210 + 10);

            UIShopItem script = go.GetComponent <UIShopItem>();

            go.GetComponent <CanvasGroup>().alpha = 0;

            BETween bt1 = BETween.alpha(go, 0.1f, 0.0f, 1.0f);

            bt1.delay = 0.1f * (float)i + 0.2f;

            BETween bt2 = BETween.scale(go, 0.2f, Vector3.one, new Vector3(1.1f, 1.1f, 1.1f));

            bt2.delay     = bt1.delay;
            bt2.loopStyle = BETweenLoop.pingpong;

            return(script);
        }
コード例 #2
0
        // incase shop item is inapp
        public void FillInApp(int id, string TabName)
        {
            toggleButtons[id].transform.Find("Label").GetComponent <Text>().text = TabName;

            for (int i = 0; i < TBDatabase.GetInAppItemCount(); ++i)
            {
                UIShopItem script = AddShopItem(prefabShopItemGem, id, i);
                script.Init(TBDatabase.GetInAppItem(i));
            }

            contents[id].GetComponent <RectTransform>().sizeDelta = new Vector3(320 * TBDatabase.GetInAppItemCount(), 440);
        }
コード例 #3
0
        // incase shop item is building
        public void FillContents(int id, string TabName, List <BuildingType> list)
        {
            toggleButtons[id].transform.Find("Label").GetComponent <Text>().text = TabName;

            for (int i = 0; i < list.Count; ++i)
            {
                UIShopItem script = AddShopItem(prefabShopItem, id, i);
                script.Init(list[i]);
            }

            contents[id].GetComponent <RectTransform>().sizeDelta = new Vector3(320 * list.Count, 440);
        }