Esempio n. 1
0
        private void TryWork()
        {
            rectTran = this.transform as RectTransform;
            switch (config.dir)
            {
            case GridLayoutGroup.Axis.Horizontal:
            {
                (rectTran.parent as RectTransform).pivot = new Vector2(0, 0.5f);
                rectTran.anchorMin = new Vector2(0, 0.5f);
                rectTran.anchorMax = new Vector2(0, 0.5f);
            }
            break;

            case GridLayoutGroup.Axis.Vertical:
            {
                (rectTran.parent as RectTransform).pivot = new Vector2(0.5f, 1.0f);
                rectTran.anchorMin = new Vector2(0.5f, 1.0f);
                rectTran.anchorMax = new Vector2(0.5f, 1.0f);
            }
            break;
            }
            rectTran.pivot = new Vector2(0, 1);

            JerryUtil.DestroyAllChildren(this.transform, true);

            ResetPos();
            ResetDelta();
        }
    private void DoClean()
    {
        if (m_Center)
        {
            iTween.Stop(m_ContentRect.gameObject);
            this.StopCoroutine("DoCenter");
        }

        m_ScrollRect.onValueChanged.RemoveListener(OnScrollChange);
        JerryUtil.DestroyAllChildren(m_ContentRect);
        m_Child.Clear();
        m_ScrollRect.enabled = false;
    }
        private void TryWork()
        {
            if (!awaked ||
                !inited)
            {
                return;
            }

            rectTran = this.transform as RectTransform;
            switch (config.dir)
            {
            case GridLayoutGroup.Axis.Horizontal:
            {
                (rectTran.parent as RectTransform).pivot = new Vector2(0, 0.5f);
                rectTran.anchorMin = new Vector2(0, 0.5f);
                rectTran.anchorMax = new Vector2(0, 0.5f);
                fiexdDirViewCountF = config.dirViewLen / (config.cellSize.x + config.spacing.x);
            }
            break;

            case GridLayoutGroup.Axis.Vertical:
            {
                (rectTran.parent as RectTransform).pivot = new Vector2(0.5f, 1.0f);
                rectTran.anchorMin = new Vector2(0.5f, 1.0f);
                rectTran.anchorMax = new Vector2(0.5f, 1.0f);
                fiexdDirViewCountF = config.dirViewLen / (config.cellSize.y + config.spacing.y);
            }
            break;
            }
            rectTran.pivot = new Vector2(0, 1);

            fiexdDirViewCount = Mathf.CeilToInt(fiexdDirViewCountF);
            config.progress   = Mathf.Clamp01(config.progress);

            itemList.Clear();
            JerryUtil.DestroyAllChildren(this.transform, false);

            curFirstIdx = -1;
            ResetPos();
            ResetDelta();

            ready = true;
        }