Add BeatTime properties.
This commit is contained in:
@@ -124,8 +124,12 @@ namespace Cryville.Crtr {
|
|||||||
|
|
||||||
protected ChartEvent() {
|
protected ChartEvent() {
|
||||||
PropSrcs = new Dictionary<string, PropSrc>();
|
PropSrcs = new Dictionary<string, PropSrc>();
|
||||||
SubmitPropSrc("long", new PropSrc.Boolean(() => IsLong));
|
|
||||||
PropOps = new Dictionary<string, PropOp>();
|
PropOps = new Dictionary<string, PropOp>();
|
||||||
|
SubmitPropSrc("long", new PropSrc.Boolean(() => IsLong));
|
||||||
|
SubmitPropSrc("time", new PropSrc.BeatTime(() => time.Value));
|
||||||
|
SubmitPropSrc("endtime", new PropSrc.BeatTime(() => endtime.Value));
|
||||||
|
SubmitPropOp("time", new PropOp.BeatTime(v => time = v));
|
||||||
|
SubmitPropOp("endtime", new PropOp.BeatTime(v => endtime = v));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using RBeatTime = Cryville.Crtr.BeatTime;
|
||||||
|
|
||||||
namespace Cryville.Crtr {
|
namespace Cryville.Crtr {
|
||||||
public abstract class PropOp : PdtOperator {
|
public abstract class PropOp : PdtOperator {
|
||||||
@@ -52,6 +53,14 @@ namespace Cryville.Crtr {
|
|||||||
_cb((T)(object)result);
|
_cb((T)(object)result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public class BeatTime : PropOp {
|
||||||
|
readonly Action<RBeatTime> _cb;
|
||||||
|
public BeatTime(Action<RBeatTime> cb) { _cb = cb; }
|
||||||
|
protected override unsafe void Execute() {
|
||||||
|
var o = GetOperand(0);
|
||||||
|
_cb(*(RBeatTime*)o.TrustedAsOfLength(sizeof(RBeatTime)));
|
||||||
|
}
|
||||||
|
}
|
||||||
public class Vector2 : PropOp {
|
public class Vector2 : PropOp {
|
||||||
readonly Action<UnityEngine.Vector2> _cb;
|
readonly Action<UnityEngine.Vector2> _cb;
|
||||||
public Vector2(Action<UnityEngine.Vector2> cb) { _cb = cb; }
|
public Vector2(Action<UnityEngine.Vector2> cb) { _cb = cb; }
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
using Cryville.Common.Pdt;
|
using Cryville.Common.Pdt;
|
||||||
using System;
|
using System;
|
||||||
|
using RBeatTime = Cryville.Crtr.BeatTime;
|
||||||
|
|
||||||
namespace Cryville.Crtr {
|
namespace Cryville.Crtr {
|
||||||
public abstract class PropSrc {
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user