Пример #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);
                        });
                    }
                });
            });
        }
Пример #2
0
 internal void _ReadAsync(TableStreamAsyncReader reader)
 {
     reader.Blob("SceneObjectData", () =>
     {
         ReadAsync(reader);
     });
 }
Пример #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reader"></param>
        protected override void ReadAsync(TableStreamAsyncReader reader)
        {
            base.ReadAsync(reader);

            reader.ReadKeyFloat("Intensity", intensity => { this.Intensity = (float)intensity; });

            reader.ReadKeyFloat("Red", red => { this.Red = (float)red; });
            reader.ReadKeyFloat("Green", green => { this.Green = (float)green; });
            reader.ReadKeyFloat("Blue", blue => { this.Blue = (float)blue; });
        }
Пример #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="stream"></param>
        /// <param name="validateData"></param>
        /// <param name="callback"></param>
        public static void DeserializeAsync(Stream stream, bool validateData, Action <SceneChunkData> callback)
        {
            var reader    = new TableStreamAsyncReader(stream, validateData);
            var chunkData = new SceneChunkData();

            chunkData._ReadAsync(reader);
            reader.StartAsync(READ_COUNT_PER_FRAME, () =>
            {
                if (null != callback)
                {
                    callback(chunkData);
                }
            });
        }
Пример #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="stream"></param>
        /// <param name="validateData"></param>
        /// <param name="callback"></param>
        public static void DeserializeAsync(Stream stream, bool validateData, Action <SceneLevelData> callback)
        {
            var reader    = new TableStreamAsyncReader(stream, validateData);
            var levelData = new SceneLevelData();

            levelData._ReadAsync(reader);
            reader.StartAsync(100, () =>
            {
                if (null != callback)
                {
                    callback(levelData);
                }
            });
        }
Пример #6
0
        internal void _ReadAsync(TableStreamAsyncReader reader)
        {
            reader.Blob("SceneChunkRefData", () =>
            {
                reader.ReadKeyString("Name", name => { this.Name = name; });

                reader.ReadKeyFloat("PositionX", positionX => { this.PositionX = (float)positionX; });
                reader.ReadKeyFloat("PositionY", positionY => { this.PositionY = (float)positionY; });
                reader.ReadKeyFloat("PositionZ", positionZ => { this.PositionZ = (float)positionZ; });

                reader.ReadKeyFloat("OrientationX", orientationX => { this.OrientationX = (float)orientationX; });
                reader.ReadKeyFloat("OrientationY", orientationY => { this.OrientationY = (float)orientationY; });
                reader.ReadKeyFloat("OrientationZ", orientationZ => { this.OrientationZ = (float)orientationZ; });
                reader.ReadKeyFloat("OrientationW", orientationW => { this.OrientationW = (float)orientationW; });

                reader.ReadKeyString("Path", path => { this.Path = path; });
            });
        }
Пример #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reader"></param>
        protected virtual void ReadAsync(TableStreamAsyncReader reader)
        {
            reader.ReadKeyByte("Type", type => { this.Type = (SceneObjectType)type; });

            reader.ReadKeyString("Name", name => { this.Name = name; });

            reader.ReadKeyFloat("PositionX", value => { this.PositionX = (float)value; });
            reader.ReadKeyFloat("PositionY", value => { this.PositionY = (float)value; });
            reader.ReadKeyFloat("PositionZ", value => { this.PositionZ = (float)value; });

            reader.ReadKeyFloat("OrientationX", value => { this.OrientationX = (float)value; });
            reader.ReadKeyFloat("OrientationY", value => { this.OrientationY = (float)value; });
            reader.ReadKeyFloat("OrientationZ", value => { this.OrientationZ = (float)value; });
            reader.ReadKeyFloat("OrientationW", value => { this.OrientationW = (float)value; });

            reader.ReadKeyFloat("ScaleX", value => { this.ScaleX = (float)value; });
            reader.ReadKeyFloat("ScaleY", value => { this.ScaleY = (float)value; });
            reader.ReadKeyFloat("ScaleZ", value => { this.ScaleZ = (float)value; });
        }
Пример #8
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);
                    }
                });
            });
        }
Пример #9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reader"></param>
        protected override void ReadAsync(TableStreamAsyncReader reader)
        {
            base.ReadAsync(reader);

            reader.ReadKeyString("Path", path => { this.Path = path; });
        }