mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-04 08:50:33 +08:00
Fix format text serialization, LineTrace node name
This commit is contained in:
@@ -292,7 +292,8 @@ export default class Grammar {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {EntityConstructor} entityType
|
||||
* @template {AnyValue} T
|
||||
* @param {AnyValueConstructor<T>} entityType
|
||||
* @param {String[]} key
|
||||
* @returns {AttributeInformation}
|
||||
*/
|
||||
@@ -307,6 +308,7 @@ export default class Grammar {
|
||||
}
|
||||
}
|
||||
if (entityType instanceof IEntity.constructor) {
|
||||
// @ts-expect-error
|
||||
result = entityType.attributes[key[0]]
|
||||
type = result?.type
|
||||
} else if (entityType instanceof Array) {
|
||||
@@ -380,6 +382,7 @@ export default class Grammar {
|
||||
P.regex(new RegExp(`${FormatTextEntity.lookbehind}\\s*`)),
|
||||
this.grammarFor(FormatTextEntity.attributes.value)
|
||||
)
|
||||
.map(([_0, values]) => new FormatTextEntity(values))
|
||||
)
|
||||
|
||||
static functionReferenceEntity = P.lazy(() => this.createEntityGrammar(FunctionReferenceEntity))
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import ByteEntity from "../entity/ByteEntity.js"
|
||||
import CustomSerializer from "./CustomSerializer.js"
|
||||
import EnumEntity from "../entity/EnumEntity.js"
|
||||
import FormatTextEntity from "../entity/FormatTextEntity.js"
|
||||
import FunctionReferenceEntity from "../entity/FunctionReferenceEntity.js"
|
||||
import GuidEntity from "../entity/GuidEntity.js"
|
||||
import IdentifierEntity from "../entity/IdentifierEntity.js"
|
||||
import Integer64Entity from "../entity/Integer64Entity.js"
|
||||
import IntegerEntity from "../entity/IntegerEntity.js"
|
||||
import InvariantTextEntity from "../entity/InvariantTextEntity.js"
|
||||
import Serializer from "./Serializer.js"
|
||||
import KeyBindingEntity from "../entity/KeyBindingEntity.js"
|
||||
import LinearColorEntity from "../entity/LinearColorEntity.js"
|
||||
import LocalizedTextEntity from "../entity/LocalizedTextEntity.js"
|
||||
@@ -20,6 +20,7 @@ import PinEntity from "../entity/PinEntity.js"
|
||||
import PinReferenceEntity from "../entity/PinReferenceEntity.js"
|
||||
import RealUnitEntity from "../entity/UnitRealEntity.js"
|
||||
import RotatorEntity from "../entity/RotatorEntity.js"
|
||||
import Serializer from "./Serializer.js"
|
||||
import SerializerFactory from "./SerializerFactory.js"
|
||||
import SimpleSerializationRotatorEntity from "../entity/SimpleSerializationRotatorEntity.js"
|
||||
import SimpleSerializationVector2DEntity from "../entity/SimpleSerializationVector2DEntity.js"
|
||||
@@ -91,6 +92,21 @@ export default function initializeSerializerFactory() {
|
||||
new ToStringSerializer(EnumEntity)
|
||||
)
|
||||
|
||||
SerializerFactory.registerSerializer(
|
||||
FormatTextEntity,
|
||||
new CustomSerializer(
|
||||
(v, insideString) => {
|
||||
let result = FormatTextEntity.lookbehind + "("
|
||||
+ v.value.map(v =>
|
||||
// @ts-expect-error
|
||||
SerializerFactory.getSerializer(Utility.getType(v)).write(v, insideString)
|
||||
).join(", ")
|
||||
+ ")"
|
||||
return result
|
||||
},
|
||||
FormatTextEntity)
|
||||
)
|
||||
|
||||
SerializerFactory.registerSerializer(
|
||||
FunctionReferenceEntity,
|
||||
new Serializer(FunctionReferenceEntity, Serializer.bracketsWrapped)
|
||||
|
||||
Reference in New Issue
Block a user