1
This commit is contained in:
38
Assets/Scripts/UI/DialogUI/TextFrame.cs
Normal file
38
Assets/Scripts/UI/DialogUI/TextFrame.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using DG.Tweening;
|
||||
using DG.Tweening.Core;
|
||||
using DG.Tweening.Plugins.Options;
|
||||
using I2.Loc;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Ichni.Story
|
||||
{
|
||||
public class TextFrame : MonoBehaviour
|
||||
{
|
||||
public GameObject textPrefab;
|
||||
public RectTransform textContainer;
|
||||
|
||||
private TweenerCore<string, string, StringOptions> contentTween;
|
||||
public bool isPlayingSentence;
|
||||
|
||||
public void PlaySentence(string speakerName, string content)
|
||||
{
|
||||
GameObject contentText = Instantiate(textPrefab, textContainer);
|
||||
contentText.transform.GetChild(1).GetComponent<TMP_Text>().text = speakerName;
|
||||
contentText.transform.GetChild(2).GetComponent<TMP_Text>().text = content;
|
||||
//contentText.GetComponent<Localize>().OnLocalize();
|
||||
}
|
||||
|
||||
public void FinishSentence()
|
||||
{
|
||||
if (isPlayingSentence)
|
||||
{
|
||||
contentTween.Complete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user