Code cleanup.
This commit is contained in:
@@ -95,8 +95,8 @@ namespace Cryville.Crtr.Event {
|
||||
Parent = parent;
|
||||
}
|
||||
|
||||
_rmvpa = new CategorizedPoolAccessor<int, RealtimeMotionValue>(RMVPool);
|
||||
_mcpa = new CategorizedPoolAccessor<int, MotionCache>(MCPool);
|
||||
_rmvpa = new CategorizedPoolAccessor<int, RealtimeMotionValue>(RMVPool.Shared);
|
||||
_mcpa = new CategorizedPoolAccessor<int, MotionCache>(MotionCachePool.Shared);
|
||||
|
||||
Values = new IntKeyedDictionary<RealtimeMotionValue>(ChartPlayer.motionRegistry.Count);
|
||||
CachedValues = new IntKeyedDictionary<MotionCache>(ChartPlayer.motionRegistry.Count);
|
||||
@@ -151,7 +151,7 @@ namespace Cryville.Crtr.Event {
|
||||
return r;
|
||||
}
|
||||
|
||||
public void CopyTo(byte ct, ContainerState dest) {
|
||||
public void CopyTo(ContainerState dest) {
|
||||
dest.m_lActive = m_lActive;
|
||||
dest.m_pActive = m_pActive;
|
||||
dest.m_active = m_active;
|
||||
@@ -174,12 +174,12 @@ namespace Cryville.Crtr.Event {
|
||||
|
||||
foreach (var cev in dest.ActiveChildren) {
|
||||
if (!ActiveChildren.Contains(cev))
|
||||
Children[cev].CopyTo(ct, dest.Children[cev]);
|
||||
Children[cev].CopyTo(dest.Children[cev]);
|
||||
}
|
||||
dest.ActiveChildren.Clear();
|
||||
foreach (var cev in ActiveChildren) {
|
||||
dest.ActiveChildren.Add(cev);
|
||||
Children[cev].CopyTo(ct, dest.Children[cev]);
|
||||
Children[cev].CopyTo(dest.Children[cev]);
|
||||
}
|
||||
|
||||
dest.PlayingMotions.Clear();
|
||||
@@ -221,8 +221,6 @@ namespace Cryville.Crtr.Event {
|
||||
#endregion
|
||||
|
||||
#region Motion
|
||||
internal static RMVPool RMVPool;
|
||||
internal static MotionCachePool MCPool;
|
||||
readonly CategorizedPoolAccessor<int, RealtimeMotionValue> _rmvpa;
|
||||
readonly CategorizedPoolAccessor<int, MotionCache> _mcpa;
|
||||
Dictionary<StampedEvent, RealtimeMotionValue> PlayingMotions = new Dictionary<StampedEvent, RealtimeMotionValue>(4);
|
||||
|
@@ -38,11 +38,11 @@ namespace Cryville.Crtr.Event {
|
||||
return r;
|
||||
}
|
||||
|
||||
public void CopyTo(byte ct, EventBus dest) {
|
||||
public void CopyTo(EventBus dest) {
|
||||
base.CopyTo(dest);
|
||||
dest.activeStates.Clear();
|
||||
dest.invalidatedStates.Clear();
|
||||
RootState.CopyTo(ct, dest.RootState);
|
||||
RootState.CopyTo(dest.RootState);
|
||||
dest.ValidateStates();
|
||||
}
|
||||
|
||||
@@ -150,10 +150,10 @@ namespace Cryville.Crtr.Event {
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
void HandleTempEvents(double time, int maxPriority = int.MaxValue) {
|
||||
while (tempEvents.Count > 0) {
|
||||
var ev2 = tempEvents[0];
|
||||
if (ev2.Time != time || ev2.Priority >= maxPriority) break;
|
||||
if (ev2.Container != null) {
|
||||
states[ev2.Container].Handle(ev2);
|
||||
var ev = tempEvents[0];
|
||||
if (ev.Time != time || ev.Priority >= maxPriority) break;
|
||||
if (ev.Container != null) {
|
||||
states[ev.Container].Handle(ev);
|
||||
}
|
||||
tempEvents.RemoveAt(0);
|
||||
}
|
||||
@@ -178,6 +178,10 @@ namespace Cryville.Crtr.Event {
|
||||
}
|
||||
public void EndGraphicalUpdate() {
|
||||
RootState.EndGraphicalUpdate();
|
||||
ClearTempEvents();
|
||||
}
|
||||
|
||||
void ClearTempEvents() {
|
||||
foreach (var ev in tempEvents) {
|
||||
if (ev.Container != null) {
|
||||
states[ev.Container].Discard(ev);
|
||||
|
@@ -14,6 +14,7 @@ namespace Cryville.Crtr.Event {
|
||||
}
|
||||
}
|
||||
internal class MotionCachePool : CategorizedPool<int, MotionCache> {
|
||||
public static MotionCachePool Shared;
|
||||
private class Bucket : ObjectPool<MotionCache> {
|
||||
readonly MotionRegistry _reg;
|
||||
public Bucket(Identifier name, int capacity) : base(capacity) {
|
||||
|
@@ -5,6 +5,7 @@ using System.Collections.Generic;
|
||||
|
||||
namespace Cryville.Crtr.Event {
|
||||
internal class RMVPool : CategorizedPool<int, RealtimeMotionValue> {
|
||||
public static RMVPool Shared;
|
||||
private class Bucket : ObjectPool<RealtimeMotionValue> {
|
||||
readonly MotionRegistry _reg;
|
||||
public Bucket(Identifier name, int capacity) : base(capacity) {
|
||||
|
Reference in New Issue
Block a user