123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- using System;
- using UnityEngine.Playables;
- using UnityEngine.Timeline;
- namespace UnityEditor.Timeline
- {
-
-
-
-
-
-
- public readonly struct SequenceContext : IEquatable<SequenceContext>
- {
-
-
-
- public PlayableDirector director { get; }
-
-
-
-
-
- public TimelineClip clip { get; }
-
-
-
-
-
-
-
-
- public SequenceContext(PlayableDirector director, TimelineClip clip)
- {
- if (director == null)
- throw new ArgumentNullException(nameof(director));
- var parentTrack = clip?.GetParentTrack();
- if (clip != null && parentTrack == null)
- throw new ArgumentException("The provided clip must be part of a track", nameof(clip));
- if (clip != null && parentTrack.timelineAsset == null)
- throw new ArgumentException("The provided clip must be part of a Timeline.", nameof(clip));
- this.director = director;
- this.clip = clip;
- m_Valid = true;
- }
-
-
-
-
-
- public bool IsValid() => m_Valid;
-
-
-
-
-
-
- public static bool operator ==(SequenceContext left, SequenceContext right) => left.Equals(right);
-
-
-
-
-
-
- public static bool operator !=(SequenceContext left, SequenceContext right) => !left.Equals(right);
-
-
-
-
- public bool Equals(SequenceContext other)
- {
- return Equals(director, other.director) && Equals(clip, other.clip);
- }
-
-
-
-
- public override bool Equals(object obj)
- {
- return obj is SequenceContext other && Equals(other);
- }
-
-
-
-
- public override int GetHashCode()
- {
- unchecked
- {
- return ((director != null ? director.GetHashCode() : 0) * 397) ^ (clip != null ? clip.GetHashCode() : 0);
- }
- }
- internal static SequenceContext Invalid = new SequenceContext();
- readonly bool m_Valid;
- }
- }
|