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 <UText>(); CurDesc.RichName.text = ""; CurDesc.IsAnimation = false; CurDesc.Show(true); CurDesc.transform.SetAsLastSibling(); CurDesc.Name.CrossFadeAlpha(0, 0f, true); Title.NameText = fragment.GetName(); if (fragment.IsNewPage) { CurDesc.RichName.Content = ""; CanvasGroup.alpha = 0.0f; TweenAlpha = DOTween.To(() => CanvasGroup.alpha, (x) => CanvasGroup.alpha = x, 1.0f, 0.3f); CurDesc.Name.CrossFadeAlpha(1, 0.5f, true); } else { string temp = fragment.GetDesc(); CurDesc.Name.CrossFadeAlpha(1, 0.5f, true); } CurDesc.RichName.Content = fragment.GetDesc(); CurDesc.RichName.RefreshRichText(); Sprite preSprite = Image.Icon.sprite; Sprite newSprite = fragment.GetIcon(); if (newSprite != null) { Image.Icon.sprite = newSprite; } Title.Show(fragment.CurPage == 0); Image.Show(true); }
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); }