You've already forked CC-Framework.BriskGameServer
Release v0.2.0 archive and space API update
This commit is contained in:
@@ -27,6 +27,52 @@ var top = await Brisk.Leaderboard.GetTopAsync("season-score", 20);
|
||||
await Brisk.Leaderboard.SubmitScoreAsync("season-score", 128);
|
||||
```
|
||||
|
||||
## Archive upload
|
||||
|
||||
```csharp
|
||||
await Brisk.Archive.UploadTextAsync(1, "{\"save\":1}");
|
||||
await Brisk.Archive.UploadJsonAsync(2, new
|
||||
{
|
||||
save = 1,
|
||||
coins = 128
|
||||
});
|
||||
|
||||
var text = await Brisk.Archive.DownloadTextAsync(1);
|
||||
var json = await Brisk.Archive.DownloadJsonAsync(2);
|
||||
```
|
||||
|
||||
Notes:
|
||||
|
||||
- if you already have binary data, keep using `Brisk.Archive.UploadAsync(slotNo, bytes)`
|
||||
- if you need version and checksum, keep using `Brisk.Archive.DownloadAsync(slotNo)`
|
||||
- `checksum` is optional in normal use
|
||||
- the SDK computes SHA256 for you automatically
|
||||
- if you pass a manual checksum, use plain SHA256 hex
|
||||
- values like `sha256:abcd...` will be normalized by the SDK before upload
|
||||
|
||||
## Space content
|
||||
|
||||
```csharp
|
||||
await Brisk.Space.UpdateMyAsync("Hello Brisk Space");
|
||||
|
||||
await Brisk.Space.UpdateMyAsync(new
|
||||
{
|
||||
mood = "ready",
|
||||
title = "hello"
|
||||
});
|
||||
|
||||
var mySpace = await Brisk.Space.GetByPlayerIdAsync(Brisk.PlayerId);
|
||||
var myContent = await Brisk.Space.DownloadContentByPlayerIdAsync(Brisk.PlayerId);
|
||||
var text = Encoding.UTF8.GetString(myContent.Bytes);
|
||||
```
|
||||
|
||||
Notes:
|
||||
|
||||
- space metadata and space content are now separated
|
||||
- `GetByPlayerIdAsync(...)` returns metadata only
|
||||
- use `DownloadContentByPlayerIdAsync(...)` to read the actual content bytes
|
||||
- `UpdateMyAsync(...)` automatically picks text / binary / json behavior from the payload type
|
||||
|
||||
## Sample
|
||||
|
||||
For the current source project, open directly:
|
||||
|
||||
Reference in New Issue
Block a user