Add "emit effect on self" annotation.
This commit is contained in:
@@ -21,6 +21,10 @@ namespace Cryville.Crtr {
|
||||
if (k.Count != 1) throw new FormatException("Invalid effect name");
|
||||
return new EmitEffect(a, IdentifierManager.SharedInstance.Request(k[0]));
|
||||
}
|
||||
else if (a.Remove("emit_self")) {
|
||||
if (k.Count != 1) throw new FormatException("Invalid effect name");
|
||||
return new EmitEffect(a, IdentifierManager.SharedInstance.Request(k[0]), true);
|
||||
}
|
||||
else if (a.Remove("var")) {
|
||||
if (k.Count != 1) throw new FormatException("Invalid variable name");
|
||||
return new SetVariable(a, IdentifierManager.SharedInstance.Request(k[0]));
|
||||
@@ -147,12 +151,14 @@ namespace Cryville.Crtr {
|
||||
}
|
||||
public class EmitEffect : SkinPropertyKey {
|
||||
public int Name { get; private set; }
|
||||
public EmitEffect(IEnumerable<string> a, int name) : base(a) {
|
||||
public bool IsSelf { get; private set; }
|
||||
public EmitEffect(IEnumerable<string> a, int name, bool isSelf = false) : base(a) {
|
||||
Name = name;
|
||||
IsSelf = isSelf;
|
||||
_op = new PropOp.Float(v => _index = v);
|
||||
}
|
||||
public override string ToString() {
|
||||
return string.Format("@emit {0}", IdentifierManager.SharedInstance.Retrieve(Name));
|
||||
return string.Format(IsSelf ? "@emit_self {0}" : "@emit {0}", IdentifierManager.SharedInstance.Retrieve(Name));
|
||||
}
|
||||
public override bool IsValueRequired { get { return true; } }
|
||||
public override void ExecuteStatic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, Dictionary<int, SkinVariable> vars) {
|
||||
@@ -162,7 +168,8 @@ namespace Cryville.Crtr {
|
||||
readonly PropOp _op;
|
||||
public override void ExecuteDynamic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, Dictionary<int, SkinVariable> vars, int dl) {
|
||||
ChartPlayer.etor.Evaluate(_op, exp);
|
||||
ChartPlayer.effectManager.Emit(Name, _index);
|
||||
if (IsSelf) ChartPlayer.effectManager.EmitSelf(Name, _index, ctx.WriteTransform);
|
||||
else ChartPlayer.effectManager.Emit(Name, _index);
|
||||
}
|
||||
}
|
||||
public class SetVariable : SkinPropertyKey {
|
||||
|
Reference in New Issue
Block a user