39 lines
1.2 KiB
C#
39 lines
1.2 KiB
C#
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<LLMApiRequest>("/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<CanvasLayer>("Ingame/Ingame");
|
|
node.SetProcess(true);
|
|
node.Show();
|
|
var GParent = this.GetTree().Root.GetNode<CanvasLayer>("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));
|
|
}
|
|
}
|