コード例 #1
0
        void InitPackageList()
        {
            oLoading.SetActive(true);
            var packages = Repository.shared.GetAllPackages();

            oLoading.SetActive(false);
            for (int i = 0; i < 6; i++)
            {
                var item = Instantiate(packageItemPrefab, transform.position, Quaternion.identity);
                item.transform.SetParent(transform);
                item.transform.localScale = new Vector3(1, 1, 1);
                // item.SetActive(false);
                if (i < packages.Length)
                {
                    AdaptItem(item, packages[i]);
                }
                else
                {
                    item.transform.Find("Name").GetComponent <Text>().text = "获取DLC";
                    item.transform.Find("Progress").gameObject.SetActive(false);
                    item.GetComponent <Button>().onClick.AddListener(() => {
                        var data  = new PackageClickEventData();
                        data.type = EventType.PackageItemClick;
                        GlobalEvent.shared.Invoke(data);
                    });
                }
                item.SetActive(false);
                CoroutineUtils.Start(AnimateShowItem(item, i * 0.05f));
            }
        }
コード例 #2
0
 public void Awake()
 {
     transform.Query <Button>("Content/BtnContinue").onClick.AddListener(() => {
         gameObject.SetActive(false);
         var data     = new PackageClickEventData();
         data.type    = EventType.PackageItemClick;
         data.package = package;
         GlobalEvent.shared.Invoke(data);
     });
 }