예제 #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
        /// <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; });
        }