Implement anchor related annotations.

This commit is contained in:
2023-01-28 11:57:49 +08:00
parent c4b139c7a4
commit 10988847b3
3 changed files with 24 additions and 6 deletions

View File

@@ -77,7 +77,7 @@ namespace Cryville.Crtr.Event {
a_head = RegisterAnchor(_a_head);
a_tail = RegisterAnchor(_a_tail);
}
protected Anchor RegisterAnchor(int name, int propSrcCount = 0) {
public Anchor RegisterAnchor(int name, int propSrcCount = 0) {
var go = new GameObject("." + IdentifierManager.SharedInstance.Retrieve(name)).transform;
go.SetParent(gogroup, false);
var result = new Anchor(name, go, propSrcCount);
@@ -129,7 +129,15 @@ namespace Cryville.Crtr.Event {
}
static readonly SimpleObjectPool<StampedEvent.Anchor> anchorEvPool
= new SimpleObjectPool<StampedEvent.Anchor>(1024);
protected void PushAnchorEvent(double time, Anchor anchor) {
public void PushAnchorEvent(double time, int name) {
List<Anchor> anchors;
if (!Anchors.TryGetValue(name, out anchors))
throw new ArgumentException(string.Format("Specified anchor \"{0}\" not found", IdentifierManager.SharedInstance.Retrieve(name)));
if (anchors.Count != 1)
throw new InvalidOperationException(string.Format("Cannot set a static anchor \"{0}\"", IdentifierManager.SharedInstance.Retrieve(name)));
PushAnchorEvent(time, anchors[0]);
}
void PushAnchorEvent(double time, Anchor anchor) {
var tev = anchorEvPool.Rent();
tev.Time = time;
tev.Container = Container;

View File

@@ -50,7 +50,7 @@ namespace Cryville.Crtr.Event {
}
}
public byte CloneType;
private ContainerState rootPrototype = null;
public ContainerState rootPrototype = null;
private ContainerState prototype = null;
public ContainerHandler Handler {