Add temporary event discard handling.
This commit is contained in:
@@ -136,6 +136,11 @@ namespace Cryville.Crtr.Event {
|
|||||||
tev.Target = anchor;
|
tev.Target = anchor;
|
||||||
ts.Bus.PushTempEvent(tev);
|
ts.Bus.PushTempEvent(tev);
|
||||||
}
|
}
|
||||||
|
public virtual void Discard(ContainerState s, StampedEvent ev) {
|
||||||
|
if (ev is StampedEvent.Anchor) {
|
||||||
|
anchorEvPool.Return((StampedEvent.Anchor)ev);
|
||||||
|
}
|
||||||
|
}
|
||||||
public virtual void Update(ContainerState s, StampedEvent ev) {
|
public virtual void Update(ContainerState s, StampedEvent ev) {
|
||||||
bool flag = !Awoken && s.CloneType >= 2 && s.CloneType < 16;
|
bool flag = !Awoken && s.CloneType >= 2 && s.CloneType < 16;
|
||||||
if (flag) PreAwake(s);
|
if (flag) PreAwake(s);
|
||||||
|
|||||||
@@ -314,6 +314,10 @@ namespace Cryville.Crtr.Event {
|
|||||||
Working = false;
|
Working = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Discard(StampedEvent ev) {
|
||||||
|
Handler.Discard(this, ev);
|
||||||
|
}
|
||||||
|
|
||||||
public void Handle(StampedEvent ev) {
|
public void Handle(StampedEvent ev) {
|
||||||
if (breakflag) return;
|
if (breakflag) return;
|
||||||
if (ev != null) {
|
if (ev != null) {
|
||||||
|
|||||||
@@ -121,6 +121,12 @@ namespace Cryville.Crtr.Event {
|
|||||||
_dummyEvent.Time = Time;
|
_dummyEvent.Time = Time;
|
||||||
var index = tempEvents.BinarySearch(_dummyEvent);
|
var index = tempEvents.BinarySearch(_dummyEvent);
|
||||||
if (index < 0) index = ~index;
|
if (index < 0) index = ~index;
|
||||||
|
for (var i = 0; i < index; i++) {
|
||||||
|
var ev = tempEvents[i];
|
||||||
|
if (ev.Container != null) {
|
||||||
|
states[ev.Container].Discard(ev);
|
||||||
|
}
|
||||||
|
}
|
||||||
tempEvents.RemoveRange(0, index);
|
tempEvents.RemoveRange(0, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user