Update C# signal documentation and remove bind array

- Updates C# signal documentation and code examples to the new API in 4.0
- Replace all `nameof` usages with the exposed `StringName`
This commit is contained in:
Raul Santos
2022-08-26 16:21:45 +02:00
parent 1f22c482e1
commit 92e4b4e888
9 changed files with 48 additions and 50 deletions
+6 -4
View File
@@ -18,17 +18,19 @@
callable.call("invalid") # Invalid call, should have at least 2 arguments.
[/gdscript]
[csharp]
public void PrintArgs(object arg1, object arg2, object arg3 = null)
// Default parameter values are not supported.
public void PrintArgs(Variant arg1, Variant arg2, Variant arg3 = default)
{
GD.PrintS(arg1, arg2, arg3);
}
public void Test()
{
Callable callable = new Callable(this, nameof(PrintArgs));
callable.Call("hello", "world"); // Prints "hello world null".
// Invalid calls fail silently.
Callable callable = new Callable(this, MethodName.PrintArgs);
callable.Call("hello", "world"); // Default parameter values are not supported, should have 3 arguments.
callable.Call(Vector2.Up, 42, callable); // Prints "(0, -1) 42 Node(Node.cs)::PrintArgs".
callable.Call("invalid"); // Invalid call, should have at least 2 arguments.
callable.Call("invalid"); // Invalid call, should have 3 arguments.
}
[/csharp]
[/codeblocks]