38 lines
1.0 KiB
C#
38 lines
1.0 KiB
C#
|
|
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();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|