Code cleanup.
This commit is contained in:
@@ -64,35 +64,7 @@ namespace Cryville.Crtr.Event {
|
||||
}
|
||||
}
|
||||
|
||||
readonly RMVPool RMVPool = new RMVPool();
|
||||
readonly MotionCachePool MCPool = new MotionCachePool();
|
||||
Dictionary<StampedEvent, RealtimeMotionValue> PlayingMotions = new Dictionary<StampedEvent, RealtimeMotionValue>(4);
|
||||
Dictionary<Identifier, RealtimeMotionValue> Values;
|
||||
Dictionary<Identifier, MotionCache> CachedValues;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a motion value.
|
||||
/// </summary>
|
||||
/// <param name="name">The motion name.</param>
|
||||
/// <param name="clone">Returns a cloned motion value instead.</param>
|
||||
/// <returns>A motion value.</returns>
|
||||
RealtimeMotionValue GetMotionValue(Identifier name, bool clone = false) {
|
||||
RealtimeMotionValue value = Values[name];
|
||||
if (clone) return value.Clone();
|
||||
return value;
|
||||
}
|
||||
|
||||
void InvalidateMotion(Identifier name) {
|
||||
MotionCache cache;
|
||||
if (!CachedValues.TryGetValue(name, out cache))
|
||||
CachedValues.Add(name, cache = MCPool.Rent(name));
|
||||
cache.Valid = false;
|
||||
ValidateChildren();
|
||||
foreach (var c in WorkingChildren)
|
||||
Children[c].InvalidateMotion(name);
|
||||
}
|
||||
|
||||
public ContainerState(Chart c, EventContainer _ev, ContainerState parent = null) {
|
||||
public ContainerState(EventContainer _ev, ContainerState parent = null) {
|
||||
Container = _ev;
|
||||
|
||||
if (parent != null) {
|
||||
@@ -189,7 +161,7 @@ namespace Cryville.Crtr.Event {
|
||||
public void Dispose() {
|
||||
if (Disposed) return;
|
||||
Disposed = true;
|
||||
if (CloneType < 16 && Handler != null) Handler.Dispose();
|
||||
if (CloneType == 1) Handler.Dispose();
|
||||
foreach (var s in Children)
|
||||
s.Value.Dispose();
|
||||
RMVPool.ReturnAll();
|
||||
@@ -206,6 +178,35 @@ namespace Cryville.Crtr.Event {
|
||||
public void AttachSystems(PdtSkin skin, Judge judge) {
|
||||
Handler.AttachSystems(skin, judge);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Motion
|
||||
readonly RMVPool RMVPool = new RMVPool();
|
||||
readonly MotionCachePool MCPool = new MotionCachePool();
|
||||
Dictionary<StampedEvent, RealtimeMotionValue> PlayingMotions = new Dictionary<StampedEvent, RealtimeMotionValue>(4);
|
||||
Dictionary<Identifier, RealtimeMotionValue> Values;
|
||||
Dictionary<Identifier, MotionCache> CachedValues;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a motion value.
|
||||
/// </summary>
|
||||
/// <param name="name">The motion name.</param>
|
||||
/// <param name="clone">Returns a cloned motion value instead.</param>
|
||||
/// <returns>A motion value.</returns>
|
||||
RealtimeMotionValue GetMotionValue(Identifier name, bool clone = false) {
|
||||
RealtimeMotionValue value = Values[name];
|
||||
if (clone) return value.Clone();
|
||||
return value;
|
||||
}
|
||||
|
||||
void InvalidateMotion(Identifier name) {
|
||||
MotionCache cache;
|
||||
if (!CachedValues.TryGetValue(name, out cache))
|
||||
CachedValues.Add(name, cache = MCPool.Rent(name));
|
||||
cache.Valid = false;
|
||||
foreach (var c in ActiveChildren)
|
||||
Children[c].InvalidateMotion(name);
|
||||
}
|
||||
|
||||
public Vector GetRawValue(Identifier key) {
|
||||
MotionCache tr;
|
||||
@@ -299,7 +300,9 @@ namespace Cryville.Crtr.Event {
|
||||
return GetRawValue<Vec1>(n_track).Value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Update
|
||||
bool breakflag = false;
|
||||
|
||||
public void Break() {
|
||||
@@ -431,5 +434,6 @@ namespace Cryville.Crtr.Event {
|
||||
if (ls.Handler.Alive) ls.Anchor();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user