Parsing Yaml中的锚
我目前正在学习Yaml,但对该代码有问题: 底部的“gameObjects”数组被解析为字符串数组,但我希望它包含锚(&)的实际数据。我还在顶部使用锚,它们工作得很好Parsing Yaml中的锚,parsing,yaml,Parsing,Yaml,我目前正在学习Yaml,但对该代码有问题: 底部的“gameObjects”数组被解析为字符串数组,但我希望它包含锚(&)的实际数据。我还在顶部使用锚,它们工作得很好 问题:yaml锚也适用于复杂数据吗?它们应该也适用。您使用哪个YAML解析器?@delnan一个相当未知的解析器,那么我倾向于说问题要么在于您使用该解析器的API(也许您需要一个特殊的调用来解析锚?),要么在于解析器对锚的实现。不过我一眼就看不出是哪一个。@delnan谢谢,我想这是解析器中的一个bug。你能给出一个答案让我结束
问题:yaml锚也适用于复杂数据吗?它们应该也适用。您使用哪个YAML解析器?@delnan一个相当未知的解析器,那么我倾向于说问题要么在于您使用该解析器的API(也许您需要一个特殊的调用来解析锚?),要么在于解析器对锚的实现。不过我一眼就看不出是哪一个。@delnan谢谢,我想这是解析器中的一个bug。你能给出一个答案让我结束这个问题吗?我根本不确定这是否是解析器中的错误,特别是因为自述文件上的示例有一个包含复杂数据的锚。
---
classes:
audio:
- &Music components.audio.Music
- &Sound components.audio.Sound
graphic:
- &Animation components.graphic.Animation
- &Image components.graphic.Image
- &Text components.graphic.Text
misc:
- &Camera components.misc.Camera
- &Debug components.misc.Debug
collider:
- &Circle components.physics.Circle
- &Hitbox components.physics.Hitbox
- &Polygon components.physics.Polygon
common:
- &Physics components.Physics
- &Transform components.Transform
&Wabbit Wabbit:
name: Wabbit
components:
-
type: *Transform
x: 150
y: 120
-
type: *Image
file: Wabbit
-
type: *Physics
-
type: *Debug
&Coin Coin:
name: Coin
components:
-
type: *Transform
x: 370
y: 180
scaleX: 5
scaleY: 5
-
type: *Physics
-
type: *Debug
&Ground Ground:
name: Ground
components:
-
type: *Transform
x: 320
y: 475
&TestScene TestScene:
type: Scene
gameObjects: [*Wabbit, *Coin, *Ground]
extensions: [Nape]
Engine:
name: Example
scene: *TestScene
paused: false
debug: true
Screen:
color: [146, 150, 152] #grey
scaleX: 1
scaleY: 1
zoom: 1