public void Show(TDBaseTalkData talkData, TDBaseTalkFragment talkFragment) { CurTalkData = talkData; CurTalkFragment = talkFragment; Show(true, true); if (Icon != null) { Icon.Icon.overrideSprite = GetIcon(talkData, talkFragment); } if (Name != null) { Name.NameText = GetName(talkData, talkFragment); } if (PreAudioSource != null) { PreAudioSource.Stop(); } PreAudioSource = PlayClip(GetAudio(talkData, talkFragment)); Desc.NameText = ""; Desc.IsAnimation = false; if (Tween != null) { Tween.Kill(); } Tween = DOTween.To(() => Desc.RichName.Content, (x) => Desc.RichName.Content = x, talkFragment.GetDesc(), 0.5f) .SetDelay(0.5f) .OnComplete(OnTypeEnd) .OnStart(OnTweenStart); bool isHaveOpt = talkData.IsHaveOption() && talkFragment.IsLasted; DP_Select.Show(isHaveOpt); if (isHaveOpt) { TextLayoutElement.minHeight = 50.0f; } else { TextLayoutElement.minHeight = 100.0f; } }
protected void Show(TDBaseTalkData talkData, TDBaseTalkFragment fragment) { ShowOff(); if (fragment.Type == TalkType.Left) { LeftItem.Trans.SetAsLastSibling(); LeftItem.Show(talkData, fragment); } else if (fragment.Type == TalkType.Right) { RightItem.Trans.SetAsLastSibling(); RightItem.Show(talkData, fragment); } else if (fragment.Type == TalkType.Mid) { MidItem.Trans.SetAsLastSibling(); MidItem.Show(talkData, fragment); } }
protected virtual string GetAudio(TDBaseTalkData talkData, TDBaseTalkFragment talkFragment) { return(talkFragment.Audio); }
protected virtual string GetName(TDBaseTalkData talkData, TDBaseTalkFragment talkFragment) { return(talkFragment.GetName()); }
protected virtual Sprite GetIcon(TDBaseTalkData talkData, TDBaseTalkFragment talkFragment) { return(talkFragment.GetIcon()); }