Pull up clip from judge definition. Add clip to event container.
This commit is contained in:
@@ -184,6 +184,13 @@ namespace Cryville.Crtr {
|
|||||||
public abstract class EventContainer : ChartEvent {
|
public abstract class EventContainer : ChartEvent {
|
||||||
public List<Chart.Motion> motions = new List<Chart.Motion>();
|
public List<Chart.Motion> motions = new List<Chart.Motion>();
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public Clip Clip { get; private set; }
|
||||||
|
|
||||||
|
public EventContainer() {
|
||||||
|
SubmitPropOp("clip", new PropOp.Clip(v => Clip = v));
|
||||||
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public virtual IEnumerable<ChartEvent> Events {
|
public virtual IEnumerable<ChartEvent> Events {
|
||||||
get {
|
get {
|
||||||
|
10
Assets/Cryville/Crtr/Clip.cs
Normal file
10
Assets/Cryville/Crtr/Clip.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Cryville.Crtr {
|
||||||
|
public struct Clip {
|
||||||
|
public float Behind { get; set; }
|
||||||
|
public float Ahead { get; set; }
|
||||||
|
public Clip(float behind, float ahead) {
|
||||||
|
Behind = behind;
|
||||||
|
Ahead = ahead;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Cryville/Crtr/Clip.cs.meta
Normal file
11
Assets/Cryville/Crtr/Clip.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 31109f74226deb947b93732206b112ed
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@@ -53,8 +53,8 @@ namespace Cryville.Crtr {
|
|||||||
var ev = new JudgeEvent {
|
var ev = new JudgeEvent {
|
||||||
StartTime = st,
|
StartTime = st,
|
||||||
EndTime = et,
|
EndTime = et,
|
||||||
StartClip = st + def.clip[0],
|
StartClip = st + def.clip.Behind,
|
||||||
EndClip = et + def.clip[1],
|
EndClip = et + def.clip.Ahead,
|
||||||
BaseEvent = tev,
|
BaseEvent = tev,
|
||||||
Definition = def,
|
Definition = def,
|
||||||
Handler = handler,
|
Handler = handler,
|
||||||
@@ -284,7 +284,7 @@ namespace Cryville.Crtr {
|
|||||||
public Dictionary<Identifier, PdtExpression> pass;
|
public Dictionary<Identifier, PdtExpression> pass;
|
||||||
}
|
}
|
||||||
public class JudgeDefinition {
|
public class JudgeDefinition {
|
||||||
public float[] clip;
|
public Clip clip;
|
||||||
public PdtExpression input;
|
public PdtExpression input;
|
||||||
public PdtExpression hit;
|
public PdtExpression hit;
|
||||||
public Identifier[] pass;
|
public Identifier[] pass;
|
||||||
|
@@ -4,11 +4,13 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using RBeatTime = Cryville.Crtr.BeatTime;
|
using RBeatTime = Cryville.Crtr.BeatTime;
|
||||||
|
using RClip = Cryville.Crtr.Clip;
|
||||||
using RTargetString = Cryville.Common.Buffers.TargetString;
|
using RTargetString = Cryville.Common.Buffers.TargetString;
|
||||||
|
|
||||||
namespace Cryville.Crtr {
|
namespace Cryville.Crtr {
|
||||||
public abstract class PropOp : PdtOperator {
|
public abstract class PropOp : PdtOperator {
|
||||||
internal PropOp() : base(1) { }
|
protected PropOp() : base(1) { }
|
||||||
|
protected PropOp(int pc) : base(pc) { }
|
||||||
public class Arbitrary : PropOp {
|
public class Arbitrary : PropOp {
|
||||||
public int Name { get; set; }
|
public int Name { get; set; }
|
||||||
protected override void Execute() {
|
protected override void Execute() {
|
||||||
@@ -25,6 +27,15 @@ namespace Cryville.Crtr {
|
|||||||
_cb(GetOperand(0).AsNumber() > 0);
|
_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 {
|
public class Integer : PropOp {
|
||||||
readonly Action<int> _cb;
|
readonly Action<int> _cb;
|
||||||
public Integer(Action<int> cb) { _cb = cb; }
|
public Integer(Action<int> cb) { _cb = cb; }
|
||||||
|
@@ -150,9 +150,9 @@ namespace Cryville.Crtr {
|
|||||||
ChartPlayer.etor.Evaluate(new PropOp.String(r => result = r), exp);
|
ChartPlayer.etor.Evaluate(new PropOp.String(r => result = r), exp);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
else if (type.Equals(typeof(float[]))) {
|
else if (type.Equals(typeof(Clip))) {
|
||||||
float[] result = null;
|
Clip result = default(Clip);
|
||||||
ChartPlayer.etor.Evaluate(new pop_numarr(r => result = r), exp);
|
ChartPlayer.etor.Evaluate(new PropOp.Clip(r => result = r), exp);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
else if (type.Equals(typeof(Identifier))) {
|
else if (type.Equals(typeof(Identifier))) {
|
||||||
@@ -182,17 +182,6 @@ namespace Cryville.Crtr {
|
|||||||
return base.ChangeType(value, type, culture);
|
return base.ChangeType(value, type, culture);
|
||||||
}
|
}
|
||||||
#pragma warning disable IDE1006
|
#pragma warning disable IDE1006
|
||||||
class pop_numarr : PdtOperator {
|
|
||||||
readonly Action<float[]> _cb;
|
|
||||||
public pop_numarr(Action<float[]> cb) : base(16) { _cb = cb; }
|
|
||||||
protected override void Execute() {
|
|
||||||
var result = new float[LoadedOperandCount];
|
|
||||||
for (int i = 0; i < LoadedOperandCount; i++) {
|
|
||||||
result[i] = GetOperand(i).AsNumber();
|
|
||||||
}
|
|
||||||
_cb(result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
class pop_identstr : PropOp {
|
class pop_identstr : PropOp {
|
||||||
readonly Action<SIdentifier> _cb;
|
readonly Action<SIdentifier> _cb;
|
||||||
public pop_identstr(Action<SIdentifier> cb) { _cb = cb; }
|
public pop_identstr(Action<SIdentifier> cb) { _cb = cb; }
|
||||||
|
Reference in New Issue
Block a user