mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-04 08:41:34 +08:00
Rotator entity
This commit is contained in:
@@ -12,6 +12,8 @@ import Parsimmon from "parsimmon"
|
||||
import PathSymbolEntity from "../entity/PathSymbolEntity"
|
||||
import PinEntity from "../entity/PinEntity"
|
||||
import PinReferenceEntity from "../entity/PinReferenceEntity"
|
||||
import RotatorEntity from "../entity/RotatorEntity"
|
||||
import SimpleSerializationRotatorEntity from "../entity/SimpleSerializationRotatorEntity"
|
||||
import SimpleSerializationVectorEntity from "../entity/SimpleSerializationVectorEntity"
|
||||
import TypeInitialization from "../entity/TypeInitialization"
|
||||
import Utility from "../Utility"
|
||||
@@ -56,8 +58,12 @@ export default class Grammar {
|
||||
return r.PinReference
|
||||
case VectorEntity:
|
||||
return r.Vector
|
||||
case RotatorEntity:
|
||||
return r.Rotator
|
||||
case SimpleSerializationRotatorEntity:
|
||||
return r.SimpleSerializationRotator
|
||||
case SimpleSerializationVectorEntity:
|
||||
return r.SimpleSerializationVectorEntity
|
||||
return r.SimpleSerializationVector
|
||||
case LinearColorEntity:
|
||||
return r.LinearColor
|
||||
case FunctionReferenceEntity:
|
||||
@@ -239,7 +245,22 @@ export default class Grammar {
|
||||
|
||||
Vector = r => Grammar.createEntityGrammar(r, VectorEntity)
|
||||
|
||||
SimpleSerializationVectorEntity = r => P.seqMap(
|
||||
Rotator = r => Grammar.createEntityGrammar(r, RotatorEntity)
|
||||
|
||||
SimpleSerializationRotator = r => P.seqMap(
|
||||
r.Number,
|
||||
P.string(",").trim(P.optWhitespace),
|
||||
r.Number,
|
||||
P.string(",").trim(P.optWhitespace),
|
||||
r.Number,
|
||||
(p, _1, y, _3, r) => new SimpleSerializationRotatorEntity({
|
||||
R: r,
|
||||
P: p,
|
||||
Y: y,
|
||||
})
|
||||
)
|
||||
|
||||
SimpleSerializationVector = r => P.seqMap(
|
||||
r.Number,
|
||||
P.string(",").trim(P.optWhitespace),
|
||||
r.Number,
|
||||
|
||||
@@ -19,6 +19,8 @@ import SimpleSerializationVectorEntity from "../entity/SimpleSerializationVector
|
||||
import ToStringSerializer from "./ToStringSerializer"
|
||||
import Utility from "../Utility"
|
||||
import VectorEntity from "../entity/VectorEntity"
|
||||
import RotatorEntity from "../entity/RotatorEntity"
|
||||
import SimpleSerializationRotatorEntity from "../entity/SimpleSerializationRotatorEntity"
|
||||
|
||||
export default function initializeSerializerFactory() {
|
||||
|
||||
@@ -132,6 +134,11 @@ export default function initializeSerializerFactory() {
|
||||
new GeneralSerializer(v => v, PinReferenceEntity, "", " ", false, "", _ => "")
|
||||
)
|
||||
|
||||
SerializerFactory.registerSerializer(
|
||||
RotatorEntity,
|
||||
new GeneralSerializer(bracketsWrapped, RotatorEntity)
|
||||
)
|
||||
|
||||
SerializerFactory.registerSerializer(
|
||||
String,
|
||||
new CustomSerializer(
|
||||
@@ -142,6 +149,15 @@ export default function initializeSerializerFactory() {
|
||||
)
|
||||
)
|
||||
|
||||
SerializerFactory.registerSerializer(
|
||||
SimpleSerializationRotatorEntity,
|
||||
new CustomSerializer(
|
||||
/** @param {SimpleSerializationRotatorEntity} value */
|
||||
(value, insideString) => `${value.P}, ${value.Y}, ${value.R}`,
|
||||
SimpleSerializationRotatorEntity
|
||||
)
|
||||
)
|
||||
|
||||
SerializerFactory.registerSerializer(
|
||||
SimpleSerializationVectorEntity,
|
||||
new CustomSerializer(
|
||||
|
||||
Reference in New Issue
Block a user