Implement new transition.

This commit is contained in:
2023-04-20 00:18:49 +08:00
parent d2b71e41c9
commit 8670482c04
8 changed files with 175 additions and 28 deletions

View File

@@ -9,6 +9,7 @@ using RColor = UnityEngine.Color;
using RTargetString = Cryville.Common.Buffers.TargetString;
using RVector2 = UnityEngine.Vector2;
using RVector3 = UnityEngine.Vector3;
using RVector4 = UnityEngine.Vector4;
namespace Cryville.Crtr {
public abstract class PropOp : PdtOperator {
@@ -159,14 +160,27 @@ namespace Cryville.Crtr {
float num = o.AsNumber();
_cb(new RVector3(num, num));
break;
case 2:
_cb(o.As<RVector2>());
case 2: _cb(o.As<RVector2>()); break;
case 3: _cb(o.As<RVector3>()); break;
default: throw new InvalidOperationException("Invalid array size");
}
}
}
public class Vector4 : PropOp {
readonly Action<RVector4> _cb;
public Vector4(Action<RVector4> cb) { _cb = cb; }
protected override unsafe void Execute() {
var o = GetOperand(0);
switch ((o.Length - 4) / 4) {
case 0: // Number
case 1: // Array[1]
float num = o.AsNumber();
_cb(new RVector4(num, num, num, num));
break;
case 3:
_cb(o.As<RVector3>());
break;
default:
throw new InvalidOperationException("Invalid array size");
case 2: _cb(o.As<RVector2>()); break;
case 3: _cb(o.As<RVector3>()); break;
case 4: _cb(o.As<RVector4>()); break;
default: throw new InvalidOperationException("Invalid array size");
}
}
}