Add BeatTime properties.

This commit is contained in:
2022-10-28 12:00:12 +08:00
parent bd2e1747b7
commit 47b1314033
3 changed files with 31 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
using Cryville.Common.Pdt;
using System;
using RBeatTime = Cryville.Crtr.BeatTime;
namespace Cryville.Crtr {
public abstract class PropSrc {
@@ -55,5 +56,21 @@ namespace Cryville.Crtr {
}
}
}
public class BeatTime : PropSrc {
readonly Func<RBeatTime> _cb;
public BeatTime(Func<RBeatTime> cb) { _cb = cb; }
protected override unsafe void InternalGet(out int type, out byte[] value) {
var bt = _cb();
type = PdtInternalType.Vector;
value = new byte[4 * sizeof(int)];
fixed (byte* _ptr = value) {
int* ptr = (int*)_ptr;
*ptr++ = bt.b;
*ptr++ = bt.n;
*ptr++ = bt.d;
*ptr++ = PdtInternalType.Number;
}
}
}
}
}