Пример #1
0
        protected GameObject getCacheLabel()
        {
            GameObject ret = null;
            int        len = _cacheLabElements.Count;

            for (int i = 0; i < len; i++)
            {
                LRichCacheElement cacheElem = _cacheLabElements[i];
                if (cacheElem.isUse == false)
                {
                    cacheElem.isUse = true;
                    ret             = cacheElem.node;
                    break;
                }
            }
            if (ret == null)
            {
                ret = new GameObject();
                ret.AddComponent <Text>();
                ContentSizeFitter fit = ret.AddComponent <ContentSizeFitter>();
                fit.verticalFit   = ContentSizeFitter.FitMode.PreferredSize;
                fit.horizontalFit = ContentSizeFitter.FitMode.PreferredSize;

                RectTransform rtran = ret.GetComponent <RectTransform>();
                rtran.pivot     = Vector2.zero;
                rtran.anchorMax = new Vector2(0, 1);
                rtran.anchorMin = new Vector2(0, 1);

                LRichCacheElement cacheElem = new LRichCacheElement(ret);
                cacheElem.isUse = true;
                _cacheLabElements.Add(cacheElem);
            }
            return(ret);
        }
Пример #2
0
        protected GameObject getCacheFramAnim()
        {
            GameObject gameObject = null;
            int        count      = this._cacheFramAnimElements.Count;

            for (int i = 0; i < count; i++)
            {
                LRichCacheElement lRichCacheElement = this._cacheFramAnimElements[i];
                bool flag = !lRichCacheElement.isUse;
                if (flag)
                {
                    lRichCacheElement.isUse = true;
                    gameObject = lRichCacheElement.node;
                    break;
                }
            }
            bool flag2 = gameObject == null;

            if (flag2)
            {
                gameObject = new GameObject();
                gameObject.AddComponent <Image>();
                ContentSizeFitter contentSizeFitter = gameObject.AddComponent <ContentSizeFitter>();
                contentSizeFitter.verticalFit   = ContentSizeFitter.FitMode.PreferredSize;
                contentSizeFitter.horizontalFit = ContentSizeFitter.FitMode.PreferredSize;
                RectTransform component = gameObject.GetComponent <RectTransform>();
                component.pivot = Vector2.zero;
                switch (this.pivotType)
                {
                case RichPivotType.LEFT_TOP:
IL_BE:
                    component.anchorMax = new Vector2(0f, 1f);
                    component.anchorMin = new Vector2(0f, 1f);
                    goto IL_181;

                case RichPivotType.LEFT_BOTTOM:
                    component.anchorMax = new Vector2(0f, 0f);
                    component.anchorMin = new Vector2(0f, 0f);
                    goto IL_181;

                case RichPivotType.RIGHT_BOTTOM:
                    component.anchorMax = new Vector2(1f, 0f);
                    component.anchorMin = new Vector2(1f, 0f);
                    goto IL_181;

                case RichPivotType.RIGHT_TOP:
                    component.anchorMax = new Vector2(1f, 1f);
                    component.anchorMin = new Vector2(1f, 1f);
                    goto IL_181;
                }
                goto IL_BE;
IL_181:
                gameObject.AddComponent <LMovieClip>();
                LRichCacheElement lRichCacheElement2 = new LRichCacheElement(gameObject);
                lRichCacheElement2.isUse = true;
                this._cacheFramAnimElements.Add(lRichCacheElement2);
            }
            return(gameObject);
        }
Пример #3
0
        protected GameObject getCacheImage(bool isFitSize)
        {
            GameObject ret = null;
            int        len = _cacheLabElements.Count;

            for (int i = 0; i < len; i++)
            {
                LRichCacheElement cacheElem = _cacheLabElements[i];
                if (cacheElem.isUse == false)
                {
                    cacheElem.isUse = true;
                    ret             = cacheElem.node;
                    break;
                }
            }
            if (ret == null)
            {
                ret = new GameObject();
                ret.AddComponent <Image>();
                ContentSizeFitter fit = ret.AddComponent <ContentSizeFitter>();
                fit.verticalFit   = ContentSizeFitter.FitMode.PreferredSize;
                fit.horizontalFit = ContentSizeFitter.FitMode.PreferredSize;

                RectTransform rtran = ret.GetComponent <RectTransform>();
                rtran.pivot = Vector2.zero;
                switch (pivotType)
                {
                default:
                case RichPivotType.LEFT_TOP:
                    rtran.anchorMax = new Vector2(0, 1);
                    rtran.anchorMin = new Vector2(0, 1);
                    break;

                case RichPivotType.LEFT_BOTTOM:
                    rtran.anchorMax = new Vector2(0, 0);
                    rtran.anchorMin = new Vector2(0, 0);
                    break;

                case RichPivotType.RIGHT_TOP:
                    rtran.anchorMax = new Vector2(1, 1);
                    rtran.anchorMin = new Vector2(1, 1);
                    break;

                case RichPivotType.RIGHT_BOTTOM:
                    rtran.anchorMax = new Vector2(1, 0);
                    rtran.anchorMin = new Vector2(1, 0);
                    break;
                }

                LRichCacheElement cacheElem = new LRichCacheElement(ret);
                cacheElem.isUse = true;
                _cacheLabElements.Add(cacheElem);
            }
            ContentSizeFitter fitCom = ret.GetComponent <ContentSizeFitter>();

            fitCom.enabled = isFitSize;
            return(ret);
        }
Пример #4
0
        protected GameObject getCacheLabel()
        {
            GameObject ret = null;
            int len = _cacheLabElements.Count;
            for (int i = 0; i < len; i++)
            {
                LRichCacheElement cacheElem = _cacheLabElements[i];
                if (cacheElem.isUse == false)
                {
                    cacheElem.isUse = true;
                    ret = cacheElem.node;
                    break;
                }
            }
            if (ret == null)
            {
                ret = new GameObject();
                ret.AddComponent<Text>();
                ContentSizeFitter fit = ret.AddComponent<ContentSizeFitter>();
                fit.verticalFit = ContentSizeFitter.FitMode.PreferredSize;
                fit.horizontalFit = ContentSizeFitter.FitMode.PreferredSize;

                RectTransform rtran = ret.GetComponent<RectTransform>();
                rtran.pivot = Vector2.zero;
                rtran.anchorMax = new Vector2(0, 1);
                rtran.anchorMin = new Vector2(0, 1);

                LRichCacheElement cacheElem = new LRichCacheElement(ret);
                cacheElem.isUse = true;
                _cacheLabElements.Add(cacheElem);
            }
            return ret;
        }