28 lines
735 B
C#
28 lines
735 B
C#
using UnityEngine;
|
|
using UnityEngine.Playables;
|
|
using UnityEngine.Timeline;
|
|
|
|
namespace Streamingle.Subtitles
|
|
{
|
|
public sealed class SubtitleClip : PlayableAsset, ITimelineClipAsset
|
|
{
|
|
[SerializeField, TextArea(1, 3)]
|
|
private string text = string.Empty;
|
|
|
|
public string Text
|
|
{
|
|
get => text;
|
|
set => text = value ?? string.Empty;
|
|
}
|
|
|
|
public ClipCaps clipCaps => ClipCaps.None;
|
|
|
|
public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
|
|
{
|
|
var playable = ScriptPlayable<SubtitleBehaviour>.Create(graph);
|
|
playable.GetBehaviour().Text = text ?? string.Empty;
|
|
return playable;
|
|
}
|
|
}
|
|
}
|