Exemple #1
0
        public override void WriteXml(XmlWriter writer)
        {
            base.WriteXml(writer);
            writer.WriteElementString("RotationMode", RotationMode.ToString());
            writer.WriteElementString("LoopMode", LoopMode.ToString());
            writer.WriteStartElement("BlendMode");

            if (BlendMode == BlendState.Additive)
            {
                writer.WriteValue("ADDITIVE");
            }
            else if (BlendMode == BlendState.AlphaBlend)
            {
                writer.WriteValue("ALPHA");
            }
            else if (BlendMode == BlendState.NonPremultiplied)
            {
                writer.WriteValue("ALPHANP");
            }
            else if (BlendMode == BlendState.Opaque)
            {
                writer.WriteValue("OPAQUE");
            }
            else
            {
                throw new InvalidOperationException("ParticleSystem: Unrecognized BlendMode");
            }

            writer.WriteEndElement();

            WriteVector3(writer, Offset, "Offset");
            WriteVector3(writer, RandAngle, "RandAngle");
            WriteVector3(writer, Wind, "Wind");
            WriteVector3(writer, WindVariation, "WindVariation");
            WriteVector3(writer, PositionOffset, "PositionOffset");
            WriteVector3(writer, PositionOffsetVariation, "PositionOffsetVariation");
            WriteVector3(writer, ParticleRotation, "ParticleRotation");
            WriteVector3(writer, ParticleRotationVariation, "ParticleRotationVariation");
            WriteVector3(writer, ParticleColor, "ParticleColor");
            WriteVector3(writer, ParticleColorVariation, "ParticleColorVariation");
            WriteVector2(writer, ParticleSize, "ParticleSize");
            WriteVector2(writer, ParticleSizeVariation, "ParticleSizeVariation");

            writer.WriteStartElement("Textures");
            foreach (Texture2D texture in Textures)
            {
                writer.WriteElementString("TexturePath", ResourceManager.Instance.Textures.FirstOrDefault(x => x.Value == texture).Key);
            }
            writer.WriteEndElement();

            writer.WriteElementString("LifeSpanSec", XmlConvert.ToString(LifespanSec));
            writer.WriteElementString("LifeSpanSecVariation", XmlConvert.ToString(LifespanSecVariation));
            writer.WriteElementString("FadeInTime", XmlConvert.ToString(FadeInTime));
            writer.WriteElementString("FadeInTimeVariation", XmlConvert.ToString(FadeInTimeVariation));
            writer.WriteElementString("FadeOutTime", XmlConvert.ToString(FadeOutTime));
            writer.WriteElementString("FadeOutTimeVariation", XmlConvert.ToString(FadeOutTime));
            writer.WriteElementString("Speed", XmlConvert.ToString(Speed));
            writer.WriteElementString("SpeedVariation", XmlConvert.ToString(SpeedVariation));
            writer.WriteElementString("DelayMs", XmlConvert.ToString(DelayMs));
            writer.WriteElementString("DelayMsVariation", XmlConvert.ToString(DelayMsVariation));
            writer.WriteElementString("Mass", XmlConvert.ToString(Mass));
            writer.WriteElementString("MassVariation", XmlConvert.ToString(MassVariation));
            writer.WriteElementString("ParticleCount", XmlConvert.ToString(ParticleCount));
            writer.WriteElementString("IgnoreScale", XmlConvert.ToString(IgnoreScale));
            writer.WriteElementString("Stopped", XmlConvert.ToString(Stopped));
            writer.WriteElementString("UseGravity", XmlConvert.ToString(UseGravity));
        }
Exemple #2
0
 /// <summary>
 /// Sets the Loop mode setting
 /// </summary>
 /// <param name="mode"></param>
 /// <returns></returns>
 public Task SetLoopModeAsync(LoopMode mode)
 {
     return(mediaPlayer.SetPropertyAsync("LoopMode", mode.ToString().ToUpper()));
 }