在Yaml的锚点

时间:2014-05-31 13:44:18

标签: parsing yaml

我目前正在学习Yaml并且对此代码有疑问:

http://hastebin.com/focokeqawo.sm

---
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

底部的“gameObjects”数组被解析为String Array但我希望它包含锚点(&)的实际数据。我也在顶部使用锚点,它们工作正常。

问题:yaml锚点是否也适用于复杂数据?

0 个答案:

没有答案