game-dev #8
10
godot/God of AI.csproj
Normal file
10
godot/God of AI.csproj
Normal file
@ -0,0 +1,10 @@
|
||||
<Project Sdk="Godot.NET.Sdk/4.1.1">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<EnableDynamicLoading>true</EnableDynamicLoading>
|
||||
<RootNamespace>GodofAI</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -1,27 +1,38 @@
|
||||
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()
|
||||
{
|
||||
this.Pressed += ButtonPressed;
|
||||
SetProcess(false);
|
||||
llmApiRequest = GetNode<LLMApiRequest>("/root/Node2D/HTTPRequests");
|
||||
}
|
||||
|
||||
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
public override void _Pressed()
|
||||
{
|
||||
// llmApiRequest.RequestCompleted += OnRequestCompleted;
|
||||
// llmApiRequest.Request("https://api.github.com/repos/godotengine/godot/releases/latest");
|
||||
llmApiRequest?.PostToApi(OnRequestCompleted);
|
||||
|
||||
}
|
||||
|
||||
private void ButtonPressed()
|
||||
{
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user