read method

void read(
  1. StreamReader reader
)

Implementation

void read(StreamReader reader) {
  _name = reader.readString('name');
  Vec2D.copyFromList(_translation, reader.readFloat32Array(2, 'translation'));
  _width = reader.readFloat32('width');
  _height = reader.readFloat32('height');
  Vec2D.copyFromList(_origin, reader.readFloat32Array(2, 'origin'));
  _clipContents = reader.readBool('clipContents');

  Float32List color = reader.readFloat32Array(4, 'color');
  _color[0] = color[0];
  _color[1] = color[1];
  _color[2] = color[2];
  _color[3] = color[3];

  StreamReader? block;
  while ((block = reader.readNextBlock(blockTypesMap)) != null) {
    switch (block!.blockType) {
      case BlockTypes.components:
        readComponentsBlock(block);
        break;
      case BlockTypes.animations:
        readAnimationsBlock(block);
        break;
    }
  }
}