Beispiel #1
0
        public void Set(SteamAPICall hApiCall, ApiDispatchDelegate func = null)
        {
            // Unlike the official SDK we let the user assign a single function during creation,
            // and allow them to skip having to do so every time that they call .Set()
            if (func != null)
            {
                Func = func;
            }

            if (Func == null)
            {
                throw new Exception("CallResult function was null, you must either set it in the CallResult Constructor or in Set()");
            }

            if (_hApiCall != SteamAPICall.Invalid)
            {
                NativeMethods.SteamAPI_UnregisterCallResult(_pCCallbackBase.AddrOfPinnedObject(), (ulong)_hApiCall);
            }

            _hApiCall = hApiCall;

            if (hApiCall != SteamAPICall.Invalid)
            {
                NativeMethods.SteamAPI_RegisterCallResult(_pCCallbackBase.AddrOfPinnedObject(), (ulong)hApiCall);
            }
        }
Beispiel #2
0
 public CallResult(ApiDispatchDelegate func = null)
 {
     Func = func;
     BuildCCallbackBase();
 }
Beispiel #3
0
 /// <summary>
 /// Creates a new async CallResult. You must be calling SteamAPI.RunCallbacks() to retrieve the callback.
 /// <para>Returns a handle to the CallResult. This must be assigned to a member variable to prevent the GC from cleaning it up.</para>
 /// </summary>
 public static CallResult <T> Create(ApiDispatchDelegate func = null) => new CallResult <T>(func);