You've already forked CC-Framework.BriskGameServer
3.0 KiB
3.0 KiB
Quick Start
Initialize
await Brisk.InitializeAsync(new BriskOptions
{
BaseUrl = "https://brisk.lightyears.ltd",
GameKey = "demo-game",
ClientVersion = Application.version,
DeviceId = SystemInfo.deviceUniqueIdentifier
});
Login
await Brisk.Auth.LoginWithUserIdAsync("tap", "tap_user_10001");
Common calls
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
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) checksumis 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
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);
var likeResult = await Brisk.Space.LikeByPlayerIdAsync("target-player-id");
Debug.Log($"total={likeResult.LikeCount}, today={likeResult.TodayLikeCount}, created={likeResult.Created}");
var todayLikes = await Brisk.Space.GetLikesByPlayerIdAsync(Brisk.PlayerId, 20, true);
var visits = await Brisk.Space.GetMyVisitsAsync();
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- space likes are now tracked by natural day in
Asia/Shanghai BriskSpaceView/BriskSpaceStatsinclude bothLikeCountandTodayLikeCountBriskSpaceViewalso includesLikedByMeandLikeResetAtGetLikesByPlayerIdAsync(..., currentCycleOnly: true)returns current-cycle likes onlyGetMyVisitsAsync()now defaults to the latest50visits, with100as the server-side max
Sample
For the current source project, open directly:
Assets/BriskSdk/Samples/QuickStart/BriskQuickStartSample.csAssets/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