备份CatanBuilding瘦身独立工程

This commit is contained in:
JSD\13999
2026-05-26 16:15:54 +08:00
commit 2d0e6a61b7
12001 changed files with 2431925 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: ff79ab0c89530f24d8f60162bd4c1009
folderAsset: yes
timeCreated: 1507311562
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,70 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated July 28, 2023. Replaces all prior versions.
*
* Copyright (c) 2013-2023, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software or
* otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THE
* SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
//using UnityEngine.Playables;
using Spine;
using Spine.Unity;
using Spine.Unity.Playables;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Spine.Unity.Playables {
[AddComponentMenu("Spine/Playables/SkeletonAnimation Playable Handle (Playables)")]
public class SkeletonAnimationPlayableHandle : SpinePlayableHandleBase {
#region Inspector
public SkeletonAnimation skeletonAnimation;
#if UNITY_EDITOR
void Reset () {
InitializeReference();
}
void OnValidate () {
InitializeReference();
}
#endif
#endregion
public override Skeleton Skeleton { get { return skeletonAnimation.Skeleton; } }
public override SkeletonData SkeletonData { get { return skeletonAnimation.Skeleton.Data; } }
void Awake () {
InitializeReference();
}
void InitializeReference () {
if (skeletonAnimation == null)
skeletonAnimation = GetComponent<SkeletonAnimation>();
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: bd5f4cbc0a51cc24b86e5f70151bc0c3
timeCreated: 1507311603
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,70 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated July 28, 2023. Replaces all prior versions.
*
* Copyright (c) 2013-2023, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software or
* otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THE
* SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
//using UnityEngine.Playables;
using Spine;
using Spine.Unity;
using Spine.Unity.Playables;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Spine.Unity.Playables {
[AddComponentMenu("Spine/Playables/SkeletonGraphic Playable Handle (Playables)")]
public class SkeletonGraphicPlayableHandle : SpinePlayableHandleBase {
#region Inspector
public SkeletonGraphic skeletonGraphic;
#if UNITY_EDITOR
void Reset () {
InitializeReference();
}
void OnValidate () {
InitializeReference();
}
#endif
#endregion
public override Skeleton Skeleton { get { return skeletonGraphic.Skeleton; } }
public override SkeletonData SkeletonData { get { return skeletonGraphic.Skeleton.Data; } }
void Awake () {
InitializeReference();
}
void InitializeReference () {
if (skeletonGraphic == null)
skeletonGraphic = GetComponent<SkeletonGraphic>();
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 51a0223d4dee020468302946c8ccd329
timeCreated: 1595439279
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,58 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated July 28, 2023. Replaces all prior versions.
*
* Copyright (c) 2013-2023, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software or
* otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THE
* SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//using UnityEngine.Playables;
namespace Spine.Unity.Playables {
public delegate void SpineEventDelegate (Spine.Event e);
/// <summary>Base class for Spine Playable Handle components, commonly for integrating with UnityEngine Timeline.</summary>
public abstract class SpinePlayableHandleBase : MonoBehaviour {
/// <summary>Gets the SkeletonData of the targeted Spine component.</summary>
public abstract SkeletonData SkeletonData { get; }
public abstract Skeleton Skeleton { get; }
/// <summary>Subscribe to this to handle user events played by the Unity playable</summary>
public event SpineEventDelegate AnimationEvents;
public virtual void HandleEvents (ExposedList<Event> eventBuffer) {
if (eventBuffer == null || AnimationEvents == null) return;
for (int i = 0, n = eventBuffer.Count; i < n; i++)
AnimationEvents.Invoke(eventBuffer.Items[i]);
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 2dfbb56974b17984ca2534bc8185f665
timeCreated: 1507311422
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 47adfa0aa094be548be25e178c1435d2
folderAsset: yes
timeCreated: 1510816616
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,77 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated July 28, 2023. Replaces all prior versions.
*
* Copyright (c) 2013-2023, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software or
* otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THE
* SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
using Spine;
using Spine.Unity;
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.Timeline;
namespace Spine.Unity.Playables {
using Animation = Spine.Animation;
[Serializable]
public class SpineAnimationStateBehaviour : PlayableBehaviour {
[NonSerialized] public TimelineClip timelineClip;
public AnimationReferenceAsset animationReference;
public bool loop;
// Mix Properties
public bool customDuration = false;
public bool useBlendDuration = true;
[SerializeField]
#pragma warning disable 414
private bool isInitialized = false; // required to read preferences values from editor side.
#pragma warning restore 414
public float mixDuration = 0.1f;
public bool holdPrevious = false;
public bool dontPauseWithDirector = false;
[UnityEngine.Serialization.FormerlySerializedAs("dontPauseOnStop")]
public bool dontEndWithClip = false;
public float endMixOutDuration = 0.1f;
[Range(0, 1f)]
public float attachmentThreshold = 0.5f;
[Range(0, 1f)]
public float eventThreshold = 0.5f;
[Range(0, 1f)]
public float drawOrderThreshold = 0.5f;
[Range(0, 1f)]
public float alpha = 1.0f;
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 82bd6e7ec1121b5428c447b7bd16b042
timeCreated: 1510816616
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,60 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated July 28, 2023. Replaces all prior versions.
*
* Copyright (c) 2013-2023, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software or
* otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THE
* SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
using System;
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.Timeline;
namespace Spine.Unity.Playables {
[Serializable]
public class SpineAnimationStateClip : PlayableAsset, ITimelineClipAsset {
public SpineAnimationStateBehaviour template = new SpineAnimationStateBehaviour();
public ClipCaps clipCaps { get { return ClipCaps.Blending | ClipCaps.ClipIn | ClipCaps.SpeedMultiplier | (template.loop ? ClipCaps.Looping : 0); } }
[NonSerialized] public TimelineClip timelineClip;
public override Playable CreatePlayable (PlayableGraph graph, GameObject owner) {
template.timelineClip = this.timelineClip;
var playable = ScriptPlayable<SpineAnimationStateBehaviour>.Create(graph, template);
playable.GetBehaviour();
return playable;
}
public override double duration {
get {
if (template.animationReference == null || template.animationReference.Animation == null)
return 0;
return template.animationReference.Animation.Duration;
}
}
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 585e20c924ba86a44926c850aa8e1d84
timeCreated: 1510816616
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,70 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated July 28, 2023. Replaces all prior versions.
*
* Copyright (c) 2013-2023, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software or
* otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THE
* SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#if UNITY_EDITOR
using System.ComponentModel;
#endif
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.Timeline;
namespace Spine.Unity.Playables {
[TrackColor(255 / 255.0f, 64 / 255.0f, 1 / 255.0f)]
[TrackClipType(typeof(SpineAnimationStateClip))]
[TrackBindingType(typeof(SkeletonGraphic))]
#if UNITY_EDITOR
[DisplayName("Spine/SkeletonGraphic Track")]
#endif
public class SpineAnimationStateGraphicTrack : TrackAsset {
public int trackIndex = 0;
[Tooltip("Whenever starting a new animation clip of this track, " +
"SkeletonGraphic.UnscaledTime will be set to this value. " +
"This allows you to play back Timeline clips either in normal game time " +
"or unscaled game time. Note that PlayableDirector.UpdateMethod " +
"is ignored and replaced by this property, which allows more fine-granular " +
"control per Timeline track.")]
public bool unscaledTime = false;
public override Playable CreateTrackMixer (PlayableGraph graph, GameObject go, int inputCount) {
IEnumerable<TimelineClip> clips = this.GetClips();
foreach (TimelineClip clip in clips) {
SpineAnimationStateClip animationStateClip = clip.asset as SpineAnimationStateClip;
if (animationStateClip != null)
animationStateClip.timelineClip = clip;
}
var scriptPlayable = ScriptPlayable<SpineAnimationStateMixerBehaviour>.Create(graph, inputCount);
SpineAnimationStateMixerBehaviour mixerBehaviour = scriptPlayable.GetBehaviour();
mixerBehaviour.trackIndex = this.trackIndex;
mixerBehaviour.unscaledTime = this.unscaledTime;
return scriptPlayable;
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 72a1f4f2e8b6c194bbdabda6998a77e1
timeCreated: 1595440391
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,407 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated July 28, 2023. Replaces all prior versions.
*
* Copyright (c) 2013-2023, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software or
* otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THE
* SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#if UNITY_2019_1_OR_NEWER
#define SPEED_INCLUDED_IN_CLIP_TIME
#endif
#if UNITY_EDITOR
#define SPINE_EDITMODEPOSE
#endif
using System;
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.Timeline;
namespace Spine.Unity.Playables {
public class SpineAnimationStateMixerBehaviour : PlayableBehaviour {
float[] lastInputWeights;
bool lastAnyClipPlaying = false;
public int trackIndex;
public bool unscaledTime;
ScriptPlayable<SpineAnimationStateBehaviour>[] startingClips
= new ScriptPlayable<SpineAnimationStateBehaviour>[2];
IAnimationStateComponent animationStateComponent;
bool pauseWithDirector = true;
bool endAtClipEnd = true;
float endMixOutDuration = 0.1f;
bool isPaused = false;
TrackEntry pausedTrackEntry;
float previousTimeScale = 1;
float rootPlayableSpeed = 1;
TrackEntry timelineStartedTrackEntry;
public override void OnBehaviourPause (Playable playable, FrameData info) {
if (pauseWithDirector) {
if (!isPaused)
HandlePause(playable);
isPaused = true;
}
}
public override void OnGraphStop (Playable playable) {
bool isStoppedNotPaused = playable.GetGraph().IsPlaying(); // end of track was reached or graph stopped.
if (isStoppedNotPaused && endAtClipEnd)
HandleClipEnd();
}
public override void OnBehaviourPlay (Playable playable, FrameData info) {
if (isPaused)
HandleResume(playable);
isPaused = false;
}
protected void HandlePause (Playable playable) {
if (animationStateComponent.IsNullOrDestroyed()) return;
TrackEntry current = animationStateComponent.AnimationState.GetCurrent(trackIndex);
if (current != null && current == timelineStartedTrackEntry) {
previousTimeScale = current.TimeScale;
current.TimeScale = 0;
pausedTrackEntry = current;
}
}
protected void HandleResume (Playable playable) {
if (animationStateComponent.IsNullOrDestroyed()) return;
TrackEntry current = animationStateComponent.AnimationState.GetCurrent(trackIndex);
if (current != null && current == pausedTrackEntry) {
current.TimeScale = previousTimeScale;
}
}
protected void HandleClipEnd () {
if (animationStateComponent.IsNullOrDestroyed()) return;
AnimationState state = animationStateComponent.AnimationState;
if (endAtClipEnd &&
timelineStartedTrackEntry != null &&
timelineStartedTrackEntry == state.GetCurrent(trackIndex)) {
if (endMixOutDuration >= 0)
state.SetEmptyAnimation(trackIndex, endMixOutDuration);
else // pause if endMixOutDuration < 0
timelineStartedTrackEntry.TimeScale = 0;
timelineStartedTrackEntry = null;
}
}
private void AdjustTrackEntryTimeScale (Playable playable, int input, TrackEntry currentTrackEntry) {
if (currentTrackEntry == null)
return;
ScriptPlayable<SpineAnimationStateBehaviour> clipPlayable = (ScriptPlayable<SpineAnimationStateBehaviour>)playable.GetInput(input);
float clipSpeed = (float)clipPlayable.GetSpeed();
SpineAnimationStateBehaviour clipData = clipPlayable.GetBehaviour();
if (clipData != null && clipData.animationReference != null
&& currentTrackEntry.Animation == clipData.animationReference.Animation) {
currentTrackEntry.TimeScale = clipSpeed * rootPlayableSpeed;
}
}
// NOTE: This function is called at runtime and edit time. Keep that in mind when setting the values of properties.
public override void ProcessFrame (Playable playable, FrameData info, object playerData) {
SkeletonAnimation skeletonAnimation = playerData as SkeletonAnimation;
SkeletonGraphic skeletonGraphic = playerData as SkeletonGraphic;
animationStateComponent = playerData as IAnimationStateComponent;
ISkeletonComponent skeletonComponent = playerData as ISkeletonComponent;
if (animationStateComponent.IsNullOrDestroyed() || skeletonComponent == null) return;
Skeleton skeleton = skeletonComponent.Skeleton;
AnimationState state = animationStateComponent.AnimationState;
if (!Application.isPlaying) {
#if SPINE_EDITMODEPOSE
PreviewEditModePose(playable, skeletonComponent, animationStateComponent,
skeletonAnimation, skeletonGraphic);
#endif
return;
}
int inputCount = playable.GetInputCount();
float previousRootSpeed = rootPlayableSpeed;
rootPlayableSpeed = GetRootPlayableSpeed(playable);
bool rootSpeedChanged = previousRootSpeed != rootPlayableSpeed;
// Ensure correct buffer size.
if (this.lastInputWeights == null || this.lastInputWeights.Length < inputCount) {
this.lastInputWeights = new float[inputCount];
for (int i = 0; i < inputCount; i++)
this.lastInputWeights[i] = default(float);
}
float[] lastInputWeights = this.lastInputWeights;
int numStartingClips = 0;
bool anyClipPlaying = false;
// Check all clips. If a clip that was weight 0 turned into weight 1, call SetAnimation.
for (int i = 0; i < inputCount; i++) {
float lastInputWeight = lastInputWeights[i];
float inputWeight = playable.GetInputWeight(i);
bool clipStarted = (inputWeight > 0) && (lastInputWeight == 0 || info.seekOccurred || info.timeLooped);
if (inputWeight > 0)
anyClipPlaying = true;
lastInputWeights[i] = inputWeight;
if (clipStarted) {
if (numStartingClips < 2) {
ScriptPlayable<SpineAnimationStateBehaviour> clipPlayable = (ScriptPlayable<SpineAnimationStateBehaviour>)playable.GetInput(i);
startingClips[numStartingClips++] = clipPlayable;
}
} else if (rootSpeedChanged) {
TrackEntry currentEntry = state.GetCurrent(trackIndex);
AdjustTrackEntryTimeScale(playable, i, currentEntry);
}
}
// unfortunately order of clips can be wrong when two start at the same time, we have to sort clips
if (numStartingClips == 2) {
ScriptPlayable<SpineAnimationStateBehaviour> clipPlayable0 = startingClips[0];
ScriptPlayable<SpineAnimationStateBehaviour> clipPlayable1 = startingClips[1];
if (clipPlayable0.GetDuration() > clipPlayable1.GetDuration()) { // swap, clip 0 ends after clip 1
startingClips[0] = clipPlayable1;
startingClips[1] = clipPlayable0;
}
}
for (int j = 0; j < numStartingClips; ++j) {
ScriptPlayable<SpineAnimationStateBehaviour> clipPlayable = startingClips[j];
SpineAnimationStateBehaviour clipData = clipPlayable.GetBehaviour();
pauseWithDirector = !clipData.dontPauseWithDirector;
endAtClipEnd = !clipData.dontEndWithClip;
endMixOutDuration = clipData.endMixOutDuration;
if (clipData.animationReference == null) {
float mixDuration = clipData.customDuration ? GetCustomMixDuration(clipData) : state.Data.DefaultMix;
state.SetEmptyAnimation(trackIndex, mixDuration);
} else {
if (clipData.animationReference.Animation != null) {
animationStateComponent.UnscaledTime = this.unscaledTime;
TrackEntry currentEntry = state.GetCurrent(trackIndex);
Spine.TrackEntry trackEntry;
float customMixDuration = clipData.customDuration ? GetCustomMixDuration(clipData) : 0.0f;
if (currentEntry == null && customMixDuration > 0) {
state.SetEmptyAnimation(trackIndex, 0); // ease in requires empty animation
trackEntry = state.AddAnimation(trackIndex, clipData.animationReference.Animation, clipData.loop, 0);
} else
trackEntry = state.SetAnimation(trackIndex, clipData.animationReference.Animation, clipData.loop);
float clipSpeed = (float)clipPlayable.GetSpeed();
trackEntry.EventThreshold = clipData.eventThreshold;
trackEntry.DrawOrderThreshold = clipData.drawOrderThreshold;
#if SPEED_INCLUDED_IN_CLIP_TIME
trackEntry.TrackTime = (float)clipPlayable.GetTime();
#else
trackEntry.TrackTime = (float)clipPlayable.GetTime() * rootPlayableSpeed * clipSpeed;
#endif
trackEntry.TimeScale = clipSpeed * rootPlayableSpeed;
trackEntry.AttachmentThreshold = clipData.attachmentThreshold;
trackEntry.HoldPrevious = clipData.holdPrevious;
trackEntry.Alpha = clipData.alpha;
if (clipData.customDuration)
trackEntry.MixDuration = customMixDuration / rootPlayableSpeed;
timelineStartedTrackEntry = trackEntry;
}
}
}
if (numStartingClips > 0) {
if (skeletonAnimation) {
skeletonAnimation.Update(0);
skeletonAnimation.LateUpdate();
} else if (skeletonGraphic) {
skeletonGraphic.Update(0);
skeletonGraphic.LateUpdate();
}
}
startingClips[0] = startingClips[1] = ScriptPlayable<SpineAnimationStateBehaviour>.Null;
if (lastAnyClipPlaying && !anyClipPlaying)
HandleClipEnd();
this.lastAnyClipPlaying = anyClipPlaying;
}
#if SPINE_EDITMODEPOSE
/// <summary>Animation event callback for editor scripts when outside of play-mode.</summary>
public static event AnimationState.TrackEntryEventDelegate EditorEvent;
AnimationState dummyAnimationState;
ExposedList<Spine.Event> editorAnimationEvents = new ExposedList<Event>();
public void PreviewEditModePose (Playable playable,
ISkeletonComponent skeletonComponent, IAnimationStateComponent animationStateComponent,
SkeletonAnimation skeletonAnimation, SkeletonGraphic skeletonGraphic) {
if (Application.isPlaying) return;
if (animationStateComponent.IsNullOrDestroyed() || skeletonComponent == null) return;
editorAnimationEvents.Clear(false);
int inputCount = playable.GetInputCount();
float rootSpeed = GetRootPlayableSpeed(playable);
int lastNonZeroWeightTrack = -1;
for (int i = 0; i < inputCount; i++) {
float inputWeight = playable.GetInputWeight(i);
if (inputWeight > 0) lastNonZeroWeightTrack = i;
}
if (lastNonZeroWeightTrack != -1) {
ScriptPlayable<SpineAnimationStateBehaviour> inputPlayableClip =
(ScriptPlayable<SpineAnimationStateBehaviour>)playable.GetInput(lastNonZeroWeightTrack);
SpineAnimationStateBehaviour clipData = inputPlayableClip.GetBehaviour();
Skeleton skeleton = skeletonComponent.Skeleton;
bool skeletonDataMismatch = clipData.animationReference != null && clipData.animationReference.SkeletonDataAsset &&
skeletonComponent.SkeletonDataAsset.GetSkeletonData(true) != clipData.animationReference.SkeletonDataAsset.GetSkeletonData(true);
if (skeletonDataMismatch) {
Debug.LogWarningFormat("SpineAnimationStateMixerBehaviour tried to apply an animation for the wrong skeleton. Expected {0}. Was {1}",
skeletonComponent.SkeletonDataAsset, clipData.animationReference.SkeletonDataAsset);
}
// Getting the from-animation here because it's required to get the mix information from AnimationStateData.
Animation fromAnimation = null;
float fromClipTime = 0;
bool fromClipLoop = false;
if (lastNonZeroWeightTrack != 0 && inputCount > 1) {
var fromClip = (ScriptPlayable<SpineAnimationStateBehaviour>)playable.GetInput(lastNonZeroWeightTrack - 1);
SpineAnimationStateBehaviour fromClipData = fromClip.GetBehaviour();
fromAnimation = fromClipData.animationReference != null ? fromClipData.animationReference.Animation : null;
#if SPEED_INCLUDED_IN_CLIP_TIME
fromClipTime = (float)fromClip.GetTime();
#else
fromClipTime = (float)fromClip.GetTime() * (float)fromClip.GetSpeed() * rootSpeed;
#endif
fromClipLoop = fromClipData.loop;
}
Animation toAnimation = clipData.animationReference != null ? clipData.animationReference.Animation : null;
#if SPEED_INCLUDED_IN_CLIP_TIME
float toClipTime = (float)inputPlayableClip.GetTime();
#else
float toClipTime = (float)inputPlayableClip.GetTime() * (float)inputPlayableClip.GetSpeed() * rootSpeed;
#endif
float mixDuration = clipData.mixDuration;
if (!clipData.customDuration && fromAnimation != null && toAnimation != null) {
mixDuration = animationStateComponent.AnimationState.Data.GetMix(fromAnimation, toAnimation);
}
if (trackIndex == 0)
skeleton.SetToSetupPose();
// Approximate what AnimationState might do at runtime.
if (fromAnimation != null && mixDuration > 0 && toClipTime < mixDuration) {
dummyAnimationState = dummyAnimationState ?? new AnimationState(skeletonComponent.SkeletonDataAsset.GetAnimationStateData());
TrackEntry toEntry = dummyAnimationState.GetCurrent(0);
TrackEntry fromEntry = toEntry != null ? toEntry.MixingFrom : null;
bool isAnimationTransitionMatch = (toEntry != null && toEntry.Animation == toAnimation && fromEntry != null && fromEntry.Animation == fromAnimation);
if (!isAnimationTransitionMatch) {
dummyAnimationState.ClearTracks();
fromEntry = dummyAnimationState.SetAnimation(0, fromAnimation, fromClipLoop);
fromEntry.AllowImmediateQueue();
if (toAnimation != null) {
toEntry = dummyAnimationState.SetAnimation(0, toAnimation, clipData.loop);
toEntry.HoldPrevious = clipData.holdPrevious;
toEntry.Alpha = clipData.alpha;
}
}
// Update track times.
fromEntry.TrackTime = fromClipTime;
if (toEntry != null) {
toEntry.TrackTime = toClipTime;
toEntry.MixTime = toClipTime;
}
// Apply Pose
dummyAnimationState.Event += EditorEvent;
dummyAnimationState.Update(0);
dummyAnimationState.Apply(skeleton);
dummyAnimationState.Event -= EditorEvent;
} else {
if (toAnimation != null) {
toAnimation.Apply(skeleton, 0, toClipTime, clipData.loop, editorAnimationEvents, clipData.alpha, MixBlend.Setup, MixDirection.In);
if (EditorEvent != null) {
foreach (Spine.Event e in editorAnimationEvents) {
EditorEvent(null, e);
}
}
}
}
skeleton.UpdateWorldTransform();
if (skeletonAnimation) {
skeletonAnimation.AfterAnimationApplied();
skeletonAnimation.LateUpdate();
} else if (skeletonGraphic) {
skeletonGraphic.AfterAnimationApplied();
skeletonGraphic.LateUpdate();
}
}
// Do nothing outside of the first clip and the last clip.
}
#endif
float GetRootPlayableSpeed (Playable playable) {
PlayableGraph graph = playable.GetGraph();
int rootPlayableCount = graph.GetRootPlayableCount();
if (rootPlayableCount == 1)
return (float)graph.GetRootPlayable(0).GetSpeed();
else {
for (int rootIndex = 0; rootIndex < rootPlayableCount; ++rootIndex) {
Playable rootPlayable = graph.GetRootPlayable(rootIndex);
for (int i = 0, n = rootPlayable.GetInputCount(); i < n; ++i) {
Playable playableChild = rootPlayable.GetInput(i);
if (playableChild.Equals(playable)) {
return (float)rootPlayable.GetSpeed();
}
}
}
}
return 1.0f;
}
float GetCustomMixDuration (SpineAnimationStateBehaviour clipData) {
if (clipData.useBlendDuration) {
TimelineClip clip = clipData.timelineClip;
return (float)Math.Max(clip.blendInDuration, clip.easeInDuration);
} else {
return clipData.mixDuration;
}
}
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: f61d2f4ac1c4ad044bf4ae6e63b0eca8
timeCreated: 1510816616
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,70 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated July 28, 2023. Replaces all prior versions.
*
* Copyright (c) 2013-2023, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software or
* otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THE
* SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#if UNITY_EDITOR
using System.ComponentModel;
#endif
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.Timeline;
namespace Spine.Unity.Playables {
[TrackColor(255 / 255.0f, 64 / 255.0f, 1 / 255.0f)]
[TrackClipType(typeof(SpineAnimationStateClip))]
[TrackBindingType(typeof(SkeletonAnimation))]
#if UNITY_EDITOR
[DisplayName("Spine/SkeletonAnimation Track")]
#endif
public class SpineAnimationStateTrack : TrackAsset {
public int trackIndex = 0;
[Tooltip("Whenever starting a new animation clip of this track, " +
"SkeletonAnimation.UnscaledTime will be set to this value. " +
"This allows you to play back Timeline clips either in normal game time " +
"or unscaled game time. Note that PlayableDirector.UpdateMethod " +
"is ignored and replaced by this property, which allows more fine-granular " +
"control per Timeline track.")]
public bool unscaledTime = false;
public override Playable CreateTrackMixer (PlayableGraph graph, GameObject go, int inputCount) {
IEnumerable<TimelineClip> clips = this.GetClips();
foreach (TimelineClip clip in clips) {
SpineAnimationStateClip animationStateClip = clip.asset as SpineAnimationStateClip;
if (animationStateClip != null)
animationStateClip.timelineClip = clip;
}
var scriptPlayable = ScriptPlayable<SpineAnimationStateMixerBehaviour>.Create(graph, inputCount);
SpineAnimationStateMixerBehaviour mixerBehaviour = scriptPlayable.GetBehaviour();
mixerBehaviour.trackIndex = this.trackIndex;
mixerBehaviour.unscaledTime = this.unscaledTime;
return scriptPlayable;
}
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: dfabb056a779ae34b9ebd7de425c868b
timeCreated: 1510816616
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 3099d730dd2a9e349b3d918960cb42fa
folderAsset: yes
timeCreated: 1500876410
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,38 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated July 28, 2023. Replaces all prior versions.
*
* Copyright (c) 2013-2023, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software or
* otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THE
* SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
using System;
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.Timeline;
[Serializable]
public class SpineSkeletonFlipBehaviour : PlayableBehaviour {
public bool flipX, flipY;
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 3740378c8a8da8042991fbbe4b4a2094
timeCreated: 1500876411
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,47 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated July 28, 2023. Replaces all prior versions.
*
* Copyright (c) 2013-2023, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software or
* otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THE
* SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
using System;
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.Timeline;
[Serializable]
public class SpineSkeletonFlipClip : PlayableAsset, ITimelineClipAsset {
public SpineSkeletonFlipBehaviour template = new SpineSkeletonFlipBehaviour();
public ClipCaps clipCaps {
get { return ClipCaps.None; }
}
public override Playable CreatePlayable (PlayableGraph graph, GameObject owner) {
var playable = ScriptPlayable<SpineSkeletonFlipBehaviour>.Create(graph, template);
return playable;
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 0a29ac408b701f84c93882fb506759d1
timeCreated: 1500876411
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,134 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated July 28, 2023. Replaces all prior versions.
*
* Copyright (c) 2013-2023, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software or
* otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THE
* SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#if UNITY_2018_1_OR_NEWER
#define PLAYABLE_DIRECTOR_HAS_STOPPED_EVENT
#endif
using Spine.Unity;
using System;
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.Timeline;
namespace Spine.Unity.Playables {
public class SpineSkeletonFlipMixerBehaviour : PlayableBehaviour {
float originalScaleX, originalScaleY;
float baseScaleX, baseScaleY;
SpinePlayableHandleBase playableHandle;
bool m_FirstFrameHappened;
#if PLAYABLE_DIRECTOR_HAS_STOPPED_EVENT
PlayableDirector director = null;
public override void OnPlayableCreate (Playable playable) {
director = playable.GetGraph().GetResolver() as PlayableDirector;
if (director)
director.stopped += OnDirectorStopped;
}
public override void OnPlayableDestroy (Playable playable) {
if (director)
director.stopped -= OnDirectorStopped;
base.OnPlayableDestroy(playable);
}
void OnDirectorStopped (PlayableDirector obj) {
OnStop();
}
#else
public override void OnGraphStop (Playable playable) {
OnStop();
}
#endif
public override void ProcessFrame (Playable playable, FrameData info, object playerData) {
playableHandle = playerData as SpinePlayableHandleBase;
if (playableHandle == null)
return;
Skeleton skeleton = playableHandle.Skeleton;
if (!m_FirstFrameHappened) {
originalScaleX = skeleton.ScaleX;
originalScaleY = skeleton.ScaleY;
baseScaleX = Mathf.Abs(originalScaleX);
baseScaleY = Mathf.Abs(originalScaleY);
m_FirstFrameHappened = true;
}
int inputCount = playable.GetInputCount();
float totalWeight = 0f;
float greatestWeight = 0f;
int currentInputs = 0;
for (int i = 0; i < inputCount; i++) {
float inputWeight = playable.GetInputWeight(i);
ScriptPlayable<SpineSkeletonFlipBehaviour> inputPlayable = (ScriptPlayable<SpineSkeletonFlipBehaviour>)playable.GetInput(i);
SpineSkeletonFlipBehaviour input = inputPlayable.GetBehaviour();
totalWeight += inputWeight;
if (inputWeight > greatestWeight) {
SetSkeletonScaleFromFlip(skeleton, input.flipX, input.flipY);
greatestWeight = inputWeight;
}
if (!Mathf.Approximately(inputWeight, 0f))
currentInputs++;
}
if (currentInputs != 1 && 1f - totalWeight > greatestWeight) {
skeleton.ScaleX = originalScaleX;
skeleton.ScaleY = originalScaleY;
}
}
public void SetSkeletonScaleFromFlip (Skeleton skeleton, bool flipX, bool flipY) {
skeleton.ScaleX = flipX ? -baseScaleX : baseScaleX;
skeleton.ScaleY = flipY ? -baseScaleY : baseScaleY;
}
public void OnStop () {
m_FirstFrameHappened = false;
if (playableHandle == null)
return;
Skeleton skeleton = playableHandle.Skeleton;
skeleton.ScaleX = originalScaleX;
skeleton.ScaleY = originalScaleY;
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: f25dcf1fb34ab8643ac8734e57a9540f
timeCreated: 1500876411
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,68 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated July 28, 2023. Replaces all prior versions.
*
* Copyright (c) 2013-2023, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software or
* otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THE
* SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#if UNITY_EDITOR
using System.ComponentModel;
#endif
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.Timeline;
namespace Spine.Unity.Playables {
[TrackColor(0.855f, 0.8623f, 0.87f)]
[TrackClipType(typeof(SpineSkeletonFlipClip))]
[TrackBindingType(typeof(SpinePlayableHandleBase))]
#if UNITY_EDITOR
[DisplayName("Spine/Skeleton Flip Track")]
#endif
public class SpineSkeletonFlipTrack : TrackAsset {
public override Playable CreateTrackMixer (PlayableGraph graph, GameObject go, int inputCount) {
return ScriptPlayable<SpineSkeletonFlipMixerBehaviour>.Create(graph, inputCount);
}
public override void GatherProperties (PlayableDirector director, IPropertyCollector driver) {
#if UNITY_EDITOR
SpinePlayableHandleBase trackBinding = director.GetGenericBinding(this) as SpinePlayableHandleBase;
if (trackBinding == null)
return;
UnityEditor.SerializedObject serializedObject = new UnityEditor.SerializedObject(trackBinding);
UnityEditor.SerializedProperty iterator = serializedObject.GetIterator();
while (iterator.NextVisible(true)) {
if (iterator.hasVisibleChildren)
continue;
driver.AddFromName<SpinePlayableHandleBase>(trackBinding.gameObject, iterator.propertyPath);
}
#endif
base.GatherProperties(director, driver);
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 82ac803eb1878814bba380a18b6b5d9d
timeCreated: 1500876411
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,17 @@
{
"name": "spine-timeline",
"references": [
"spine-unity",
"spine-csharp",
"Unity.Timeline"
],
"optionalUnityReferences": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": []
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: d081815e631c29f46ab6f2ac745854df
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: