Exemplo n.º 1
0
        public void read(Reader reader, List <string> objectNames = null, List <string> variableNames = null)
        {
            // Load scene
            if (!reader.readBytes(4).SequenceEqual(signature))
            {
                reader.Close();
                throw new Exception("Invalid Scene v5 signature");
            }

            editorMetadata = new SceneEditorMetadata(reader);

            byte layerCount = reader.ReadByte();

            layers.Clear();
            for (int i = 0; i < layerCount; ++i)
            {
                layers.Add(new SceneLayer(reader));
            }

            byte objectCount = reader.ReadByte();

            objects.Clear();
            for (int i = 0; i < objectCount; ++i)
            {
                objects.Add(new SceneObject(reader, objectNames, variableNames));
            }

            reader.Close();
        }
Exemplo n.º 2
0
        private Scene(Reader reader)
        {
            if (readTilesOnly == false)
            {
                // Load scene
                if (!reader.ReadBytes(4).SequenceEqual(MAGIC))
                {
                    throw new Exception("Invalid scene file header magic");
                }

                EditorMetadata = new SceneEditorMetadata(reader);

                byte layers_count = reader.ReadByte();
                for (int i = 0; i < layers_count; ++i)
                {
                    Layers.Add(new SceneLayer(reader));
                }

                byte objects_count = reader.ReadByte();
                for (int i = 0; i < objects_count; ++i)
                {
                    Objects.Add(new SceneObject(reader));
                }
            }
            else
            {
                // Load scene
                if (!reader.ReadBytes(4).SequenceEqual(MAGIC))
                {
                    throw new Exception("Invalid scene file header magic");
                }

                EditorMetadata = new SceneEditorMetadata(reader);

                byte layers_count = reader.ReadByte();
                for (int i = 0; i < layers_count; ++i)
                {
                    Layers.Add(new SceneLayer(reader));
                }

                /*byte objects_count = reader.ReadByte();
                 * for (int i = 0; i < objects_count; ++i)
                 *  Objects.Add(new SceneObject(reader));*/
            }
        }
Exemplo n.º 3
0
 public Scene()
 {
     EditorMetadata = new SceneEditorMetadata();
 }