summaryrefslogtreecommitdiff
path: root/Plugins/MonoGame.Extended/source/MonoGame.Extended.Particles/Serialization/InterpolatorJsonConverter.cs
blob: 21bd7fc4ade514b8084302a2f19cb85c75633ebe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using MonoGame.Extended.Particles.Modifiers.Interpolators;
using MonoGame.Extended.Serialization;

namespace MonoGame.Extended.Particles.Serialization
{
    public class InterpolatorJsonConverter : BaseTypeJsonConverter<Interpolator>
    {
        public InterpolatorJsonConverter() 
            : base(GetSupportedTypes(), "Interpolator")
        {
        }

        private static IEnumerable<TypeInfo> GetSupportedTypes()
        {
            return typeof(Interpolator)
                .GetTypeInfo()
                .Assembly
                .DefinedTypes
                .Where(type => typeof(Interpolator).GetTypeInfo().IsAssignableFrom(type) && !type.IsAbstract);
        }
    }
}