MehCode/Nodes/Math/Constant/E.cs
namespace Nodebox.Nodes;

[Register]
[Description("Euler's number")]
[Tag("Math", "Constant")]
// [Alias("Euler")]
[Polymorphic(true)]
public class E : Node
{
	public override Vector2 SizeMultiplier => new(0.75f, 1f);

	public override (Pin[] In, Pin[] Out) InitialPins => (
        new Pin[] {
        },
        
        new Pin[] {
            Pin.New<Polymorphic>(""),
        }
    );

	public override Node Polymorph(PinWireChange change) =>
        PolymorphHelpers.ToConnectedTypeIfRegistered(typeof(E<>), change);

	public DisplayPanel DisplayPanel { get; private set; }
	public override void Render(Panel panel)
	{
        DisplayPanel ??= new DisplayPanel {
            Parent = panel,
            FontSizeOverride = 40f,
        };

        DisplayPanel.Value = "e";
	}
}

[Register(typeof(Library.Float))]
[Polymorphic(typeof(E))]
public class E<T> : E
{
	public override (Pin[] In, Pin[] Out) InitialPins => base.InitialPins.SubstitutePolymorphic<T>();

    public E() {
        if (typeof(T) == typeof(float)) {
            SetOutput(0, MathF.E);
            return;
        }
        else if (typeof(T) == typeof(double)) {
            SetOutput(0, Math.E);
            return;
        }

        throw new Exception("wtf");
    }
    
    public override Node Polymorph(PinWireChange change) =>
        PolymorphHelpers.ToNonGenericIfAllDisconnected<E>(change);
}