Fix pre-graphical update not ended within a frame.
This commit is contained in:
@@ -157,11 +157,11 @@ namespace Cryville.Crtr.Event {
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
public virtual void Update(ContainerState s, StampedEvent ev) {
|
public virtual void Update(ContainerState s, StampedEvent ev) {
|
||||||
if (s.CloneType == 3) SetPreGraphicalActive(true, s);
|
if (ev is StampedEvent.Anchor) {
|
||||||
else if (ev is StampedEvent.Anchor) {
|
|
||||||
var tev = (StampedEvent.Anchor)ev;
|
var tev = (StampedEvent.Anchor)ev;
|
||||||
if (tev.Target == a_head) {
|
if (tev.Target == a_head) {
|
||||||
SetGraphicalActive(true, s);
|
if (s.CloneType == 2) SetGraphicalActive(true, s);
|
||||||
|
else SetPreGraphicalActive(true, s);
|
||||||
}
|
}
|
||||||
if (RootTransform) {
|
if (RootTransform) {
|
||||||
OpenAnchor(tev.Target);
|
OpenAnchor(tev.Target);
|
||||||
@@ -175,7 +175,8 @@ namespace Cryville.Crtr.Event {
|
|||||||
CloseAnchor();
|
CloseAnchor();
|
||||||
}
|
}
|
||||||
if (tev.Target == a_tail) {
|
if (tev.Target == a_tail) {
|
||||||
SetGraphicalActive(false, s);
|
if (s.CloneType == 2) SetGraphicalActive(false, s);
|
||||||
|
else SetPreGraphicalActive(false, s);
|
||||||
}
|
}
|
||||||
anchorEvPool.Return(tev);
|
anchorEvPool.Return(tev);
|
||||||
}
|
}
|
||||||
@@ -206,17 +207,21 @@ namespace Cryville.Crtr.Event {
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Anchor
|
#region Anchor
|
||||||
public virtual void PreAnchor() { }
|
public virtual void PreAnchor() {
|
||||||
public virtual void Anchor() {
|
|
||||||
foreach (var p in PropSrcs) p.Value.Invalidate();
|
foreach (var p in PropSrcs) p.Value.Invalidate();
|
||||||
foreach (var a in DynamicAnchors) DynamicAnchorSetTime[a.Key] = double.NaN;
|
foreach (var a in DynamicAnchors) DynamicAnchorSetTime[a.Key] = double.NaN;
|
||||||
atime_head = cs.StampedContainer.Time;
|
atime_head = cs.StampedContainer.Time;
|
||||||
atime_tail = atime_head + cs.StampedContainer.Duration;
|
atime_tail = atime_head + cs.StampedContainer.Duration;
|
||||||
MatchDynamic(cs, 1);
|
MatchDynamic(cs, 1);
|
||||||
foreach (var i in _comps) i.Tick(skinContainer, cs.Time);
|
foreach (var i in _comps) i.Tick(skinContainer, cs.Time);
|
||||||
if (cs.Active) PushAnchorEvent(cs.Time, a_cur);
|
|
||||||
if (double.IsNaN(DynamicAnchorSetTime[_a_head])) DynamicAnchorSetTime[_a_head] = atime_head;
|
if (double.IsNaN(DynamicAnchorSetTime[_a_head])) DynamicAnchorSetTime[_a_head] = atime_head;
|
||||||
if (double.IsNaN(DynamicAnchorSetTime[_a_tail])) DynamicAnchorSetTime[_a_tail] = atime_tail;
|
if (double.IsNaN(DynamicAnchorSetTime[_a_tail])) DynamicAnchorSetTime[_a_tail] = atime_tail;
|
||||||
|
PushAnchorEvent(ns, atime_head, a_head, -1, true);
|
||||||
|
PushAnchorEvent(ns, atime_tail, a_tail, 1, true);
|
||||||
|
foreach (var anchors in Anchors) foreach (var anchor in anchors.Value) anchor.Transform.gameObject.SetActive(false);
|
||||||
|
}
|
||||||
|
public virtual void Anchor() {
|
||||||
|
if (cs.Active) PushAnchorEvent(ts, cs.Time, a_cur);
|
||||||
foreach (var t in DynamicAnchorSetTime) {
|
foreach (var t in DynamicAnchorSetTime) {
|
||||||
if (double.IsNaN(t.Value)) continue;
|
if (double.IsNaN(t.Value)) continue;
|
||||||
int priority = 0;
|
int priority = 0;
|
||||||
@@ -224,20 +229,19 @@ namespace Cryville.Crtr.Event {
|
|||||||
if (t.Key == _a_head) { priority = -1; }
|
if (t.Key == _a_head) { priority = -1; }
|
||||||
else if (t.Key == _a_tail) { priority = 1; }
|
else if (t.Key == _a_tail) { priority = 1; }
|
||||||
else forced = false;
|
else forced = false;
|
||||||
PushAnchorEvent(t.Value, DynamicAnchors[t.Key], priority, forced);
|
PushAnchorEvent(ts, t.Value, DynamicAnchors[t.Key], priority, forced);
|
||||||
}
|
}
|
||||||
foreach (var anchors in Anchors) foreach (var anchor in anchors.Value) anchor.Transform.gameObject.SetActive(false);
|
|
||||||
}
|
}
|
||||||
static readonly SimpleObjectPool<StampedEvent.Anchor> anchorEvPool
|
static readonly SimpleObjectPool<StampedEvent.Anchor> anchorEvPool
|
||||||
= new SimpleObjectPool<StampedEvent.Anchor>(1024);
|
= new SimpleObjectPool<StampedEvent.Anchor>(1024);
|
||||||
void PushAnchorEvent(double time, Anchor anchor, int priority = 0, bool forced = false) {
|
void PushAnchorEvent(ContainerState state, double time, Anchor anchor, int priority = 0, bool forced = false) {
|
||||||
var tev = anchorEvPool.Rent();
|
var tev = anchorEvPool.Rent();
|
||||||
tev.Time = time;
|
tev.Time = time;
|
||||||
tev.Container = Container;
|
tev.Container = Container;
|
||||||
tev.Target = anchor;
|
tev.Target = anchor;
|
||||||
tev.Forced = forced;
|
tev.Forced = forced;
|
||||||
tev.SetPriority(priority);
|
tev.SetPriority(priority);
|
||||||
ts.Bus.PushTempEvent(tev);
|
state.Bus.PushTempEvent(tev);
|
||||||
}
|
}
|
||||||
public virtual void Discard(ContainerState s, StampedEvent ev) {
|
public virtual void Discard(ContainerState s, StampedEvent ev) {
|
||||||
if (ev is StampedEvent.Anchor) {
|
if (ev is StampedEvent.Anchor) {
|
||||||
|
|||||||
Reference in New Issue
Block a user