mirror of https://github.com/godotengine/godot
Merge pull request #100686 from raulsntos/fix-docs
[4.3] Fix various code examples in documentation
This commit is contained in:
commit
f11fa26c56
|
|
@ -21,11 +21,11 @@
|
||||||
var array = new Godot.Collections.Array{"First", 2, 3, "Last"};
|
var array = new Godot.Collections.Array{"First", 2, 3, "Last"};
|
||||||
GD.Print(array[0]); // Prints "First"
|
GD.Print(array[0]); // Prints "First"
|
||||||
GD.Print(array[2]); // Prints 3
|
GD.Print(array[2]); // Prints 3
|
||||||
GD.Print(array[array.Count - 1]); // Prints "Last"
|
GD.Print(array[^1]); // Prints "Last"
|
||||||
|
|
||||||
array[2] = "Second";
|
array[1] = "Second";
|
||||||
GD.Print(array[1]); // Prints "Second"
|
GD.Print(array[1]); // Prints "Second"
|
||||||
GD.Print(array[array.Count - 3]); // Prints "Second"
|
GD.Print(array[^3]); // Prints "Second"
|
||||||
[/csharp]
|
[/csharp]
|
||||||
[/codeblocks]
|
[/codeblocks]
|
||||||
[b]Note:[/b] Arrays are always passed by [b]reference[/b]. To get a copy of an array that can be modified independently of the original array, use [method duplicate].
|
[b]Note:[/b] Arrays are always passed by [b]reference[/b]. To get a copy of an array that can be modified independently of the original array, use [method duplicate].
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
server.listen(4242)
|
server.listen(4242)
|
||||||
var key = load("key.key") # Your private key.
|
var key = load("key.key") # Your private key.
|
||||||
var cert = load("cert.crt") # Your X509 certificate.
|
var cert = load("cert.crt") # Your X509 certificate.
|
||||||
dtls.setup(key, cert)
|
dtls.setup(TlsOptions.server(key, cert))
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
while server.is_connection_available():
|
while server.is_connection_available():
|
||||||
|
|
@ -52,12 +52,12 @@
|
||||||
_server.Listen(4242);
|
_server.Listen(4242);
|
||||||
var key = GD.Load<CryptoKey>("key.key"); // Your private key.
|
var key = GD.Load<CryptoKey>("key.key"); // Your private key.
|
||||||
var cert = GD.Load<X509Certificate>("cert.crt"); // Your X509 certificate.
|
var cert = GD.Load<X509Certificate>("cert.crt"); // Your X509 certificate.
|
||||||
_dtls.Setup(key, cert);
|
_dtls.Setup(TlsOptions.Server(key, cert));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void _Process(double delta)
|
public override void _Process(double delta)
|
||||||
{
|
{
|
||||||
while (Server.IsConnectionAvailable())
|
while (_server.IsConnectionAvailable())
|
||||||
{
|
{
|
||||||
PacketPeerUdp peer = _server.TakeConnection();
|
PacketPeerUdp peer = _server.TakeConnection();
|
||||||
PacketPeerDtls dtlsPeer = _dtls.TakeConnection(peer);
|
PacketPeerDtls dtlsPeer = _dtls.TakeConnection(peer);
|
||||||
|
|
|
||||||
|
|
@ -638,13 +638,13 @@
|
||||||
[/gdscript]
|
[/gdscript]
|
||||||
[csharp]
|
[csharp]
|
||||||
// Set region, using Path2D node.
|
// Set region, using Path2D node.
|
||||||
GetNode<Window>("Window").MousePassthrough = GetNode<Path2D>("Path2D").Curve.GetBakedPoints();
|
GetNode<Window>("Window").MousePassthroughPolygon = GetNode<Path2D>("Path2D").Curve.GetBakedPoints();
|
||||||
|
|
||||||
// Set region, using Polygon2D node.
|
// Set region, using Polygon2D node.
|
||||||
GetNode<Window>("Window").MousePassthrough = GetNode<Polygon2D>("Polygon2D").Polygon;
|
GetNode<Window>("Window").MousePassthroughPolygon = GetNode<Polygon2D>("Polygon2D").Polygon;
|
||||||
|
|
||||||
// Reset region to default.
|
// Reset region to default.
|
||||||
GetNode<Window>("Window").MousePassthrough = new Vector2[] {};
|
GetNode<Window>("Window").MousePassthroughPolygon = new Vector2[] {};
|
||||||
[/csharp]
|
[/csharp]
|
||||||
[/codeblocks]
|
[/codeblocks]
|
||||||
[b]Note:[/b] This property is ignored if [member mouse_passthrough] is set to [code]true[/code].
|
[b]Note:[/b] This property is ignored if [member mouse_passthrough] is set to [code]true[/code].
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue