mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-07-06 23:03:56 +00:00
3.0 - unitypackage
This commit is contained in:
49
Runtime/Internal/Attributes/SerieConvertAttribute.cs
Normal file
49
Runtime/Internal/Attributes/SerieConvertAttribute.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
|
||||
/// <summary>
|
||||
/// What serie can convert to me
|
||||
/// </summary>
|
||||
public sealed class SerieConvertAttribute : Attribute
|
||||
{
|
||||
public readonly Type type0;
|
||||
public readonly Type type1;
|
||||
public readonly Type type2;
|
||||
public readonly Type type3;
|
||||
|
||||
public SerieConvertAttribute(Type serie)
|
||||
{
|
||||
type0 = serie;
|
||||
}
|
||||
public SerieConvertAttribute(Type serie, Type serie2)
|
||||
{
|
||||
type0 = serie;
|
||||
type1 = serie2;
|
||||
}
|
||||
public SerieConvertAttribute(Type serie, Type serie2, Type serie3)
|
||||
{
|
||||
type0 = serie;
|
||||
type1 = serie2;
|
||||
type2 = serie3;
|
||||
}
|
||||
public SerieConvertAttribute(Type serie, Type serie2, Type serie3, Type serie4)
|
||||
{
|
||||
type0 = serie;
|
||||
type1 = serie2;
|
||||
type2 = serie3;
|
||||
type3 = serie4;
|
||||
}
|
||||
|
||||
public bool Contains<T>() where T : Serie
|
||||
{
|
||||
return Contains(typeof(T));
|
||||
}
|
||||
|
||||
public bool Contains(Type type)
|
||||
{
|
||||
return (type == type0 || type == type1 || type == type2 || type == type3);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user