Add project files.

This commit is contained in:
2022-09-30 17:32:21 +08:00
parent df69e65c88
commit e8e36b83bd
561 changed files with 40626 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace Cryville.Crtr.Event {
public class EventBatch : IComparable<EventBatch>, IEnumerable<StampedEvent> {
public float Time {
get;
private set;
}
readonly List<StampedEvent> queue = new List<StampedEvent>();
public int Count {
get { return queue.Count; }
}
public EventBatch(float time) {
Time = time;
}
public StampedEvent this[int index] {
get { return queue[index]; }
}
public void Add(StampedEvent ev) {
Enqueue(ev);
}
public void Enqueue(StampedEvent ev) {
int i = queue.BinarySearch(ev);
if (i < 0) queue.Insert(~i, ev);
}
public int CompareTo(EventBatch other) {
return this.Time.CompareTo(other.Time);
}
public IEnumerator<StampedEvent> GetEnumerator() {
return queue.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator() {
return GetEnumerator();
}
}
}