示例#1
0
        /// <summary>
        /// Saves the file to the specified stream.
        /// </summary>
        /// <param name="stream">The stream to save to.</param>
        public override void Save(Stream stream)
        {
            BinaryWriter writer = new BinaryWriter(stream, Encoding.GetEncoding("EUC-KR"));

            writer.Write(Sequences.Count);

            Sequences.ForEach(sequence => {
                writer.WriteIntString(sequence.Name);
                writer.Write(sequence.Lifetime.Minimum);
                writer.Write(sequence.Lifetime.Maximum);
                writer.Write(sequence.EmitRate.Minimum);
                writer.Write(sequence.EmitRate.Maximum);
                writer.Write(sequence.LoopCount);
                writer.Write(sequence.SpawnDirection.Minimum);
                writer.Write(sequence.SpawnDirection.Maximum);
                writer.Write(sequence.EmitRadius.Minimum);
                writer.Write(sequence.EmitRadius.Maximum);
                writer.Write(sequence.Gravity.Minimum);
                writer.Write(sequence.Gravity.Maximum);
                writer.WriteIntString(sequence.TextureFileName);
                writer.Write(sequence.ParticleCount);
                writer.Write((int)sequence.Alignment);
                writer.Write((int)sequence.UpdateCoordinate);
                writer.Write(sequence.TextureWidth);
                writer.Write(sequence.TextureHeight);
                writer.Write((int)sequence.Implementation);
                writer.Write((int)sequence.DestinationBlendMode);
                writer.Write((int)sequence.SourceBlendMode);
                writer.Write((int)sequence.BlendOperation);

                writer.Write(sequence.Events.Count);

                sequence.Events.ForEach(@event => {
                    writer.Write((int)@event.Type);
                    @event.Write(writer);
                });
            });
        }
        /// <summary>
        /// Saves the file to the specified stream.
        /// </summary>
        /// <param name="stream">The stream to save to.</param>
        public override void Save(Stream stream)
        {
            BinaryWriter writer = new BinaryWriter(stream, Encoding.GetEncoding("EUC-KR"));
            AlignedBinaryWriter alignedWriter = new AlignedBinaryWriter(stream, Encoding.GetEncoding("EUC-KR"));

            writer.Write(Patterns.Count);
            writer.Write(IdleInterval);
            writer.Write(DamageRate);
            writer.WriteIntString(Name);

            Patterns.ForEach(pattern => {
                writer.WriteString(pattern.Name, 32);
                writer.Write(pattern.Events.Count);

                pattern.Events.ForEach(@event => {
                    writer.WriteString(@event.Name, 32);
                    writer.Write(@event.Conditions.Count);

                    @event.Conditions.ForEach(condition => {
                        writer.Write(0);
                        writer.Write((int)condition.Type | CONDITION_MASK);

                        alignedWriter.Reset();
                        condition.Write(alignedWriter);
                        alignedWriter.Align();

                        int size = alignedWriter.TotalWrote + 8;

                        stream.Seek(-size, SeekOrigin.Current);
                        writer.Write(size);

                        stream.Seek(size - 4, SeekOrigin.Current);
                    });

                    writer.Write(@event.Actions.Count);

                    @event.Actions.ForEach(action => {
                        writer.Write(0);
                        writer.Write((int)action.Type | ACTION_MASK);

                        alignedWriter.Reset();
                        action.Write(alignedWriter);
                        alignedWriter.Align();

                        int size = alignedWriter.TotalWrote + 8;

                        stream.Seek(-size, SeekOrigin.Current);
                        writer.Write(size);

                        stream.Seek(size - 4, SeekOrigin.Current);
                    });
                });
            });
        }
示例#3
0
        /// <summary>
        /// Saves the file to the specified stream.
        /// </summary>
        /// <param name="stream">The stream to save to.</param>
        public override void Save(Stream stream)
        {
            BinaryWriter writer = new BinaryWriter(stream, Encoding.GetEncoding("EUC-KR"));

            writer.WriteIntString(Name);
            writer.Write(SoundEnabled ? 1 : 0);
            writer.WriteIntString(SoundFilePath);
            writer.Write(LoopCount);

            writer.Write(Particles.Count);

            Particles.ForEach(particle => {
                writer.WriteIntString(particle.Name);
                writer.WriteIntString(particle.UniqueIdentifier);
                writer.Write(particle.ParticleIndex);
                writer.WriteIntString(particle.FilePath);
                writer.Write(particle.AnimationEnabled ? 1 : 0);
                writer.WriteIntString(particle.AnimationName);
                writer.Write(particle.AnimationLoopCount);
                writer.Write(particle.AnimationIndex);
                writer.Write(particle.Position);
                writer.Write(particle.Rotation);
                writer.Write(particle.Delay);
                writer.Write(particle.LinkedToRoot ? 1 : 0);
            });

            writer.Write(Animations.Count);

            Animations.ForEach(animation => {
                writer.WriteIntString(animation.EffectName);
                writer.WriteIntString(animation.MeshName);
                writer.Write(animation.MeshIndex);
                writer.WriteIntString(animation.MeshFilePath);
                writer.WriteIntString(animation.AnimationFilePath);
                writer.WriteIntString(animation.TextureFilePath);
                writer.Write(animation.AlphaEnabled ? 1 : 0);
                writer.Write(animation.TwoSidedEnabled ? 1 : 0);
                writer.Write(animation.AlphaTestEnabled ? 1 : 0);
                writer.Write(animation.DepthTestEnabled ? 1 : 0);
                writer.Write(animation.DepthWriteEnabled ? 1 : 0);
                writer.Write(animation.SourceBlend);
                writer.Write(animation.DestinationBlend);
                writer.Write(animation.BlendOperation);
                writer.Write(animation.AnimationEnabled ? 1 : 0);
                writer.WriteIntString(animation.AnimationName);
                writer.Write(animation.AnimationLoopCount);
                writer.Write(animation.AnimationIndex);
                writer.Write(animation.Position);
                writer.Write(animation.Rotation);
                writer.Write(animation.Delay);
                writer.Write(animation.LoopCount);
                writer.Write(animation.LinkedToRoot ? 1 : 0);
            });
        }
示例#4
0
        /// <summary>
        /// Writes the condition data to the underlying stream.
        /// </summary>
        /// <param name="writer">The writer.</param>
        public void Write(BinaryWriter writer)
        {
            writer.Write((byte)MessageType);

            if (UseText) {
                writer.WriteIntString(Text);
            } else {
                writer.Write(StringID);
            }
        }