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,22 +1,25 @@
|
|||||||
using Godot;
|
using Godot;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Net.Cache;
|
||||||
|
|
||||||
public partial class Playbutton : Button
|
public partial class Playbutton : Button
|
||||||
{
|
{
|
||||||
|
private LLMApiRequest llmApiRequest;
|
||||||
|
|
||||||
// Called when the node enters the scene tree for the first time.
|
// Called when the node enters the scene tree for the first time.
|
||||||
public override void _Ready()
|
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 _Pressed()
|
||||||
public override void _Process(double delta)
|
|
||||||
{
|
{
|
||||||
|
// llmApiRequest.RequestCompleted += OnRequestCompleted;
|
||||||
|
// llmApiRequest.Request("https://api.github.com/repos/godotengine/godot/releases/latest");
|
||||||
|
llmApiRequest?.PostToApi(OnRequestCompleted);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonPressed()
|
|
||||||
{
|
|
||||||
GD.Print("a");
|
GD.Print("a");
|
||||||
var node = this.GetNode<CanvasLayer>("Ingame/Ingame");
|
var node = this.GetNode<CanvasLayer>("Ingame/Ingame");
|
||||||
node.SetProcess(true);
|
node.SetProcess(true);
|
||||||
@ -24,4 +27,12 @@ public partial class Playbutton : Button
|
|||||||
var GParent = this.GetTree().Root.GetNode<CanvasLayer>("Root/Hauptmenü/HauptMenü");
|
var GParent = this.GetTree().Root.GetNode<CanvasLayer>("Root/Hauptmenü/HauptMenü");
|
||||||
GParent.Hide();
|
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