From 2e4d573c3ca1303e7727e82fff9e5ddb312d34b1 Mon Sep 17 00:00:00 2001 From: Yuzhao Wang <619365929@qq.com> Date: Wed, 5 Jun 2024 09:21:30 +0800 Subject: [PATCH] Remove the limit on the number of the SignalInfo function parameters Update platform/android/api/jni_singleton.h Co-authored-by: A Thousand Ships (she/her) <96648715+AThousandShips@users.noreply.github.com> --- platform/android/api/jni_singleton.h | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/platform/android/api/jni_singleton.h b/platform/android/api/jni_singleton.h index 01da0c793511..087fd1bacec8 100644 --- a/platform/android/api/jni_singleton.h +++ b/platform/android/api/jni_singleton.h @@ -219,19 +219,12 @@ class JNISingleton : public Object { } void add_signal(const StringName &p_name, const Vector &p_args) { - if (p_args.size() == 0) { - ADD_SIGNAL(MethodInfo(p_name)); - } else if (p_args.size() == 1) { - ADD_SIGNAL(MethodInfo(p_name, PropertyInfo(p_args[0], "arg1"))); - } else if (p_args.size() == 2) { - ADD_SIGNAL(MethodInfo(p_name, PropertyInfo(p_args[0], "arg1"), PropertyInfo(p_args[1], "arg2"))); - } else if (p_args.size() == 3) { - ADD_SIGNAL(MethodInfo(p_name, PropertyInfo(p_args[0], "arg1"), PropertyInfo(p_args[1], "arg2"), PropertyInfo(p_args[2], "arg3"))); - } else if (p_args.size() == 4) { - ADD_SIGNAL(MethodInfo(p_name, PropertyInfo(p_args[0], "arg1"), PropertyInfo(p_args[1], "arg2"), PropertyInfo(p_args[2], "arg3"), PropertyInfo(p_args[3], "arg4"))); - } else if (p_args.size() == 5) { - ADD_SIGNAL(MethodInfo(p_name, PropertyInfo(p_args[0], "arg1"), PropertyInfo(p_args[1], "arg2"), PropertyInfo(p_args[2], "arg3"), PropertyInfo(p_args[3], "arg4"), PropertyInfo(p_args[4], "arg5"))); + MethodInfo mi; + mi.name = p_name; + for (int i = 0; i < p_args.size(); i++) { + mi.arguments.push_back(PropertyInfo(p_args[i], "arg" + itos(i + 1))); } + ADD_SIGNAL(mi); } #endif