Skip to content

Commit c7d3ad7

Browse files
committed
Add Godot SDK csproj
1 parent 2aefa5a commit c7d3ad7

6 files changed

Lines changed: 75 additions & 9 deletions

File tree

docs/docs/00100-intro/00300-tutorials/00500-godot-tutorial/00200-part-1.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ We will add the SpacetimeDB SDK using NuGet. Godot does not initialize a C# Proj
4545

4646
![Create GameManager Script](/images/godot/part-1-game-manager-script.png)
4747

48-
3. Add the `SpacetimeDB.ClientSDK` [NuGet package](https://www.nuget.org/packages/SpacetimeDB.ClientSDK/) using Visual Studio or Rider _NuGet Package Manager_ or via the .NET CLI:
48+
3. Add the `SpacetimeDB.ClientSDK` [NuGet package](https://www.nuget.org/packages/SpacetimeDB.ClientSDK.Godot/) using Visual Studio or Rider _NuGet Package Manager_ or via the .NET CLI:
4949

5050
```bash
51-
dotnet add package SpacetimeDB.ClientSDK
51+
dotnet add package SpacetimeDB.ClientSDK.Godot
5252
```
5353

5454
The SpacetimeDB Godot SDK provides helpful tools for integrating SpacetimeDB into Godot, including a connection update manager which will synchronize your Godot client's state with your SpacetimeDB database in accordance with your subscription queries.
@@ -81,4 +81,4 @@ Our Godot project is all set up! If you press play, it will show a blank screen,
8181

8282
### Create the Server Module
8383

84-
We've now got the very basics set up. In [part 2](part-2) you'll learn the basics of how to create a SpacetimeDB server module and how to connect to it from your client.
84+
We've now got the very basics set up. In [part 2](part-2) you'll learn the basics of how to create a SpacetimeDB server module and how to connect to it from your client.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<Project Sdk="Godot.NET.Sdk/4.6.2">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<LangVersion>9</LangVersion>
6+
<ImplicitUsings>disable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
<PackageId>SpacetimeDB.ClientSDK.Godot</PackageId>
9+
<Title>SpacetimeDB Godot SDK</Title>
10+
<Authors>jdetter</Authors>
11+
<Company>Clockwork Labs</Company>
12+
<Product>SpacetimeDB</Product>
13+
<Description>The SpacetimeDB Godot SDK is a software development kit (SDK) designed to simplify the interaction with SpacetimeDB server modules from Godot projects.</Description>
14+
<Copyright>2024</Copyright>
15+
<PackageProjectUrl>https://spacetimedb.com</PackageProjectUrl>
16+
<PackageIcon>logo.png</PackageIcon>
17+
<PackageReadmeFile>README.md</PackageReadmeFile>
18+
<RepositoryUrl>https://github.com/clockworklabs/com.clockworklabs.spacetimedbsdk</RepositoryUrl>
19+
<AssemblyVersion>2.1.0</AssemblyVersion>
20+
<Version>2.1.0</Version>
21+
<DefaultItemExcludes>$(DefaultItemExcludes);*~/**</DefaultItemExcludes>
22+
<RestorePackagesPath>packages</RestorePackagesPath>
23+
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
24+
<DefineConstants>$(DefineConstants);GODOT</DefineConstants>
25+
<!-- Godot.NET.Sdk defaults to .godot/mono/temp; build this package like the regular C# SDK. -->
26+
<BaseOutputPath>bin~/</BaseOutputPath>
27+
<OutputPath>bin~/$(Configuration)/$(TargetFramework)/</OutputPath>
28+
<PackageOutputPath>bin~/$(Configuration)/</PackageOutputPath>
29+
<BaseIntermediateOutputPath>obj~/godot/</BaseIntermediateOutputPath>
30+
<IntermediateOutputPath>obj~/godot/$(Configuration)/$(TargetFramework)/</IntermediateOutputPath>
31+
</PropertyGroup>
32+
33+
<ItemGroup>
34+
<PackageReference Include="SpacetimeDB.BSATN.Runtime" Version="2.1.*" />
35+
</ItemGroup>
36+
37+
<ItemGroup>
38+
<CompilerVisibleProperty Include="GodotDisabledSourceGenerators" />
39+
<CompilerVisibleProperty Include="GodotProjectDir" />
40+
<CompilerVisibleProperty Include="GodotProjectDirBase64" />
41+
<CompilerVisibleProperty Include="GodotSourceGenerators" />
42+
<CompilerVisibleProperty Include="IsGodotToolsProject" />
43+
</ItemGroup>
44+
45+
<ItemGroup>
46+
<None Include="logo.png" Pack="true" PackagePath="" />
47+
<None Include="README.md" Pack="true" PackagePath="" />
48+
</ItemGroup>
49+
50+
</Project>

sdks/csharp/SpacetimeDB.ClientSDK.Godot.csproj.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdks/csharp/SpacetimeDB.ClientSDK.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ VisualStudioVersion = 17.6.33717.318
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpacetimeDB.ClientSDK", "SpacetimeDB.ClientSDK.csproj", "{242A8146-A58D-43E9-A2BD-31FFC6851AA6}"
77
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpacetimeDB.ClientSDK.Godot", "SpacetimeDB.ClientSDK.Godot.csproj", "{8F4BFE0B-60D3-40EB-B26E-08A3F1C43A9F}"
9+
EndProject
810
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tests", "tests~\tests.csproj", "{5CD31104-4719-4CE3-8D39-8BAE0B75C085}"
911
EndProject
1012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "client", "..\..\templates\chat-console-cs\client.csproj", "{FE261832-1594-DE21-C8C8-2D525680CBD7}"
@@ -27,6 +29,10 @@ Global
2729
{242A8146-A58D-43E9-A2BD-31FFC6851AA6}.Debug|Any CPU.Build.0 = Debug|Any CPU
2830
{242A8146-A58D-43E9-A2BD-31FFC6851AA6}.Release|Any CPU.ActiveCfg = Release|Any CPU
2931
{242A8146-A58D-43E9-A2BD-31FFC6851AA6}.Release|Any CPU.Build.0 = Release|Any CPU
32+
{8F4BFE0B-60D3-40EB-B26E-08A3F1C43A9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33+
{8F4BFE0B-60D3-40EB-B26E-08A3F1C43A9F}.Debug|Any CPU.Build.0 = Debug|Any CPU
34+
{8F4BFE0B-60D3-40EB-B26E-08A3F1C43A9F}.Release|Any CPU.ActiveCfg = Release|Any CPU
35+
{8F4BFE0B-60D3-40EB-B26E-08A3F1C43A9F}.Release|Any CPU.Build.0 = Release|Any CPU
3036
{5CD31104-4719-4CE3-8D39-8BAE0B75C085}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
3137
{5CD31104-4719-4CE3-8D39-8BAE0B75C085}.Debug|Any CPU.Build.0 = Debug|Any CPU
3238
{5CD31104-4719-4CE3-8D39-8BAE0B75C085}.Release|Any CPU.ActiveCfg = Release|Any CPU

sdks/csharp/src/AuthToken.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,31 +53,31 @@ public static class AuthToken
5353
private const string Section = "stdb";
5454
private static string Key => "identity_token";
5555

56-
private static ConfigFile _config;
56+
private static ConfigFile? _config;
5757
private static ConfigFile Config => _config ??= new ConfigFile();
5858

59-
public static string GetToken(string keySuffix = null)
59+
public static string GetToken(string? keySuffix = null)
6060
{
6161
var key = GetKey(keySuffix);
6262
if(!Config.HasSectionKey(Section, key))
6363
{
6464
Config.Load(Path);
6565
}
66-
return Config.GetValue(Section, key, default(string)).As<string>();
66+
return Config.GetValue(Section, key, "").As<string>();
6767
}
6868
public static bool TryGetToken(out string result) => TryGetToken(null, out result);
69-
public static bool TryGetToken(string keySuffix, out string result) {
69+
public static bool TryGetToken(string? keySuffix, out string result) {
7070
result = GetToken(keySuffix);
7171
return !string.IsNullOrWhiteSpace(result);
7272
}
7373

74-
public static void SaveToken(string token, string keySuffix = null)
74+
public static void SaveToken(string token, string? keySuffix = null)
7575
{
7676
Config.SetValue(Section, GetKey(keySuffix), token);
7777
Config.Save(Path);
7878
}
7979

80-
private static string GetKey(string suffix) => string.IsNullOrWhiteSpace(suffix) ? Key : $"{Key}_{suffix}";
80+
private static string GetKey(string? suffix) => string.IsNullOrWhiteSpace(suffix) ? Key : $"{Key}_{suffix}";
8181
}
8282
}
8383
#else

sdks/csharp/src/GodotDebugLogger.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
* *
44
*/
55
#if GODOT
6+
using System;
7+
using Godot;
8+
69
namespace SpacetimeDB
710
{
811
internal class GodotDebugLogger : ISpacetimeDBLogger

0 commit comments

Comments
 (0)