You've already forked CC-Framework.BriskGameServer
Update Unity SDK for daily space like API
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user