Пример #1
0
        public virtual void Show(NarrationFragment fragment)
        {
            Show(true);
            if (TweenText != null)
            {
                TweenText.Complete();
            }
            if (TweenAlpha != null)
            {
                TweenAlpha.Kill();
            }

            if (fragment.IsNewPage)
            {
                DescPool.DespawnAll();
            }

            GameObject tempGO = DescPool.Spawn();

            CurDesc = tempGO.GetComponent <BaseRichText>();
            CurDesc.RichText.text = "";
            CurDesc.IsAnimation   = false;
            CurDesc.Show(true);
            CurDesc.transform.SetAsLastSibling();

            Title.text = fragment.GetName();
            if (fragment.IsNewPage)
            {
                CurDesc.RichText.Content = "";
                CanvasGroup.alpha        = 0.0f;
                TweenAlpha = DOTween.To(() => CanvasGroup.alpha, (x) => CanvasGroup.alpha = x, 1.0f, 0.3f);
                TweenText  = DOTween.To(() => CurDesc.RichText.Content, (x) => CurDesc.RichText.Content = x, fragment.GetDesc(), 1.0f).SetDelay(0.5f).OnComplete(OnTypeEnd);
            }
            else
            {
                string temp = fragment.GetDesc();
                TweenText = DOTween.To(() => CurDesc.RichText.Content, (x) => CurDesc.RichText.Content = x, temp, 1.0f).OnComplete(OnTypeEnd);
            }
            var tempSprite = fragment.GetIcon();

            if (tempSprite)
            {
                Image.Image.sprite = tempSprite;
                Image.Image.CrossFadeAlpha(0.0f, 0.0f, true);
                Image.Image.CrossFadeAlpha(1.0f, 0.5f, true);
            }

            Title.Show((fragment.CurPage == 0));
            Image.Show(true);
        }