mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-14 17:14:41 +08:00
Small refactoring
This commit is contained in:
@@ -7,27 +7,26 @@ export default class SimpleSerializationRotatorEntity extends RotatorEntity {
|
||||
static attributeSeparator = ", "
|
||||
static grammar = this.createGrammar()
|
||||
|
||||
/** @returns {P<SimpleSerializationRotatorEntity>} */
|
||||
static createGrammar() {
|
||||
return /** @type {P<SimpleSerializationRotatorEntity>} */(
|
||||
P.alt(
|
||||
P.regArray(new RegExp(
|
||||
`(${NumberEntity.numberRegexSource})`
|
||||
+ String.raw`\s*,\s*`
|
||||
+ `(${NumberEntity.numberRegexSource})`
|
||||
+ String.raw`\s*,\s*`
|
||||
+ `(${NumberEntity.numberRegexSource})`
|
||||
)).map(([_, p, pPrecision, y, yPrecision, r, rPrecision]) => new this({
|
||||
R: new (RotatorEntity.attributes.R)(r, rPrecision?.length),
|
||||
P: new (RotatorEntity.attributes.P)(p, pPrecision?.length),
|
||||
Y: new (RotatorEntity.attributes.Y)(y, yPrecision?.length),
|
||||
})),
|
||||
RotatorEntity.grammar.map(v => new this({
|
||||
R: v.R,
|
||||
P: v.P,
|
||||
Y: v.Y,
|
||||
}))
|
||||
).label("SimpleSerializationRotatorEntity")
|
||||
)
|
||||
return P.alt(
|
||||
P.regArray(new RegExp(
|
||||
`(${NumberEntity.numberRegexSource})`
|
||||
+ String.raw`\s*,\s*`
|
||||
+ `(${NumberEntity.numberRegexSource})`
|
||||
+ String.raw`\s*,\s*`
|
||||
+ `(${NumberEntity.numberRegexSource})`
|
||||
)).map(([_, p, pPrecision, y, yPrecision, r, rPrecision]) => new this({
|
||||
R: new (RotatorEntity.attributes.R)(r, rPrecision?.length),
|
||||
P: new (RotatorEntity.attributes.P)(p, pPrecision?.length),
|
||||
Y: new (RotatorEntity.attributes.Y)(y, yPrecision?.length),
|
||||
})),
|
||||
RotatorEntity.grammar.map(v => new this({
|
||||
R: v.R,
|
||||
P: v.P,
|
||||
Y: v.Y,
|
||||
}))
|
||||
).label("SimpleSerializationRotatorEntity")
|
||||
}
|
||||
|
||||
doSerialize() {
|
||||
|
||||
Reference in New Issue
Block a user