You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-12 13:20:55 +00:00
Merge pull request #111135 from m4gr3d/add_emit_signal_overload
[Android] Minor updates to the `GodotPlugin` APIs
This commit is contained in:
@@ -361,7 +361,7 @@ public abstract class GodotPlugin {
|
||||
/**
|
||||
* Emit a registered Godot signal.
|
||||
* @param signalName Name of the signal to emit. It will be validated against the set of registered signals.
|
||||
* @param signalArgs Arguments used to populate the emitted signal. The arguments will be validated against the {@link SignalInfo} matching the registered signalName parameter.
|
||||
* @param signalArgs Arguments used to populate the emitted signal. The arguments will be validated against the registered {@link SignalInfo} matching the signalName parameter.
|
||||
*/
|
||||
protected void emitSignal(final String signalName, final Object... signalArgs) {
|
||||
try {
|
||||
@@ -380,6 +380,15 @@ public abstract class GodotPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Emit a registered Godot signal.
|
||||
* @param signal Signal to emit. It will be validated against the set of registered signals.
|
||||
* @param signalArgs Arguments used to populate the emitted signal. The arguments will be validated against the registered {@link SignalInfo} matching the signal parameter.
|
||||
*/
|
||||
protected void emitSignal(SignalInfo signal, final Object... signalArgs) {
|
||||
emitSignal(signal.getName(), signalArgs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Emit a Godot signal.
|
||||
* @param godot Godot instance
|
||||
@@ -402,7 +411,8 @@ public abstract class GodotPlugin {
|
||||
|
||||
// Validate the argument's types.
|
||||
for (int i = 0; i < signalParamTypes.length; i++) {
|
||||
if (!signalParamTypes[i].isInstance(signalArgs[i])) {
|
||||
Object signalArg = signalArgs[i];
|
||||
if (signalArg != null && !signalParamTypes[i].isInstance(signalArg)) {
|
||||
throw new IllegalArgumentException(
|
||||
"Invalid type for argument #" + i + ". Should be of type " + signalParamTypes[i].getName());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user