Add skin property image.frames and image.index.

This commit is contained in:
2023-02-17 14:40:34 +08:00
parent e7ce0985fb
commit 0d4cc5e208
4 changed files with 56 additions and 26 deletions

View File

@@ -60,6 +60,24 @@ namespace Cryville.Crtr {
_cb(GetOperand(0).AsString());
}
}
public class StringArray : PropOp {
readonly Action<string[]> _cb;
public StringArray(Action<string[]> cb) { _cb = cb; }
protected unsafe override void Execute() {
var op = GetOperand(0);
int arrtype; int len;
op.GetArraySuffix(out arrtype, out len);
if (arrtype != PdtInternalType.String) throw new InvalidCastException("Not an array of strings");
var result = new string[len];
int o = 0;
for (int i = 0; i < len; i++) {
string v = op.AsString(o);
o += v.Length * sizeof(char) + sizeof(int);
result[i] = v;
}
_cb(result);
}
}
public class TargetString : PropOp {
readonly Func<RTargetString> _cb;
public TargetString(Func<RTargetString> cb) { _cb = cb; }