You've already forked CC-Framework.BriskGameServer
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3a4f2f6652 | |||
| 4fd2222d6d | |||
| 0e5cab4f27 | |||
| a257a8a912 | |||
| 7a8dd4cea0 |
@@ -249,8 +249,10 @@ internal static class BriskModelMapper
|
||||
ContentSizeBytes = BriskValueReader.GetLong(data, "content_size_bytes"),
|
||||
ContentChecksum = BriskValueReader.GetString(data, "content_checksum"),
|
||||
LikeCount = BriskValueReader.GetLong(data, "like_count"),
|
||||
TodayLikeCount = BriskValueReader.GetLong(data, "today_like_count"),
|
||||
VisitCount = BriskValueReader.GetLong(data, "visit_count"),
|
||||
LikedByMe = BriskValueReader.GetBool(data, "liked_by_me"),
|
||||
LikeResetAt = BriskValueReader.GetString(data, "like_reset_at"),
|
||||
UpdatedAt = BriskValueReader.GetString(data, "updated_at")
|
||||
};
|
||||
}
|
||||
@@ -276,7 +278,9 @@ internal static class BriskModelMapper
|
||||
ContentSizeBytes = BriskValueReader.GetLong(data, "content_size_bytes"),
|
||||
ContentChecksum = BriskValueReader.GetString(data, "content_checksum"),
|
||||
LikeCount = BriskValueReader.GetLong(data, "like_count"),
|
||||
TodayLikeCount = BriskValueReader.GetLong(data, "today_like_count"),
|
||||
VisitCount = BriskValueReader.GetLong(data, "visit_count"),
|
||||
LikeResetAt = BriskValueReader.GetString(data, "like_reset_at"),
|
||||
UpdatedAt = BriskValueReader.GetString(data, "updated_at")
|
||||
};
|
||||
}
|
||||
@@ -309,7 +313,11 @@ internal static class BriskModelMapper
|
||||
return new BriskSpaceLikeResult
|
||||
{
|
||||
Liked = BriskValueReader.GetBool(data, "liked"),
|
||||
LikeCount = BriskValueReader.GetLong(data, "like_count")
|
||||
Created = BriskValueReader.GetBool(data, "created"),
|
||||
LikedByMe = BriskValueReader.GetBool(data, "liked_by_me"),
|
||||
LikeCount = BriskValueReader.GetLong(data, "like_count"),
|
||||
TodayLikeCount = BriskValueReader.GetLong(data, "today_like_count"),
|
||||
LikeResetAt = BriskValueReader.GetString(data, "like_reset_at")
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
public sealed class BriskSpaceLikeResult
|
||||
{
|
||||
public bool Liked;
|
||||
public bool Created;
|
||||
public bool LikedByMe;
|
||||
public long LikeCount;
|
||||
public long TodayLikeCount;
|
||||
public string LikeResetAt;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ public sealed class BriskSpaceStats
|
||||
public long ContentSizeBytes;
|
||||
public string ContentChecksum;
|
||||
public long LikeCount;
|
||||
public long TodayLikeCount;
|
||||
public long VisitCount;
|
||||
public string LikeResetAt;
|
||||
public string UpdatedAt;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,9 @@ public sealed class BriskSpaceView
|
||||
public long ContentSizeBytes;
|
||||
public string ContentChecksum;
|
||||
public long LikeCount;
|
||||
public long TodayLikeCount;
|
||||
public long VisitCount;
|
||||
public bool LikedByMe;
|
||||
public string LikeResetAt;
|
||||
public string UpdatedAt;
|
||||
}
|
||||
|
||||
@@ -68,23 +68,23 @@ public sealed class BriskSpaceModule
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 按玩家 ID 获取最近点赞列表。
|
||||
/// 按玩家 ID 获取点赞列表。
|
||||
/// </summary>
|
||||
public async Task<IReadOnlyList<BriskSpaceLikeItem>> GetLikesByPlayerIdAsync(string playerId, int limit = 20)
|
||||
public async Task<IReadOnlyList<BriskSpaceLikeItem>> GetLikesByPlayerIdAsync(string playerId, int limit = 20, bool currentCycleOnly = false)
|
||||
{
|
||||
ValidatePlayerId(playerId);
|
||||
|
||||
return await ExecuteAsync(async context =>
|
||||
{
|
||||
var data = await context.HttpClient.GetRawDataAsync($"/spaces/{playerId}/likes", CreateLimitQuery(limit), true);
|
||||
var data = await context.HttpClient.GetRawDataAsync($"/spaces/{playerId}/likes", CreateLikesQuery(limit, currentCycleOnly), true);
|
||||
return (IReadOnlyList<BriskSpaceLikeItem>)BriskModelMapper.ToSpaceLikeItems(data);
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 按登录身份获取最近点赞列表。
|
||||
/// 按登录身份获取点赞列表。
|
||||
/// </summary>
|
||||
public async Task<IReadOnlyList<BriskSpaceLikeItem>> GetLikesByLoginIdentityAsync(string loginProvider, string loginUserId, int limit = 20)
|
||||
public async Task<IReadOnlyList<BriskSpaceLikeItem>> GetLikesByLoginIdentityAsync(string loginProvider, string loginUserId, int limit = 20, bool currentCycleOnly = false)
|
||||
{
|
||||
ValidateLoginIdentity(loginProvider, loginUserId);
|
||||
|
||||
@@ -92,6 +92,10 @@ public sealed class BriskSpaceModule
|
||||
{
|
||||
var query = CreateLoginIdentityQuery(loginProvider, loginUserId);
|
||||
query["limit"] = NormalizeLimit(limit);
|
||||
if (currentCycleOnly)
|
||||
{
|
||||
query["scope"] = "cycle";
|
||||
}
|
||||
var data = await context.HttpClient.GetRawDataAsync("/spaces/by-login/likes", query, true);
|
||||
return (IReadOnlyList<BriskSpaceLikeItem>)BriskModelMapper.ToSpaceLikeItems(data);
|
||||
});
|
||||
@@ -236,7 +240,7 @@ public sealed class BriskSpaceModule
|
||||
/// <summary>
|
||||
/// 获取我的访客列表。
|
||||
/// </summary>
|
||||
public async Task<IReadOnlyList<BriskSpaceVisit>> GetMyVisitsAsync(int limit = 20)
|
||||
public async Task<IReadOnlyList<BriskSpaceVisit>> GetMyVisitsAsync(int limit = 50)
|
||||
{
|
||||
return await ExecuteAsync(async context =>
|
||||
{
|
||||
@@ -262,6 +266,17 @@ public sealed class BriskSpaceModule
|
||||
};
|
||||
}
|
||||
|
||||
private static Dictionary<string, string> CreateLikesQuery(int limit, bool currentCycleOnly)
|
||||
{
|
||||
var query = CreateLimitQuery(limit);
|
||||
if (currentCycleOnly)
|
||||
{
|
||||
query["scope"] = "cycle";
|
||||
}
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
private static void ValidatePlayerId(string playerId)
|
||||
{
|
||||
RequireNotEmpty(playerId, nameof(playerId));
|
||||
|
||||
@@ -475,14 +475,16 @@ public sealed class BriskQuickStartSample : MonoBehaviour
|
||||
DrawValueRow("内容版本", _mySpaceView == null ? "-" : _mySpaceView.ContentVersion.ToString());
|
||||
DrawValueRow("内容类型", _mySpaceView == null ? "-" : NullToDash(_mySpaceView.ContentType));
|
||||
DrawValueRow("内容大小", _mySpaceView == null ? "-" : _mySpaceView.ContentSizeBytes + " bytes");
|
||||
DrawValueRow("点赞数", _mySpaceStats == null ? "-" : _mySpaceStats.LikeCount.ToString());
|
||||
DrawValueRow("累计点赞数", _mySpaceStats == null ? "-" : _mySpaceStats.LikeCount.ToString());
|
||||
DrawValueRow("今日点赞数", _mySpaceStats == null ? "-" : _mySpaceStats.TodayLikeCount.ToString());
|
||||
DrawValueRow("访问数", _mySpaceStats == null ? "-" : _mySpaceStats.VisitCount.ToString());
|
||||
DrawValueRow("今日点赞重置", _mySpaceStats == null ? "-" : FormatLikeResetAt(_mySpaceStats.LikeResetAt));
|
||||
DrawValueRow("更新时间", _mySpaceView == null ? "-" : NullToDash(_mySpaceView.UpdatedAt));
|
||||
GUILayout.Space(8f);
|
||||
GUILayout.Label("最近给我点赞的用户", _sectionTitleStyle);
|
||||
GUILayout.Label("今天给我点赞的用户", _sectionTitleStyle);
|
||||
if (_mySpaceLikes.Count == 0)
|
||||
{
|
||||
GUILayout.Label("暂无点赞记录。", _bodyStyle);
|
||||
GUILayout.Label("当前周期暂无点赞记录。", _bodyStyle);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -509,9 +511,11 @@ public sealed class BriskQuickStartSample : MonoBehaviour
|
||||
DrawValueRow("PlayerId", _targetSpaceView == null ? "-" : NullToDash(_targetSpaceView.PlayerId));
|
||||
DrawValueRow("内容类型", _targetSpaceView == null ? "-" : NullToDash(_targetSpaceView.ContentType));
|
||||
DrawValueRow("内容大小", _targetSpaceView == null ? "-" : _targetSpaceView.ContentSizeBytes + " bytes");
|
||||
DrawValueRow("点赞数", _targetSpaceStats == null ? "-" : _targetSpaceStats.LikeCount.ToString());
|
||||
DrawValueRow("累计点赞数", _targetSpaceStats == null ? "-" : _targetSpaceStats.LikeCount.ToString());
|
||||
DrawValueRow("今日点赞数", _targetSpaceStats == null ? "-" : _targetSpaceStats.TodayLikeCount.ToString());
|
||||
DrawValueRow("访问数", _targetSpaceStats == null ? "-" : _targetSpaceStats.VisitCount.ToString());
|
||||
DrawValueRow("我的点赞状态", _targetSpaceView != null && _targetSpaceView.LikedByMe ? "已点赞" : "未点赞");
|
||||
DrawValueRow("今日点赞状态", _targetSpaceView != null && _targetSpaceView.LikedByMe ? "今日已点赞" : "今日未点赞");
|
||||
DrawValueRow("今日点赞重置", _targetSpaceView == null ? "-" : FormatLikeResetAt(_targetSpaceView.LikeResetAt));
|
||||
GUILayout.Space(8f);
|
||||
GUILayout.Label("空间内容", _sectionTitleStyle);
|
||||
GUILayout.TextArea(_targetSpaceContentText ?? string.Empty, _textAreaStyle, GUILayout.Height(240f));
|
||||
@@ -520,8 +524,8 @@ public sealed class BriskQuickStartSample : MonoBehaviour
|
||||
DrawCard("操作", () =>
|
||||
{
|
||||
DrawInlineButtons(
|
||||
new ButtonSpec("点赞", LikeTargetSpaceAsync, false, true),
|
||||
new ButtonSpec("取消点赞", UnlikeTargetSpaceAsync, false, true));
|
||||
new ButtonSpec("今日点赞", LikeTargetSpaceAsync, false, _targetSpaceView != null && !_targetSpaceView.LikedByMe),
|
||||
new ButtonSpec("撤销今日点赞", UnlikeTargetSpaceAsync, false, _targetSpaceView != null && _targetSpaceView.LikedByMe));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -636,7 +640,7 @@ public sealed class BriskQuickStartSample : MonoBehaviour
|
||||
|
||||
_mySpaceView = await Brisk.Space.GetByPlayerIdAsync(Brisk.PlayerId);
|
||||
_mySpaceStats = await Brisk.Space.GetStatsByPlayerIdAsync(Brisk.PlayerId);
|
||||
_mySpaceLikes = await Brisk.Space.GetLikesByPlayerIdAsync(Brisk.PlayerId, 10);
|
||||
_mySpaceLikes = await Brisk.Space.GetLikesByPlayerIdAsync(Brisk.PlayerId, 10, true);
|
||||
SpacePayloadText = await DownloadSpaceTextAsync(_mySpaceView, () => Brisk.Space.DownloadContentByPlayerIdAsync(Brisk.PlayerId));
|
||||
}
|
||||
|
||||
@@ -673,13 +677,15 @@ public sealed class BriskQuickStartSample : MonoBehaviour
|
||||
|
||||
private async Task LikeTargetSpaceAsync()
|
||||
{
|
||||
await Brisk.Space.LikeByPlayerIdAsync(SpacePlayerId);
|
||||
var result = await Brisk.Space.LikeByPlayerIdAsync(SpacePlayerId);
|
||||
Log("空间今日点赞结果: created=" + result.Created + ", total=" + result.LikeCount + ", today=" + result.TodayLikeCount);
|
||||
await LoadTargetSpaceAsync();
|
||||
}
|
||||
|
||||
private async Task UnlikeTargetSpaceAsync()
|
||||
{
|
||||
await Brisk.Space.UnlikeByPlayerIdAsync(SpacePlayerId);
|
||||
var result = await Brisk.Space.UnlikeByPlayerIdAsync(SpacePlayerId);
|
||||
Log("空间撤销今日点赞结果: total=" + result.LikeCount + ", today=" + result.TodayLikeCount);
|
||||
await LoadTargetSpaceAsync();
|
||||
}
|
||||
|
||||
@@ -1120,6 +1126,22 @@ public sealed class BriskQuickStartSample : MonoBehaviour
|
||||
return string.IsNullOrWhiteSpace(value) ? "-" : value;
|
||||
}
|
||||
|
||||
private static string FormatLikeResetAt(string value)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(value))
|
||||
{
|
||||
return "-";
|
||||
}
|
||||
|
||||
DateTimeOffset parsed;
|
||||
if (!DateTimeOffset.TryParse(value, out parsed))
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
return parsed.LocalDateTime.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
|
||||
private static async Task<string> DownloadSpaceTextAsync(BriskSpaceView view, Func<Task<BriskSpaceContentDownloadResult>> downloadContent)
|
||||
{
|
||||
if (view == null || !view.ContentExists || downloadContent == null)
|
||||
|
||||
@@ -259,7 +259,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
BaseUrl: https://brisk.lightyears.ltd
|
||||
GameKey: briskh5verify
|
||||
GameKey: game_a1faf5ee93d0
|
||||
ClientVersion: 1.0.0
|
||||
DeviceId: editor-device
|
||||
ValidateSessionOnInitialize: 1
|
||||
@@ -268,7 +268,7 @@ MonoBehaviour:
|
||||
LoginCode:
|
||||
Nickname: "Unity\u793A\u4F8B\u73A9\u5BB6"
|
||||
AvatarUrl:
|
||||
RankKey: h5-verify-rank-20260410034312-5cdd
|
||||
RankKey: rank-20260411062004-2bce
|
||||
SubmitScoreValue: 128
|
||||
LeaderboardLimit: 10
|
||||
AroundMeRange: 5
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
# Changelog
|
||||
|
||||
## 0.2.0
|
||||
|
||||
- Refined archive APIs with direct text and JSON upload/download helpers
|
||||
- Refactored player space to the latest metadata plus binary content architecture
|
||||
- Added space content download/update result models and like list models
|
||||
- Updated quick start sample to use the latest archive and space flows
|
||||
- Updated package and integration docs to match the current API surface
|
||||
|
||||
## 0.1.0
|
||||
|
||||
- Initial embedded package structure
|
||||
- Added Brisk runtime facade and service modules
|
||||
- Added default error presenter
|
||||
- Added quick start sample script and sample scene
|
||||
@@ -1,68 +0,0 @@
|
||||
# FoldCC Brisk Game Server SDK
|
||||
|
||||
This directory is the package publishing skeleton for Brisk.
|
||||
|
||||
The active Unity project source currently lives under:
|
||||
|
||||
- `Assets/BriskSdk/Runtime`
|
||||
- `Assets/BriskSdk/Samples/QuickStart`
|
||||
- `Assets/Scenes/BriskQuickStartScene.unity`
|
||||
|
||||
Sync package content from the Unity source project with:
|
||||
|
||||
- `Tools/Sync-BriskPackage.ps1`
|
||||
|
||||
## Included runtime modules
|
||||
|
||||
- Bootstrap and initialization
|
||||
- Auth and session restore
|
||||
- Player profile
|
||||
- Dynamic config
|
||||
- Announcements
|
||||
- Leaderboard
|
||||
- Archive upload and download
|
||||
- Player space
|
||||
- Default blocking error UI
|
||||
|
||||
## Archive checksum
|
||||
|
||||
Archive upload checksum is handled by the SDK by default.
|
||||
|
||||
- For quick use, the archive module now provides:
|
||||
- `UploadAsync(slotNo, bytes)` for binary
|
||||
- `UploadTextAsync(slotNo, text)` for UTF-8 text
|
||||
- `UploadJsonAsync(slotNo, payload)` for JSON objects
|
||||
- `DownloadAsync(slotNo)` for raw bytes + metadata
|
||||
- `DownloadTextAsync(slotNo)` for UTF-8 text
|
||||
- `DownloadJsonAsync(slotNo)` for JSON payloads
|
||||
- The SDK computes SHA256 automatically when uploading archive bytes
|
||||
- The current Brisk archive API expects a plain lowercase SHA256 hex string
|
||||
- Do not send values with a `sha256:` prefix
|
||||
- If a manual checksum includes that prefix, the SDK will normalize it before sending
|
||||
|
||||
## Space content
|
||||
|
||||
Player space now follows a metadata + binary content model.
|
||||
|
||||
- `GetByPlayerIdAsync(...)` and `GetByLoginIdentityAsync(...)` return metadata only
|
||||
- `DownloadContentByPlayerIdAsync(...)` and `DownloadContentByLoginIdentityAsync(...)` return raw bytes
|
||||
- `UpdateMyAsync(string)` uploads text content directly
|
||||
- `UpdateMyAsync(byte[])` uploads binary content directly
|
||||
- `UpdateMyAsync(object)` serializes the object as JSON automatically
|
||||
|
||||
## Package layout
|
||||
|
||||
- `Runtime`
|
||||
- `Samples~`
|
||||
- `Documentation~`
|
||||
|
||||
## Quick start
|
||||
|
||||
See:
|
||||
|
||||
- `Documentation~/QuickStart.md`
|
||||
- `Samples~/QuickStart`
|
||||
|
||||
This sample uses an IMGUI test panel for end-to-end SDK flow verification.
|
||||
|
||||
When preparing a publish branch, place the package-ready runtime, samples, and docs into this package directory and tag that branch for external consumption.
|
||||
@@ -1,5 +0,0 @@
|
||||
public sealed class BriskSpaceLikeResult
|
||||
{
|
||||
public bool Liked;
|
||||
public long LikeCount;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
# Changelog
|
||||
|
||||
## 0.4.0
|
||||
|
||||
- Added daily-cycle space like fields and result semantics to the Unity SDK models
|
||||
- Added current-cycle filtering support for space like list APIs
|
||||
- Updated the quick start sample to display total likes, today likes, like reset time, and current-cycle like actions
|
||||
- Changed `GetMyVisitsAsync()` default page size to `50` while preserving the optional `limit` parameter
|
||||
- Refreshed package and integration documentation to match the latest production API behavior
|
||||
|
||||
## 0.3.0
|
||||
|
||||
- Renamed the UPM package identifier to `com.foldcc.cc-framework.brisk-game-server`
|
||||
- Renamed the publish directory to the all-lowercase package path
|
||||
- Updated sync tooling and integration documentation for Git-based package import
|
||||
|
||||
## 0.2.0
|
||||
|
||||
- Refined archive APIs with direct text and JSON upload/download helpers
|
||||
- Refactored player space to the latest metadata plus binary content architecture
|
||||
- Added space content download/update result models and like list models
|
||||
- Updated quick start sample to use the latest archive and space flows
|
||||
- Updated package and integration docs to match the current API surface
|
||||
|
||||
## 0.1.0
|
||||
|
||||
- Initial embedded package structure
|
||||
- Added Brisk runtime facade and service modules
|
||||
- Added default error presenter
|
||||
- Added quick start sample script and sample scene
|
||||
@@ -64,6 +64,12 @@ await Brisk.Space.UpdateMyAsync(new
|
||||
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:
|
||||
@@ -72,6 +78,11 @@ Notes:
|
||||
- `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` / `BriskSpaceStats` include both `LikeCount` and `TodayLikeCount`
|
||||
- `BriskSpaceView` also includes `LikedByMe` and `LikeResetAt`
|
||||
- `GetLikesByPlayerIdAsync(..., currentCycleOnly: true)` returns current-cycle likes only
|
||||
- `GetMyVisitsAsync()` now defaults to the latest `50` visits, with `100` as the server-side max
|
||||
|
||||
## Sample
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
# FoldCC Brisk Game Server SDK
|
||||
|
||||
Brisk Unity SDK 的 UPM 发布目录。
|
||||
|
||||
当前仓库地址:
|
||||
|
||||
- `http://private.lightyears.ltd:18650/foldcc/CC-Framework.BriskGameServer`
|
||||
|
||||
当前包名:
|
||||
|
||||
- `com.foldcc.cc-framework.brisk-game-server`
|
||||
|
||||
## 如何引入到项目
|
||||
|
||||
推荐通过 Unity Package Manager 的 Git URL 方式引入。
|
||||
|
||||
### 方式一:Package Manager
|
||||
|
||||
1. 打开 `Window > Package Manager`
|
||||
2. 点击左上角 `+`
|
||||
3. 选择 `Add package from git URL...`
|
||||
4. 输入:
|
||||
|
||||
```text
|
||||
http://private.lightyears.ltd:18650/foldcc/CC-Framework.BriskGameServer.git?path=/PackageSource/com.foldcc.cc-framework.brisk-game-server#v0.4.0
|
||||
```
|
||||
|
||||
### 方式二:修改 `Packages/manifest.json`
|
||||
|
||||
```json
|
||||
{
|
||||
"dependencies": {
|
||||
"com.foldcc.cc-framework.brisk-game-server": "http://private.lightyears.ltd:18650/foldcc/CC-Framework.BriskGameServer.git?path=/PackageSource/com.foldcc.cc-framework.brisk-game-server#v0.4.0"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
如果需要跟随主分支最新代码,可将末尾的 `#v0.4.0` 改成 `#main`;正式环境建议固定到发布 tag。
|
||||
|
||||
## 开发态源码位置
|
||||
|
||||
开发工程中的活代码位于:
|
||||
|
||||
- `Assets/BriskSdk/Runtime`
|
||||
- `Assets/BriskSdk/Samples/QuickStart`
|
||||
- `Assets/Scenes/BriskQuickStartScene.unity`
|
||||
|
||||
同步 package 内容时执行:
|
||||
|
||||
```powershell
|
||||
./Tools/Sync-BriskPackage.ps1
|
||||
```
|
||||
|
||||
## 已包含模块
|
||||
|
||||
- Bootstrap 与初始化
|
||||
- Auth 与会话恢复
|
||||
- 玩家信息
|
||||
- 动态配置
|
||||
- 公告
|
||||
- 排行榜
|
||||
- 云存档上传下载
|
||||
- 玩家空间
|
||||
- 默认阻断式错误 UI
|
||||
|
||||
## Archive checksum
|
||||
|
||||
云存档上传时,SDK 默认自动处理 checksum。
|
||||
|
||||
- `UploadAsync(slotNo, bytes)` 用于二进制
|
||||
- `UploadTextAsync(slotNo, text)` 用于 UTF-8 文本
|
||||
- `UploadJsonAsync(slotNo, payload)` 用于 JSON 对象
|
||||
- `DownloadAsync(slotNo)` 返回原始 bytes 和元信息
|
||||
- `DownloadTextAsync(slotNo)` 返回 UTF-8 文本
|
||||
- `DownloadJsonAsync(slotNo)` 返回 JSON 结果
|
||||
- SDK 会自动计算 SHA256
|
||||
- 当前 Brisk archive API 要求纯小写 SHA256 十六进制字符串
|
||||
- 不要传 `sha256:` 前缀
|
||||
- 若手动传入带前缀的 checksum,SDK 会自动归一化
|
||||
|
||||
## Space content
|
||||
|
||||
玩家空间当前采用 metadata + binary content 模型。
|
||||
|
||||
- `GetByPlayerIdAsync(...)` 和 `GetByLoginIdentityAsync(...)` 返回元数据
|
||||
- `DownloadContentByPlayerIdAsync(...)` 和 `DownloadContentByLoginIdentityAsync(...)` 返回原始 bytes
|
||||
- `UpdateMyAsync(string)` 直接上传文本
|
||||
- `UpdateMyAsync(byte[])` 直接上传二进制
|
||||
- `UpdateMyAsync(object)` 自动序列化为 JSON
|
||||
- `LikeByPlayerIdAsync(...)` / `UnlikeByPlayerIdAsync(...)` 返回累计点赞数、今日点赞数、当前周期是否创建新点赞、重置时间
|
||||
- `GetLikesByPlayerIdAsync(playerId, limit, true)` 和 `GetLikesByLoginIdentityAsync(..., true)` 可只读取当前周期点赞记录
|
||||
- `GetMyVisitsAsync()` 默认读取最近 `50` 条访问记录,也可手动传入 `limit`
|
||||
|
||||
## 目录结构
|
||||
|
||||
- `Runtime`
|
||||
- `Samples~`
|
||||
- `Documentation~`
|
||||
|
||||
## 快速开始
|
||||
|
||||
查看:
|
||||
|
||||
- `Documentation~/QuickStart.md`
|
||||
- `Samples~/QuickStart`
|
||||
@@ -249,8 +249,10 @@ internal static class BriskModelMapper
|
||||
ContentSizeBytes = BriskValueReader.GetLong(data, "content_size_bytes"),
|
||||
ContentChecksum = BriskValueReader.GetString(data, "content_checksum"),
|
||||
LikeCount = BriskValueReader.GetLong(data, "like_count"),
|
||||
TodayLikeCount = BriskValueReader.GetLong(data, "today_like_count"),
|
||||
VisitCount = BriskValueReader.GetLong(data, "visit_count"),
|
||||
LikedByMe = BriskValueReader.GetBool(data, "liked_by_me"),
|
||||
LikeResetAt = BriskValueReader.GetString(data, "like_reset_at"),
|
||||
UpdatedAt = BriskValueReader.GetString(data, "updated_at")
|
||||
};
|
||||
}
|
||||
@@ -276,7 +278,9 @@ internal static class BriskModelMapper
|
||||
ContentSizeBytes = BriskValueReader.GetLong(data, "content_size_bytes"),
|
||||
ContentChecksum = BriskValueReader.GetString(data, "content_checksum"),
|
||||
LikeCount = BriskValueReader.GetLong(data, "like_count"),
|
||||
TodayLikeCount = BriskValueReader.GetLong(data, "today_like_count"),
|
||||
VisitCount = BriskValueReader.GetLong(data, "visit_count"),
|
||||
LikeResetAt = BriskValueReader.GetString(data, "like_reset_at"),
|
||||
UpdatedAt = BriskValueReader.GetString(data, "updated_at")
|
||||
};
|
||||
}
|
||||
@@ -309,7 +313,11 @@ internal static class BriskModelMapper
|
||||
return new BriskSpaceLikeResult
|
||||
{
|
||||
Liked = BriskValueReader.GetBool(data, "liked"),
|
||||
LikeCount = BriskValueReader.GetLong(data, "like_count")
|
||||
Created = BriskValueReader.GetBool(data, "created"),
|
||||
LikedByMe = BriskValueReader.GetBool(data, "liked_by_me"),
|
||||
LikeCount = BriskValueReader.GetLong(data, "like_count"),
|
||||
TodayLikeCount = BriskValueReader.GetLong(data, "today_like_count"),
|
||||
LikeResetAt = BriskValueReader.GetString(data, "like_reset_at")
|
||||
};
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user