[Doc] Fix casing of some C# names
(cherry picked from commit 366cc648bf
)
This commit is contained in:
parent
36a32f4a5a
commit
c2918e6e06
|
@ -45,7 +45,7 @@
|
|||
{
|
||||
private DtlsServer _dtls = new DtlsServer();
|
||||
private UdpServer _server = new UdpServer();
|
||||
private Godot.Collections.Array<PacketPeerDTLS> _peers = new Godot.Collections.Array<PacketPeerDTLS>();
|
||||
private Godot.Collections.Array<PacketPeerDtls> _peers = new Godot.Collections.Array<PacketPeerDtls>();
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
|
@ -59,8 +59,8 @@
|
|||
{
|
||||
while (Server.IsConnectionAvailable())
|
||||
{
|
||||
PacketPeerUDP peer = _server.TakeConnection();
|
||||
PacketPeerDTLS dtlsPeer = _dtls.TakeConnection(peer);
|
||||
PacketPeerUdp peer = _server.TakeConnection();
|
||||
PacketPeerDtls dtlsPeer = _dtls.TakeConnection(peer);
|
||||
if (dtlsPeer.GetStatus() != PacketPeerDtls.Status.Handshaking)
|
||||
{
|
||||
continue; // It is normal that 50% of the connections fails due to cookie exchange.
|
||||
|
|
|
@ -156,9 +156,9 @@
|
|||
[/gdscript]
|
||||
[csharp]
|
||||
var fields = new Godot.Collections.Dictionary { { "username", "user" }, { "password", "pass" } };
|
||||
string queryString = new HTTPClient().QueryStringFromDict(fields);
|
||||
string queryString = new HttpClient().QueryStringFromDict(fields);
|
||||
string[] headers = { "Content-Type: application/x-www-form-urlencoded", $"Content-Length: {queryString.Length}" };
|
||||
var result = new HTTPClient().Request(HTTPClient.Method.Post, "index.php", headers, queryString);
|
||||
var result = new HttpClient().Request(HttpClient.Method.Post, "index.php", headers, queryString);
|
||||
[/csharp]
|
||||
[/codeblocks]
|
||||
[b]Note:[/b] The [param body] parameter is ignored if [param method] is [constant HTTPClient.METHOD_GET]. This is because GET methods can't contain request data. As a workaround, you can pass request data as a query string in the URL. See [method String.uri_encode] for an example.
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
public override void _Ready()
|
||||
{
|
||||
// Create an HTTP request node and connect its completion signal.
|
||||
var httpRequest = new HTTPRequest();
|
||||
var httpRequest = new HttpRequest();
|
||||
AddChild(httpRequest);
|
||||
httpRequest.RequestCompleted += HttpRequestCompleted;
|
||||
|
||||
|
@ -61,7 +61,7 @@
|
|||
{
|
||||
{ "name", "Godette" }
|
||||
});
|
||||
error = httpRequest.Request("https://httpbin.org/post", null, HTTPClient.Method.Post, body);
|
||||
error = httpRequest.Request("https://httpbin.org/post", null, HttpClient.Method.Post, body);
|
||||
if (error != Error.Ok)
|
||||
{
|
||||
GD.PushError("An error occurred in the HTTP request.");
|
||||
|
@ -115,7 +115,7 @@
|
|||
public override void _Ready()
|
||||
{
|
||||
// Create an HTTP request node and connect its completion signal.
|
||||
var httpRequest = new HTTPRequest();
|
||||
var httpRequest = new HttpRequest();
|
||||
AddChild(httpRequest);
|
||||
httpRequest.RequestCompleted += HttpRequestCompleted;
|
||||
|
||||
|
@ -130,7 +130,7 @@
|
|||
// Called when the HTTP request is completed.
|
||||
private void HttpRequestCompleted(long result, long responseCode, string[] headers, byte[] body)
|
||||
{
|
||||
if (result != (long)HTTPRequest.Result.Success)
|
||||
if (result != (long)HttpRequest.Result.Success)
|
||||
{
|
||||
GD.PushError("Image couldn't be downloaded. Try a different image.");
|
||||
}
|
||||
|
|
|
@ -37,13 +37,13 @@
|
|||
|
||||
public override void _Input(InputEvent inputEvent)
|
||||
{
|
||||
if (inputEvent is InputEventMIDI midiEvent)
|
||||
if (inputEvent is InputEventMidi midiEvent)
|
||||
{
|
||||
PrintMIDIInfo(midiEvent);
|
||||
}
|
||||
}
|
||||
|
||||
private void PrintMIDIInfo(InputEventMIDI midiEvent)
|
||||
private void PrintMIDIInfo(InputEventMidi midiEvent)
|
||||
{
|
||||
GD.Print(midiEvent);
|
||||
GD.Print($"Channel {midiEvent.Channel}");
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
packer.flush()
|
||||
[/gdscript]
|
||||
[csharp]
|
||||
var packer = new PCKPacker();
|
||||
var packer = new PckPacker();
|
||||
packer.PckStart("test.pck");
|
||||
packer.AddFile("res://text.txt", "text.txt");
|
||||
packer.Flush();
|
||||
|
|
|
@ -121,7 +121,7 @@
|
|||
return
|
||||
[/gdscript]
|
||||
[csharp]
|
||||
var socket = new PacketPeerUDP();
|
||||
var socket = new PacketPeerUdp();
|
||||
// Server
|
||||
socket.SetDestAddress("127.0.0.1", 789);
|
||||
socket.PutPacket("Time to stop".ToAsciiBuffer());
|
||||
|
|
Loading…
Reference in New Issue