Pull up clip from judge definition. Add clip to event container.

This commit is contained in:
2023-01-31 14:55:41 +08:00
parent 8932d1b8d0
commit 5514b6cf37
6 changed files with 46 additions and 18 deletions

View File

@@ -4,11 +4,13 @@ using System;
using System.Collections.Generic;
using System.Reflection;
using RBeatTime = Cryville.Crtr.BeatTime;
using RClip = Cryville.Crtr.Clip;
using RTargetString = Cryville.Common.Buffers.TargetString;
namespace Cryville.Crtr {
public abstract class PropOp : PdtOperator {
internal PropOp() : base(1) { }
protected PropOp() : base(1) { }
protected PropOp(int pc) : base(pc) { }
public class Arbitrary : PropOp {
public int Name { get; set; }
protected override void Execute() {
@@ -25,6 +27,15 @@ namespace Cryville.Crtr {
_cb(GetOperand(0).AsNumber() > 0);
}
}
public class Clip : PropOp {
readonly Action<RClip> _cb;
public Clip(Action<RClip> cb) : base(2) { _cb = cb; }
protected override void Execute() {
if (LoadedOperandCount < 2)
throw new ArgumentException("Invalid clip syntax");
_cb(new RClip(GetOperand(0).AsNumber(), GetOperand(1).AsNumber()));
}
}
public class Integer : PropOp {
readonly Action<int> _cb;
public Integer(Action<int> cb) { _cb = cb; }