Example #1
0
        /// <summary>Add XML serialisation support for graphics types</summary>
        public static XmlConfig SupportRylogicCommonTypes(this XmlConfig cfg)
        {
            Xml_.ToMap[typeof(RangeI)] = (obj, node) =>
            {
                var r = (RangeI)obj;
                node.SetValue($"{r.Beg} {r.End}");
                return(node);
            };
            Xml_.AsMap[typeof(RangeI)] = (elem, type, instance) =>
            {
                return(RangeI.Parse(elem.Value));
            };

            Xml_.ToMap[typeof(RangeF)] = (obj, node) =>
            {
                var r = (RangeF)obj;
                node.SetValue($"{r.Beg} {r.End}");
                return(node);
            };
            Xml_.AsMap[typeof(RangeF)] = (elem, type, instance) =>
            {
                return(RangeF.Parse(elem.Value));
            };

            return(cfg);
        }
Example #2
0
 public ReleaseParameters()
 {
     Quantity = 1;
     Speed    = RangeF.Parse("[-1.0,1.0]");
     Colour   = new ColourRange(new Colour(0f, 0.5f, 0.5f), new Colour(360f, 0.5f, 0.5f));
     Opacity  = RangeF.Parse("[0.0,1.0]");
     Scale    = RangeF.Parse("[1.0,10.0]");
     Rotation = RangeF.Parse("[-3.14159,3.14159]");
     Mass     = 1f;
 }