/// <summary>
        /// Async Find
        /// </summary>
        /// <param name="search">LobbySearch</param>
        /// <param name="localUserId">Login user id</param>
        /// <returns>Task</returns>
        public static async UniTask <LobbySearchFindCallbackInfo> Find(this LobbySearch search, ProductUserId localUserId)
        {
            var op = new LobbySearchFindOptions
            {
                LocalUserId = localUserId
            };
            LobbySearchFindCallbackInfo info = null;

            search.Find(op, null, e =>
            {
                info = e;
            });

            while (info == null || info.ResultCode == Result.OperationWillRetry)
            {
                if (info != null)
                {
                    Debug.LogError($"error {DebugTools.GetClassMethodName()}:{info.ResultCode}");
                    info = null;
                }
                await UniTask.NextFrame();
            }

            if (info.ResultCode == Result.Success)
            {
                return(info);
            }
            Debug.LogError($"error {DebugTools.GetClassMethodName()}:{info.ResultCode}");
            return(null);
        }
 public void Set(LobbySearchFindOptions other)
 {
     if (other != null)
     {
         m_ApiVersion = LobbySearch.LobbysearchFindApiLatest;
         LocalUserId  = other.LocalUserId;
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Find lobbies matching the search criteria setup via this lobby search handle.
        /// When the operation completes, this handle will have the search results that can be parsed
        /// </summary>
        /// <param name="options">Structure containing information about the search criteria to use</param>
        /// <param name="clientData">Arbitrary data that is passed back to you in the CompletionDelegate</param>
        /// <param name="completionDelegate">A callback that is fired when the search operation completes, either successfully or in error</param>
        /// <returns>
        /// <see cref="Result.Success" /> if the find operation completes successfully
        /// <see cref="Result.NotFound" /> if searching for an individual lobby by lobby ID or target user ID returns no results
        /// <see cref="Result.InvalidParameters" /> if any of the options are incorrect
        /// </returns>
        public void Find(LobbySearchFindOptions options, object clientData, LobbySearchOnFindCallback completionDelegate)
        {
            System.IntPtr optionsAddress = new System.IntPtr();
            Helper.TryMarshalSet <LobbySearchFindOptionsInternal, LobbySearchFindOptions>(ref optionsAddress, options);

            var clientDataAddress = System.IntPtr.Zero;

            var completionDelegateInternal = new LobbySearchOnFindCallbackInternal(OnFindCallbackInternalImplementation);

            Helper.AddCallback(ref clientDataAddress, clientData, completionDelegate, completionDelegateInternal);

            EOS_LobbySearch_Find(InnerHandle, optionsAddress, clientDataAddress, completionDelegateInternal);

            Helper.TryMarshalDispose(ref optionsAddress);
        }