godot/modules/mono/glue/GodotSharp/GodotSharp/Core/Callable.cs
Ignacio Etcheverry 6a85cdf640 Fix C# bindings after recent breaking changes
Implementation for new Variant types Callable, Signal, StringName.
Added support for PackedInt64Array and PackedFloat64Array.

Add generation of signal members as events, as well as support for
user created signals as events.
NOTE: As of now, raising such events will not emit the signal. As such,
one must use `EmitSignal` instead of raising the event directly.

Removed old ThreadLocal fallback class. It's safe to use thread_local now since
it's supported on all minimum versions of compilers we support.
2020-03-17 16:30:04 +01:00

32 lines
762 B
C#

using System;
namespace Godot
{
public struct Callable
{
private readonly Object _target;
private readonly StringName _method;
private readonly Delegate _delegate;
public Object Target => _target;
public StringName Method => _method;
public Delegate Delegate => _delegate;
public static implicit operator Callable(Delegate @delegate) => new Callable(@delegate);
public Callable(Object target, StringName method)
{
_target = target;
_method = method;
_delegate = null;
}
public Callable(Delegate @delegate)
{
_target = null;
_method = null;
_delegate = @delegate;
}
}
}