你的下一项功能
群组
为所选项目提供带角色的公会、战队和团队。
Unity

可见的结果
超时或冲突后保留原始操作并读取当前状态。切勿自动改用新修订号重试。
此步骤尚无视频。指南和MCP请求已可使用。
群组
准备同一个项目
在仪表盘中选择与游戏配置相同的项目。
群组 →首次请求不需要额外定义。没有对应游戏数据时,空结果也有效。
群组在游戏内创建和管理。
首个示例只读取数据,不创建群组、对局或对象。空列表也是有效的首次响应。
实现此功能
你可以预览指南。运行需要有效的项目密钥。 准备项目
已安装 SDK、导入项目配置,且玩家已登录。
此 SDK 示例使用 develop。请检查已安装的 SDK 是否具备所需 API。
先通过快速入门连接目标玩家,再通过明确的按钮或场景操作调用ReadMyGroups()。仅打开文件不会发送请求。
C#
1using UnityEngine;
2using PM.horizOn.Cloud.Manager;
3
4public sealed class GroupsDemo : MonoBehaviour
5{
6 // Initialize/connect once and restore the existing player in the Quickstart first.
7 // Invoke from a player action; no background refresh or membership mutation.
8 public async void ReadMyGroups()
9 {
10 var user = UserManager.Instance.CurrentUser;
11 if (user == null || !user.IsValid()) return;
12 var result = await GroupsManager.Instance.GetGroups(user.UserId);
13 if (!result.IsSuccess) { Debug.LogWarning(result.ErrorCode); return; }
14 Debug.Log($"Player revision: {result.Data.revision}");
15 foreach (var group in result.Data.groups)
16 Debug.Log($"Group {group.id}: {group.myRole}, revision {group.revision}");
17 // result.Data.limits contains all current limits; existing groups may exceed them.
18 // GetMembers(userId, groupId, afterUserId: null, limit: 1) reads one page.
19 // Keep its revision and nextAfterUserId. A changed revision requires a restart.
20 // Pending createdAt may be absent/null; it does not mean the Unix epoch.
21 }
22}
23// For writes use the SDK GroupsExample and its durable GroupsSampleStore.
24// Preserve the exact project/player, body, expected revision and pending requestId.
25// Unknown create: read/reconcile explicitly; never create with a replacement revision.
测试你的新功能。
超时或冲突后保留原始操作并读取当前状态。切勿自动改用新修订号重试。
在仪表盘中选择与游戏配置相同的项目。
接口
- GET
/groups - GET
/groups/{groupId} - GET
/groups/{groupId}/members - GET
/groups/{groupId}/pending - POST
/groups - PUT
/groups/{groupId} - POST
/groups/{groupId}/join - POST
/groups/{groupId}/request - POST
/groups/{groupId}/invite - POST
/groups/{groupId}/accept-invite - POST
/groups/{groupId}/decline-invite - POST
/groups/{groupId}/cancel-invite - POST
/groups/{groupId}/accept-request - POST
/groups/{groupId}/decline-request - POST
/groups/{groupId}/cancel-request - POST
/groups/{groupId}/leave - POST
/groups/{groupId}/remove - POST
/groups/{groupId}/role - POST
/groups/{groupId}/transfer - POST
/groups/{groupId}/delete


