using Godot; using System; using System.Net.Cache; public partial class Playbutton : Button { private LLMApiRequest llmApiRequest; // Called when the node enters the scene tree for the first time. public override void _Ready() { SetProcess(false); llmApiRequest = GetNode("/root/Node2D/HTTPRequests"); } public override void _Pressed() { // llmApiRequest.RequestCompleted += OnRequestCompleted; // llmApiRequest.Request("https://api.github.com/repos/godotengine/godot/releases/latest"); llmApiRequest?.PostToApi(OnRequestCompleted); GD.Print("a"); var node = this.GetNode("Ingame/Ingame"); node.SetProcess(true); node.Show(); var GParent = this.GetTree().Root.GetNode("Root/Hauptmenü/HauptMenü"); GParent.Hide(); } private void OnRequestCompleted(long result, long responseCode, string[] headers, byte[] body) { // Godot.Collections.Dictionary json = Json.ParseString(System.Text.Encoding.UTF8.GetString(body)).AsGodotDictionary(); // GD.Print(json["name"]); // GD.Print(Json.ParseString(System.Text.Encoding.UTF8.GetString(body)).AsGodotDictionary()); GD.Print(System.Text.Encoding.UTF8.GetString(body)); } }