A lot of stuff to Commit because I forgot to Commit in between (Don't do stuff like this, kids)
This commit is contained in:
@@ -6,8 +6,10 @@ public class MyButtonTrackMixer : PlayableBehaviour
|
||||
public override void ProcessFrame(Playable playable, FrameData info, object playerData)
|
||||
{
|
||||
var myButton = playerData as MyButton;
|
||||
|
||||
if(!myButton){return;}
|
||||
|
||||
myButton!.isActive = false;
|
||||
myButton.isActive = false;
|
||||
|
||||
for (var i = 0; i < playable.GetInputCount(); i++)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Playables;
|
||||
using UnityEngine.Timeline;
|
||||
|
||||
[TrackBindingType(typeof(TextMeshProUGUI))]
|
||||
[TrackClipType(typeof(SubtitleTrackClip))]
|
||||
public class SubtitleTrack : TrackAsset
|
||||
{
|
||||
public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
|
||||
{
|
||||
return ScriptPlayable<SubtitleTrackMixer>.Create(graph, inputCount);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cf966904c89cec546b53a94cd9de7805
|
||||
@@ -0,0 +1,7 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Playables;
|
||||
|
||||
public class SubtitleTrackBehaviour : PlayableBehaviour
|
||||
{
|
||||
public string subtitleText;
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1b3d76d457153a040aacb9ede466c956
|
||||
@@ -0,0 +1,17 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Playables;
|
||||
|
||||
public class SubtitleTrackClip : PlayableAsset
|
||||
{
|
||||
public string subtitleText;
|
||||
|
||||
public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
|
||||
{
|
||||
var playable = ScriptPlayable<SubtitleTrackBehaviour>.Create(graph);
|
||||
|
||||
var subtitleTrackBehaviour = playable.GetBehaviour();
|
||||
subtitleTrackBehaviour.subtitleText = subtitleText;
|
||||
|
||||
return playable;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1d30b6f2f1cc7954e9c7fed4e91c53a2
|
||||
@@ -0,0 +1,31 @@
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Playables;
|
||||
|
||||
public class SubtitleTrackMixer : PlayableBehaviour
|
||||
{
|
||||
public override void ProcessFrame(Playable playable, FrameData info, object playerData)
|
||||
{
|
||||
var text = playerData as TextMeshProUGUI;
|
||||
|
||||
var currentText = "";
|
||||
|
||||
if (!text) { return; }
|
||||
|
||||
for (var i = 0; i < playable.GetInputCount(); i++)
|
||||
{
|
||||
if (playable.GetInputWeight(i) <=0)
|
||||
continue;
|
||||
|
||||
var inputPlayable = (ScriptPlayable<SubtitleTrackBehaviour>)playable.GetInput(i);
|
||||
var input = inputPlayable.GetBehaviour();
|
||||
|
||||
if (input.subtitleText != "")
|
||||
{
|
||||
currentText = input.subtitleText;
|
||||
}
|
||||
}
|
||||
|
||||
text.text = currentText;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ce87fa1edd37b85438c2c455cbaf4f70
|
||||
Reference in New Issue
Block a user