Move arbitrary property operator to PropOp.
This commit is contained in:
@@ -8,6 +8,15 @@ using RBeatTime = Cryville.Crtr.BeatTime;
|
|||||||
namespace Cryville.Crtr {
|
namespace Cryville.Crtr {
|
||||||
public abstract class PropOp : PdtOperator {
|
public abstract class PropOp : PdtOperator {
|
||||||
internal PropOp() : base(1) { }
|
internal PropOp() : base(1) { }
|
||||||
|
public class Arbitrary : PropOp {
|
||||||
|
public int Name { get; set; }
|
||||||
|
protected override void Execute() {
|
||||||
|
var op = GetOperand(0);
|
||||||
|
var value = new byte[op.Length];
|
||||||
|
op.CopyTo(value, 0);
|
||||||
|
ChartPlayer.etor.ContextCascadeUpdate(Name, new PropSrc.Arbitrary(op.Type, value));
|
||||||
|
}
|
||||||
|
}
|
||||||
public class Boolean : PropOp {
|
public class Boolean : PropOp {
|
||||||
readonly Action<bool> _cb;
|
readonly Action<bool> _cb;
|
||||||
public Boolean(Action<bool> cb) { _cb = cb; }
|
public Boolean(Action<bool> cb) { _cb = cb; }
|
||||||
|
@@ -58,16 +58,7 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public class Constraint {
|
public class Constraint {
|
||||||
class ArbitraryOp : PropOp {
|
static readonly PropOp.Arbitrary _arbop = new PropOp.Arbitrary();
|
||||||
public int name;
|
|
||||||
protected override void Execute() {
|
|
||||||
var op = GetOperand(0);
|
|
||||||
var value = new byte[op.Length];
|
|
||||||
op.CopyTo(value, 0);
|
|
||||||
ChartPlayer.etor.ContextCascadeUpdate(name, new PropSrc.Arbitrary(op.Type, value));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
static readonly ArbitraryOp _arbop = new ArbitraryOp();
|
|
||||||
[ElementList]
|
[ElementList]
|
||||||
public Dictionary<RulesetSelectors, Constraint> Elements = new Dictionary<RulesetSelectors, Constraint>();
|
public Dictionary<RulesetSelectors, Constraint> Elements = new Dictionary<RulesetSelectors, Constraint>();
|
||||||
[PropertyList]
|
[PropertyList]
|
||||||
@@ -96,7 +87,7 @@ namespace Cryville.Crtr {
|
|||||||
etor.ContextSelfValue = null;
|
etor.ContextSelfValue = null;
|
||||||
break;
|
break;
|
||||||
case PropertyType.Variable:
|
case PropertyType.Variable:
|
||||||
_arbop.name = name;
|
_arbop.Name = name;
|
||||||
etor.Evaluate(_arbop, prop.Value);
|
etor.Evaluate(_arbop, prop.Value);
|
||||||
break;
|
break;
|
||||||
default: throw new NotSupportedException("Unknown property key type");
|
default: throw new NotSupportedException("Unknown property key type");
|
||||||
|
Reference in New Issue
Block a user