25 lines
982 B
C#
25 lines
982 B
C#
using Cryville.Common;
|
|
using Cryville.Common.Buffers;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Cryville.Crtr.Event {
|
|
internal class RMVPool : CategorizedPool<Identifier, RealtimeMotionValue> {
|
|
private class Bucket : ObjectPool<RealtimeMotionValue> {
|
|
readonly MotionRegistry _reg;
|
|
public Bucket(Identifier name, int capacity) : base(capacity) {
|
|
_reg = ChartPlayer.motionRegistry[name];
|
|
}
|
|
protected override RealtimeMotionValue Construct() {
|
|
return new RealtimeMotionValue().Init(_reg.InitValue);
|
|
}
|
|
}
|
|
readonly Dictionary<Identifier, ObjectPool<RealtimeMotionValue>> m_buckets;
|
|
protected override IReadOnlyDictionary<Identifier, ObjectPool<RealtimeMotionValue>> Buckets { get { return m_buckets; } }
|
|
public RMVPool() {
|
|
m_buckets = new Dictionary<Identifier, ObjectPool<RealtimeMotionValue>>(ChartPlayer.motionRegistry.Count);
|
|
foreach (var reg in ChartPlayer.motionRegistry)
|
|
m_buckets.Add(reg.Key, new Bucket(reg.Key, 4096));
|
|
}
|
|
}
|
|
}
|