This repository has been archived on 2023-11-16. You can view files and clone it, but cannot push or open issues or pull requests.
GOA/godot/Playbutton.cs

39 lines
1.2 KiB
C#
Raw Permalink Normal View History

2023-09-23 17:04:11 +02:00
using Godot;
using System;
2023-09-23 19:42:38 +02:00
using System.Net.Cache;
2023-09-23 17:04:11 +02:00
public partial class Playbutton : Button
{
2023-09-23 19:42:38 +02:00
private LLMApiRequest llmApiRequest;
2023-09-23 17:04:11 +02:00
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
2023-09-23 19:42:38 +02:00
SetProcess(false);
llmApiRequest = GetNode<LLMApiRequest>("/root/Node2D/HTTPRequests");
2023-09-23 17:04:11 +02:00
}
2023-09-24 10:41:14 +02:00
public override void _Pressed()
{
// llmApiRequest.RequestCompleted += OnRequestCompleted;
// llmApiRequest.Request("https://api.github.com/repos/godotengine/godot/releases/latest");
llmApiRequest?.PostToApi(OnRequestCompleted);
2023-09-23 19:42:38 +02:00
2023-09-23 17:04:11 +02:00
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();
2023-09-24 10:41:14 +02:00
}
2023-09-23 19:42:38 +02:00
2023-09-24 10:41:14 +02:00
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"]);
2023-09-23 19:42:38 +02:00
// GD.Print(Json.ParseString(System.Text.Encoding.UTF8.GetString(body)).AsGodotDictionary());
GD.Print(System.Text.Encoding.UTF8.GetString(body));
2023-09-24 10:41:14 +02:00
}
2023-09-23 17:04:11 +02:00
}