public void Set(SteamAPICall_t 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)
            {
                m_Func = func;
            }

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

            if (m_hAPICall != SteamAPICall_t.Invalid)
            {
                NativeMethods.SteamAPI_UnregisterCallResult(m_pCCallbackBase.AddrOfPinnedObject(), (ulong)m_hAPICall);
            }

            m_hAPICall = hAPICall;

            if (hAPICall != SteamAPICall_t.Invalid)
            {
                NativeMethods.SteamAPI_RegisterCallResult(m_pCCallbackBase.AddrOfPinnedObject(), (ulong)hAPICall);
            }
        }
Beispiel #2
0
 public CallResult(APIDispatchDelegate myFunc)
     : this()
 {
     if (myFunc != null)
     {
         m_Func = myFunc;
     }
 }
Beispiel #3
0
 public CallResult(APIDispatchDelegate <T> func = null)
 {
     this.m_pVTable  = IntPtr.Zero;
     this.m_hAPICall = SteamAPICall_t.Invalid;
     this.m_size     = Marshal.SizeOf(typeof(T));
     this.m_Func     = func;
     this.BuildCCallbackBase();
 }
Beispiel #4
0
        public void Create(bool inviteOnly, APIDispatchDelegate <LobbyCreated_t> callResult)
        {
            //IL_000c: Unknown result type (might be due to invalid IL or missing references)
            //IL_0011: Unknown result type (might be due to invalid IL or missing references)
            //IL_001f: Unknown result type (might be due to invalid IL or missing references)
            SteamAPICall_t val = SteamMatchmaking.CreateLobby((ELobbyType)((!inviteOnly) ? 1 : 0), 256);

            _lobbyCreatedExternalCallback = callResult;
            _lobbyCreated.Set(val, (APIDispatchDelegate <LobbyCreated_t>)null);
            State = LobbyState.Creating;
        }
Beispiel #5
0
 public void Join(CSteamID lobbyId, APIDispatchDelegate <LobbyEnter_t> callResult)
 {
     //IL_0017: Unknown result type (might be due to invalid IL or missing references)
     //IL_0018: Unknown result type (might be due to invalid IL or missing references)
     //IL_001d: Unknown result type (might be due to invalid IL or missing references)
     //IL_0024: Unknown result type (might be due to invalid IL or missing references)
     if (State == LobbyState.Inactive)
     {
         State = LobbyState.Connecting;
         _lobbyEnterExternalCallback = callResult;
         SteamAPICall_t val = SteamMatchmaking.JoinLobby(lobbyId);
         _lobbyEnter.Set(val, (APIDispatchDelegate <LobbyEnter_t>)null);
     }
 }
Beispiel #6
0
 public void Set(SteamAPICall_t hAPICall, APIDispatchDelegate <T> func = null)
 {
     if (func != null)
     {
         this.m_Func = func;
     }
     if (this.m_Func == null)
     {
         throw new Exception("CallResult function was null, you must either set it in the CallResult Constructor or in Set()");
     }
     if (this.m_hAPICall != SteamAPICall_t.Invalid)
     {
         NativeMethods.SteamAPI_UnregisterCallResult(this.m_pCCallbackBase.AddrOfPinnedObject(), (ulong)this.m_hAPICall);
     }
     this.m_hAPICall = hAPICall;
     if (hAPICall != SteamAPICall_t.Invalid)
     {
         NativeMethods.SteamAPI_RegisterCallResult(this.m_pCCallbackBase.AddrOfPinnedObject(), (ulong)hAPICall);
     }
 }
Beispiel #7
0
 internal CallResult(ulong Handle, APIDispatchDelegate Callback)
 {
     VTable = new CallbackBaseVTable
     {
         RunCallback     = OnRunCallback,
         RunCallResult   = OnRunCallResult,
         GetCallbackSize = OnGetCallbackSize
     };
     VTablePointer = AllocHGlobal(SizeOf(typeof(CallbackBaseVTable)));
     StructureToPtr(VTable, VTablePointer, false);
     CallbackBase = new CallbackBase
     {
         VTablePointer = VTablePointer,
         CallbackFlags = 0,
         Callback      = GetCallbackIdentity(typeof(T))
     };
     CallbackBasePointer = Alloc(CallbackBase, GCHandleType.Pinned);
     this.Callback       = Callback;
     if ((this.Handle = Handle) != 0UL)
     {
         RegisterCallResult(CallbackBasePointer.AddrOfPinnedObject(), Handle);
     }
 }
Beispiel #8
0
        public void Set(SteamAPICall_t hAPICall, APIDispatchDelegate newFunc = null)
        {
            if (newFunc != null)
            {
                m_Func = newFunc;
            }

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

            if (m_hAPICall != SteamAPICall_t.Invalid)
            {
                Cancel();
            }

            m_hAPICall = hAPICall;

            if (hAPICall != SteamAPICall_t.Invalid)
            {
                CallbackDispatcher.RegisterCallResult(this, hAPICall);
            }
        }
 public APICallCallback(APIDispatchDelegate myFunc, int iCallback)
     : this( iCallback )
 {
     this.OnRun += myFunc;
 }
 public CallResult(APIDispatchDelegate func = null)
 {
     m_Func = func;
     BuildCCallbackBase();
 }
 /// <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)
 {
     return(new CallResult <T>(func));
 }
Beispiel #12
0
 public void Set(SteamAPICall_t hAPICall, APIDispatchDelegate func = null)
 {
 }
Beispiel #13
0
 // Methods
 public static CallResult <T> Create(APIDispatchDelegate func = null) => default;
Beispiel #14
0
        }                              // Dummy constructor

        public CallResult(APIDispatchDelegate func = null)
        {
        }
Beispiel #15
0
 public CallResult(APIDispatchDelegate myFunc, SteamAPICall_t hAPICall)
     : this(myFunc) {
     Set(hAPICall);
 }
Beispiel #16
0
 public APICallCallback(APIDispatchDelegate myFunc, UInt64 apicallhandle)
     : this( myFunc )
 {
     SetAPICallHandle(apicallhandle);
 }
Beispiel #17
0
 public APICallCallback(APIDispatchDelegate myFunc)
     : this()
 {
     this.OnRun += myFunc;
 }
Beispiel #18
0
 public static CallResult <T> Create(APIDispatchDelegate <T> func = null) =>
 new CallResult <T>(func);