From 86f6662a8cb3ef640d9e21e037f35659a5049afc Mon Sep 17 00:00:00 2001 From: Raul Santos Date: Fri, 7 Oct 2022 12:11:24 +0200 Subject: C#: Fix signature of generated signal callbacks - Use `long` and `double` types since signals currently only support 64-bit types. - Fix bug for checking if the type name is a class registered in ClassDB. --- modules/mono/csharp_script.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'modules') diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 97a1d5c8d8..4b6d160392 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -390,10 +390,10 @@ bool CSharpLanguage::supports_builtin_mode() const { #ifdef TOOLS_ENABLED static String variant_type_to_managed_name(const String &p_var_type_name) { if (p_var_type_name.is_empty()) { - return "object"; + return "Variant"; } - if (!ClassDB::class_exists(p_var_type_name)) { + if (ClassDB::class_exists(p_var_type_name)) { return p_var_type_name; } @@ -401,12 +401,12 @@ static String variant_type_to_managed_name(const String &p_var_type_name) { return "Godot.Object"; } + if (p_var_type_name == Variant::get_type_name(Variant::INT)) { + return "long"; + } + if (p_var_type_name == Variant::get_type_name(Variant::FLOAT)) { -#ifdef REAL_T_IS_DOUBLE return "double"; -#else - return "float"; -#endif } if (p_var_type_name == Variant::get_type_name(Variant::STRING)) { @@ -484,7 +484,7 @@ static String variant_type_to_managed_name(const String &p_var_type_name) { } } - return "object"; + return "Variant"; } String CSharpLanguage::make_function(const String &, const String &p_name, const PackedStringArray &p_args) const { -- cgit v1.2.3