コード例 #1
0
    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;
    }
コード例 #2
0
ファイル: HomeController.cs プロジェクト: hanniiel/unityhome
    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();
    }
コード例 #3
0
    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();
    }