Example #1
0
        public bool Init(Fabric fabric, int index)
        {
            try
            {
                this.index = index;

                if (FB_name != null)
                {
                    this.FB_name.text = fabric.f_title;
                }
                if (FB_thumbnail != null)
                {
                    FB_thumbnail.sprite = null;
                    fabric.LoadThumbnail(
                        (sprite) =>
                    {
                        ToggleProgressElements(false);
                        FB_thumbnail.sprite = sprite;
                    },
                        (progress) =>
                    {
                        ToggleProgressElements(true);
                        progressBar.fillAmount = progress;
                    });
                }
                if (FB_button != null)
                {
                    FB_button.onClick.AddListener(() => OnClick(this.index));
                }
            }

            catch (Exception exception)
            {
                EventSystem.current.SetSelectedGameObject(null);
                EventSystem.current.SetSelectedGameObject(FB_button.gameObject);
                DebugHelper.Log(exception.Message);
                return(false);
            }

            return(true);
        }