public void InitScroll()
    {
        this.scroll     = base.GetComponent <ScrollRect>();
        this.totalPages = this.scroll.content.childCount;
        if (this.OnCompleteEvent != null)
        {
            this.OnCompleteEvent.Invoke(this.CurrentPageClamped);
        }
        UI_InfiniteScroll component = base.GetComponent <UI_InfiniteScroll>();

        component.Init();
        this.itemOffset = component.ItemSize;
    }
Ejemplo n.º 2
0
    void InstantiatePainting(GameObject prefabCard)
    {
        for (int i = 0; i < 5; i++)
        {
            var card   = Instantiate(prefabCard);
            var script = card.GetComponent <CardUIControl>();
            script.button.onClick.AddListener(OnClick_Paint);
            script.gradient.EffectGradient.SetKeys(currentGradient.colorKeys, currentGradient.alphaKeys);
            projectCards[i.ToString()] = script;
            horizontalScrollSnap.AddChild(card);
        }

        infiniteScroll.Init();
    }
    public void InitScroll(int page = 0)
    {
        this.scroll     = base.GetComponent <ScrollRect>();
        this.totalPages = this.scroll.content.childCount;
        this.step       = 1f / (float)(this.totalPages - 1);
        if (this.OnCompleteEvent != null)
        {
            this.OnCompleteEvent.Invoke(this.GetRelativePage(null));
        }
        if (page > 0)
        {
            this.currentPage = page;
            this.scroll.horizontalNormalizedPosition = this.step * (float)page;
        }
        UI_InfiniteScroll component = base.GetComponent <UI_InfiniteScroll>();

        component.Init();
    }