diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-01-27 00:13:13 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-01-27 00:13:13 +0100 |
commit | 0d1b5f88324b4ca235ae7599acf57fdb7b8f555a (patch) | |
tree | 084924303c004ea9a41ebbc667d168811e0457db /modules/mono/glue/GodotSharp | |
parent | 3b086aa062068f4d866b2207bb5b5770e40aafac (diff) | |
parent | a6ba914f1505a5db165a7b3fe44aa7d3c06cdf8b (diff) |
Merge pull request #71356 from raulsntos/dotnet/get
C#: Lookup signals and methods in Get method
Diffstat (limited to 'modules/mono/glue/GodotSharp')
-rw-r--r-- | modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/CSharpInstanceBridge.cs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/CSharpInstanceBridge.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/CSharpInstanceBridge.cs index 354212da1b..ccb21502c0 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/CSharpInstanceBridge.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/CSharpInstanceBridge.cs @@ -84,12 +84,29 @@ namespace Godot.Bridge if (godotObject == null) throw new InvalidOperationException(); + // Properties if (godotObject.GetGodotClassPropertyValue(CustomUnsafe.AsRef(name), out godot_variant outRetValue)) { *outRet = outRetValue; return godot_bool.True; } + // Signals + if (godotObject.HasGodotClassSignal(CustomUnsafe.AsRef(name))) + { + godot_signal signal = new godot_signal(*name, godotObject.GetInstanceId()); + *outRet = VariantUtils.CreateFromSignalTakingOwnershipOfDisposableValue(signal); + return godot_bool.True; + } + + // Methods + if (godotObject.HasGodotClassMethod(CustomUnsafe.AsRef(name))) + { + godot_callable method = new godot_callable(*name, godotObject.GetInstanceId()); + *outRet = VariantUtils.CreateFromCallableTakingOwnershipOfDisposableValue(method); + return godot_bool.True; + } + var nameManaged = StringName.CreateTakingOwnershipOfDisposableValue( NativeFuncs.godotsharp_string_name_new_copy(CustomUnsafe.AsRef(name))); |