Unity-jump-proj
This commit is contained in:
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b187fdd719f3ab1419cddfcf4df82273
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,24 @@
|
||||
#if TEXT_TRACK_REQUIRES_TEXTMESH_PRO
|
||||
|
||||
using UnityEditor.Timeline;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Timeline;
|
||||
|
||||
namespace Timeline.Samples
|
||||
{
|
||||
// Editor used by the TimelineEditor to customize the view of a TextPlayableAsset
|
||||
[CustomTimelineEditor(typeof(TextPlayableAsset))]
|
||||
public class TextPlayableAssetClipEditor : ClipEditor
|
||||
{
|
||||
// Called when a clip value, it's attached PlayableAsset, or an animation curve on a template is changed from the TimelineEditor.
|
||||
// This is used to keep the displayName of the clip matching the text of the PlayableAsset.
|
||||
public override void OnClipChanged(TimelineClip clip)
|
||||
{
|
||||
var textPlayableasset = clip.asset as TextPlayableAsset;
|
||||
if (textPlayableasset != null && !string.IsNullOrEmpty(textPlayableasset.template.text))
|
||||
clip.displayName = textPlayableasset.template.text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea4a94b44f92fb443bea87f1902ee5af
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "Timeline.Samples.Text.Editor",
|
||||
"references": [
|
||||
"GUID:f06555f75b070af458a003d92f9efb00",
|
||||
"GUID:02f771204943f4a40949438e873e3eff",
|
||||
"GUID:da34477545da90248a78a4ea3240faef"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [
|
||||
{
|
||||
"name": "com.unity.textmeshpro",
|
||||
"expression": "1.0.0",
|
||||
"define": "TEXT_TRACK_REQUIRES_TEXTMESH_PRO"
|
||||
},
|
||||
{
|
||||
"name": "com.unity.ugui",
|
||||
"expression": "2.0.0",
|
||||
"define": "TEXT_TRACK_REQUIRES_TEXTMESH_PRO"
|
||||
}
|
||||
],
|
||||
"noEngineReferences": false
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ae3df4209b2e9a740aedb8c25386ffcb
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,33 @@
|
||||
#if TEXT_TRACK_REQUIRES_TEXTMESH_PRO
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Playables;
|
||||
using UnityEngine.Timeline;
|
||||
|
||||
namespace Timeline.Samples
|
||||
{
|
||||
// Represents the serialized data for a clip on the TextTrack
|
||||
[Serializable]
|
||||
public class TextPlayableAsset : PlayableAsset, ITimelineClipAsset
|
||||
{
|
||||
[NoFoldOut]
|
||||
[NotKeyable] // NotKeyable used to prevent Timeline from making fields available for animation.
|
||||
public TextPlayableBehaviour template = new TextPlayableBehaviour();
|
||||
|
||||
// Implementation of ITimelineClipAsset. This specifies the capabilities of this timeline clip inside the editor.
|
||||
public ClipCaps clipCaps
|
||||
{
|
||||
get { return ClipCaps.Blending; }
|
||||
}
|
||||
|
||||
// Creates the playable that represents the instance of this clip.
|
||||
public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
|
||||
{
|
||||
// Using a template will clone the serialized values
|
||||
return ScriptPlayable<TextPlayableBehaviour>.Create(graph, template);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 23d50529701587b498a8994b10bd9a8d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,25 @@
|
||||
#if TEXT_TRACK_REQUIRES_TEXTMESH_PRO
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Playables;
|
||||
|
||||
namespace Timeline.Samples
|
||||
{
|
||||
// Runtime representation of a TextClip.
|
||||
// The Serializable attribute is required to be animated by timeline, and used as a template.
|
||||
[Serializable]
|
||||
public class TextPlayableBehaviour : PlayableBehaviour
|
||||
{
|
||||
[Tooltip("The color of the text")]
|
||||
public Color color = Color.white;
|
||||
|
||||
[Tooltip("The size of the font to use")]
|
||||
public int fontSize = 14;
|
||||
|
||||
[Tooltip("The text to display")]
|
||||
public string text = "";
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 61ca15cc7d3c19f4091714cbb5ca1590
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,48 @@
|
||||
#if TEXT_TRACK_REQUIRES_TEXTMESH_PRO
|
||||
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Playables;
|
||||
using UnityEngine.Timeline;
|
||||
|
||||
namespace Timeline.Samples
|
||||
{
|
||||
// A track that allows the user to change Text parameters from a Timeline.
|
||||
// It demonstrates the following
|
||||
// * How to support blending of timeline clips.
|
||||
// * How to change data over time on Components that is not supported by Animation.
|
||||
// * Putting properties into preview mode.
|
||||
// * Reacting to changes on the clip from the Timeline Editor.
|
||||
// Note: This track requires the TextMeshPro package to be installed in the project.
|
||||
[TrackColor(0.1394896f, 0.4411765f, 0.3413077f)]
|
||||
[TrackClipType(typeof(TextPlayableAsset))]
|
||||
[TrackBindingType(typeof(TMP_Text))]
|
||||
public class TextTrack : TrackAsset
|
||||
{
|
||||
// Creates a runtime instance of the track, represented by a PlayableBehaviour.
|
||||
// The runtime instance performs mixing on the timeline clips.
|
||||
public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
|
||||
{
|
||||
return ScriptPlayable<TextTrackMixerBehaviour>.Create(graph, inputCount);
|
||||
}
|
||||
|
||||
// Invoked by the timeline editor to put properties into preview mode. This permits the timeline
|
||||
// to temporarily change fields for the purpose of previewing in EditMode.
|
||||
public override void GatherProperties(PlayableDirector director, IPropertyCollector driver)
|
||||
{
|
||||
TMP_Text trackBinding = director.GetGenericBinding(this) as TMP_Text;
|
||||
if (trackBinding == null)
|
||||
return;
|
||||
|
||||
// The field names are the name of the backing serializable field. These can be found from the class source,
|
||||
// or from the unity scene file that contains an object of that type.
|
||||
driver.AddFromName<TMP_Text>(trackBinding.gameObject, "m_text");
|
||||
driver.AddFromName<TMP_Text>(trackBinding.gameObject, "m_fontSize");
|
||||
driver.AddFromName<TMP_Text>(trackBinding.gameObject, "m_fontColor");
|
||||
|
||||
base.GatherProperties(director, driver);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ed4c6dca4c6104146a980452cd07ed09
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,93 @@
|
||||
#if TEXT_TRACK_REQUIRES_TEXTMESH_PRO
|
||||
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Playables;
|
||||
|
||||
namespace Timeline.Samples
|
||||
{
|
||||
// The runtime instance of a the TextTrack. It is responsible for blending and setting the final data
|
||||
// on the Text binding
|
||||
public class TextTrackMixerBehaviour : PlayableBehaviour
|
||||
{
|
||||
Color m_DefaultColor;
|
||||
float m_DefaultFontSize;
|
||||
string m_DefaultText;
|
||||
|
||||
TMP_Text m_TrackBinding;
|
||||
|
||||
// Called every frame that the timeline is evaluated. ProcessFrame is invoked after its' inputs.
|
||||
public override void ProcessFrame(Playable playable, FrameData info, object playerData)
|
||||
{
|
||||
SetDefaults(playerData as TMP_Text);
|
||||
if (m_TrackBinding == null)
|
||||
return;
|
||||
|
||||
int inputCount = playable.GetInputCount();
|
||||
|
||||
Color blendedColor = Color.clear;
|
||||
float blendedFontSize = 0f;
|
||||
float totalWeight = 0f;
|
||||
float greatestWeight = 0f;
|
||||
string text = m_DefaultText;
|
||||
|
||||
for (int i = 0; i < inputCount; i++)
|
||||
{
|
||||
float inputWeight = playable.GetInputWeight(i);
|
||||
ScriptPlayable<TextPlayableBehaviour> inputPlayable = (ScriptPlayable<TextPlayableBehaviour>)playable.GetInput(i);
|
||||
TextPlayableBehaviour input = inputPlayable.GetBehaviour();
|
||||
|
||||
blendedColor += input.color * inputWeight;
|
||||
blendedFontSize += input.fontSize * inputWeight;
|
||||
totalWeight += inputWeight;
|
||||
|
||||
// use the text with the highest weight
|
||||
if (inputWeight > greatestWeight)
|
||||
{
|
||||
text = input.text;
|
||||
greatestWeight = inputWeight;
|
||||
}
|
||||
}
|
||||
|
||||
// blend to the default values
|
||||
m_TrackBinding.color = Color.Lerp(m_DefaultColor, blendedColor, totalWeight);
|
||||
m_TrackBinding.fontSize = Mathf.RoundToInt(Mathf.Lerp(m_DefaultFontSize, blendedFontSize, totalWeight));
|
||||
m_TrackBinding.text = text;
|
||||
}
|
||||
|
||||
// Invoked when the playable graph is destroyed, typically when PlayableDirector.Stop is called or the timeline
|
||||
// is complete.
|
||||
public override void OnPlayableDestroy(Playable playable)
|
||||
{
|
||||
RestoreDefaults();
|
||||
}
|
||||
|
||||
void SetDefaults(TMP_Text text)
|
||||
{
|
||||
if (text == m_TrackBinding)
|
||||
return;
|
||||
|
||||
RestoreDefaults();
|
||||
|
||||
m_TrackBinding = text;
|
||||
if (m_TrackBinding != null)
|
||||
{
|
||||
m_DefaultColor = m_TrackBinding.color;
|
||||
m_DefaultFontSize = m_TrackBinding.fontSize;
|
||||
m_DefaultText = m_TrackBinding.text;
|
||||
}
|
||||
}
|
||||
|
||||
void RestoreDefaults()
|
||||
{
|
||||
if (m_TrackBinding == null)
|
||||
return;
|
||||
|
||||
m_TrackBinding.color = m_DefaultColor;
|
||||
m_TrackBinding.fontSize = m_DefaultFontSize;
|
||||
m_TrackBinding.text = m_DefaultText;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4f0e82c973f49e941b1ac7a4f57e8d73
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,28 @@
|
||||
{
|
||||
"name": "Timeline.Samples.Text",
|
||||
"references": [
|
||||
"GUID:f06555f75b070af458a003d92f9efb00",
|
||||
"GUID:ef63a73cb159aa04997399c27d4eb08a",
|
||||
"GUID:6055be8ebefd69e48b49212b09b47b2f"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [
|
||||
{
|
||||
"name": "com.unity.textmeshpro",
|
||||
"expression": "1.0.0",
|
||||
"define": "TEXT_TRACK_REQUIRES_TEXTMESH_PRO"
|
||||
},
|
||||
{
|
||||
"name": "com.unity.ugui",
|
||||
"expression": "2.0.0",
|
||||
"define": "TEXT_TRACK_REQUIRES_TEXTMESH_PRO"
|
||||
}
|
||||
],
|
||||
"noEngineReferences": false
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: da34477545da90248a78a4ea3240faef
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user