Example #1
0
        public void Show()
        {
            if (_chapterInfo == null)
            {
                return;
            }

            string  chapterBGTexturePath = ResPath.GetChapterBGPath(_chapterInfo.chapterData.chapterBG);
            Texture chapterBGTexture     = ResMgr.instance.Load <Texture>(chapterBGTexturePath);

            chapterBGRawImage.texture = chapterBGTexture;
            chapterBGRawImage.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, CHAPTER_BG_WIDTH);
            chapterBGRawImage.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, CHAPTER_BG_HEIGHT);

            Bounds bounds = RectTransformUtility.CalculateRelativeRectTransformBounds(transform);

            rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, bounds.size.x);
            rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, bounds.size.y);

            string  chapterBGLineTexturePath = ResPath.GetChapterBGPath(_chapterInfo.chapterData.chapterLineBG);
            Texture chapterBGLineTexture     = ResMgr.instance.Load <Texture>(chapterBGLineTexturePath);

            chapterBGLineRawImage.texture = chapterBGLineTexture;
            chapterBGRawImage.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, CHAPTER_BG_WIDTH);
            chapterBGRawImage.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, CHAPTER_BG_HEIGHT);
        }