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>
This commit is contained in:
Yuzhao Wang 2024-06-05 09:21:30 +08:00
parent a4f2ea91a1
commit 2e4d573c3c
1 changed files with 5 additions and 12 deletions

View File

@ -219,19 +219,12 @@ public:
} }
void add_signal(const StringName &p_name, const Vector<Variant::Type> &p_args) { void add_signal(const StringName &p_name, const Vector<Variant::Type> &p_args) {
if (p_args.size() == 0) { MethodInfo mi;
ADD_SIGNAL(MethodInfo(p_name)); mi.name = p_name;
} else if (p_args.size() == 1) { for (int i = 0; i < p_args.size(); i++) {
ADD_SIGNAL(MethodInfo(p_name, PropertyInfo(p_args[0], "arg1"))); mi.arguments.push_back(PropertyInfo(p_args[i], "arg" + itos(i + 1)));
} 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")));
} }
ADD_SIGNAL(mi);
} }
#endif #endif