/// <summary>
        /// Async CreateLobby
        /// </summary>
        /// <param name="lobby">LobbyInterface</param>
        /// <param name="localUserId">Login user id</param>
        /// <param name="maxLobbyMembers">Max member count</param>
        /// <param name="permissionLevel">Public settings, etc.</param>
        /// <returns>Task</returns>
        public static async UniTask <CreateLobbyCallbackInfo> CreateLobby(this LobbyInterface lobby, ProductUserId localUserId, uint maxLobbyMembers, LobbyPermissionLevel permissionLevel)
        {
            var lobbyOp = new CreateLobbyOptions
            {
                LocalUserId     = localUserId,
                MaxLobbyMembers = maxLobbyMembers,
                PermissionLevel = permissionLevel,
            };
            CreateLobbyCallbackInfo info = null;

            lobby.CreateLobby(lobbyOp, null, e =>
            {
                info = e;
            });
            while (info == null)
            {
                await UniTask.NextFrame();
            }

            if (info.ResultCode == Result.Success)
            {
                return(info);
            }
            Debug.LogError($"error {DebugTools.GetClassMethodName()}:{info.ResultCode}");
            return(null);
        }
示例#2
0
 public void Set(CreateLobbyOptions other)
 {
     if (other != null)
     {
         m_ApiVersion    = LobbyInterface.CreatelobbyApiLatest;
         LocalUserId     = other.LocalUserId;
         MaxLobbyMembers = other.MaxLobbyMembers;
         PermissionLevel = other.PermissionLevel;
         PresenceEnabled = other.PresenceEnabled;
     }
 }