Exemple #1
0
        private void _ReadAsync(TableStreamAsyncReader reader)
        {
            reader.Blob("SceneChunkData", () =>
            {
                reader.ReadKeyString("Name", name => { this.Name = name; });

                this.Objects = new List <SceneObjectData>();
                reader.ReadKeyNumber("Objects", count =>
                {
                    for (var i = 0; i < count; ++i)
                    {
                        reader.ReadKeyByte("Type", type =>
                        {
                            SceneObjectData objectData = null;
                            switch ((SceneObjectType)type)
                            {
                            case SceneObjectType.PREFAB:
                                objectData = new ScenePrefabData();
                                break;

                            case SceneObjectType.LIGHTMODIFIER:
                                objectData = new SceneLightModifierData();
                                break;

                            default:
                                objectData = new SceneObjectData();
                                break;
                            }
                            objectData._ReadAsync(reader);
                            this.Objects.Add(objectData);
                        });
                    }
                });
            });
        }
Exemple #2
0
        private void _ReadAsync(TableStreamAsyncReader reader)
        {
            reader.Blob("SceneLevelData", () =>
            {
                reader.ReadKeyString("Name", name => { this.Name = name; });

                reader.ReadKeyFloat("ChunkWidth", chunkWidth => { this.ChunkWidth = (float)chunkWidth; });
                reader.ReadKeyFloat("ChunkHeight", chunkHeight => { this.ChunkHeight = (float)chunkHeight; });

                reader.ReadKeyNumber("ChunkColumns", chunkColumns => { this.ChunkColumns = (int)chunkColumns; });
                reader.ReadKeyNumber("ChunkRows", chunkRows => { this.ChunkRows = (int)chunkRows; });

                this.Chunks = new List <SceneChunkRefData>();
                reader.ReadKeyNumber("Chunks", count =>
                {
                    for (var i = 0; i < count; ++i)
                    {
                        var chunkRefData = new SceneChunkRefData();
                        chunkRefData._ReadAsync(reader);
                        this.Chunks.Add(chunkRefData);
                    }
                });
            });
        }