You've already forked CC-Framework.BriskGameServer
Release v0.3.0 lowercase UPM package name
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
# Quick Start
|
||||
|
||||
## Initialize
|
||||
|
||||
```csharp
|
||||
await Brisk.InitializeAsync(new BriskOptions
|
||||
{
|
||||
BaseUrl = "https://brisk.lightyears.ltd",
|
||||
GameKey = "demo-game",
|
||||
ClientVersion = Application.version,
|
||||
DeviceId = SystemInfo.deviceUniqueIdentifier
|
||||
});
|
||||
```
|
||||
|
||||
## Login
|
||||
|
||||
```csharp
|
||||
await Brisk.Auth.LoginWithUserIdAsync("tap", "tap_user_10001");
|
||||
```
|
||||
|
||||
## Common calls
|
||||
|
||||
```csharp
|
||||
var me = await Brisk.Player.GetMeAsync();
|
||||
var config = await Brisk.Config.GetCurrentAsync();
|
||||
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:
|
||||
|
||||
- `Assets/BriskSdk/Samples/QuickStart/BriskQuickStartSample.cs`
|
||||
- `Assets/Scenes/BriskQuickStartScene.unity`
|
||||
|
||||
The sample scene uses an IMGUI debug panel and can directly test:
|
||||
|
||||
- initialize and restore
|
||||
- login by `login_user_id`
|
||||
- login by `code`
|
||||
- player, config, announcement, leaderboard, archive, and space flows
|
||||
- global event logs and request results
|
||||
Reference in New Issue
Block a user