public void OverwriteAllChunks(AbstractTrackChunk <T> chunk) { foreach (AbstractTrackChunk <T> c in chunks) { c.CopyFromChunk(chunk); } }
public void Initialize(AbstractDataTrack <T> track, AbstractTrackChunk <T> chunk) { this.Track = track; this.Chunk = chunk; this.Show(); OnInitialize(); }
public void CopyFromChunk(AbstractTrackChunk <T> other) { this.Snap = other.Snap; this.HarmonySequenceNumber = other.HarmonySequenceNumber; this.IsVariation = other.IsVariation; this.IntensityCurveType = other.IntensityCurveType; this.Data = track.CopyData(other.Data); }
public override void LoadFromData(TrackData data) { base.LoadFromData(data); foreach (TrackChunkData c in data.chunks) { AbstractTrackChunk <T> chunk = InstanceChunk(); chunk.InitializeFromSerializedData(timeline, this, timeline.GetTimelineRect(), c); chunk.UpdateTrackChunk(zoom, offset); this.chunks.Add(chunk); } }
public bool CanPlaceTrackChunk(float position, float width, AbstractTrackChunk <T> ignore = null) { if (position + width > 1f) { return(false); } foreach (AbstractTrackChunk <T> c in chunks) { if (c != ignore) { if ((position + width > c.Position && position + width < c.Position + c.Width) || (position > c.Position && position < c.Position + c.Width)) { return(false); } } } return(true); }
public void OnPointerClick(PointerEventData eventData) { if (eventData.button == PointerEventData.InputButton.Middle) { return; } Vector2 position = timeline.ScreenToNormalizedPosition(eventData.position); position.x = (position.x / zoom) + offset; float width = .05f / zoom; if (CanPlaceTrackChunk(position.x, width)) { T lastData = GetDefaultData(); AbstractTrackChunk <T> chunk = InstanceChunk(); chunk.Initialize(timeline, this, lastData, timeline.GetTimelineRect(), position.x, width); if (chunks.Count > 0) { AbstractTrackChunk <T> lastClosest = chunks.FindLast(x => x.Position < position.x); if (lastClosest) { chunk.CopyFromChunk(lastClosest); } else { chunk.CopyFromChunk(chunks[chunks.Count - 1]); } } chunk.UpdateTrackChunk(zoom, offset); this.chunks.Add(chunk); } }
public void RemoveChunk(AbstractTrackChunk <T> chunk) { chunks.Remove(chunk); GameObject.Destroy(chunk.gameObject); }
private void OnCopyChunk() { ClipboardChunk = Chunk; }