public Callback(DispatchDelegate <T> func, bool bGameServer = false) { this.m_pVTable = IntPtr.Zero; this.m_size = Marshal.SizeOf(typeof(T)); this.m_bGameServer = bGameServer; this.BuildCCallbackBase(); this.Register(func); }
public Callback(DispatchDelegate myFunc) : this() { if (myFunc == null) { throw new Exception("Function must not be null."); } this.m_Func += myFunc; }
/// <summary> /// Initializes a new instance of <see cref="Store{TState}"/> class. /// </summary> /// <param name="reducer"> /// A reducing object that returns the next state tree. /// </param> /// <param name="initialState"> /// The initial state. /// </param> /// <param name="middlewares"> /// Functions that conform to the Redux middleware API. /// </param> public Store(IReducer <TState> reducer, TState initialState = default(TState), params MiddlewareDelegate <TState>[] middlewares) { _reducer = reducer ?? throw new ArgumentNullException(nameof(reducer)); _dispatch = ApplyMiddlewares(middlewares); if (initialState != null) { State = initialState; } else { _dispatch(new ReduxInitialAction()); } }
/// <summary> /// Invokes the action from the bottom of the document dependency chain up /// to the top, for each provider under it in the chain. /// </summary> /// <remarks> /// OrderByLeastDependent is implement in the ChainOfDependency /// (not a GoF pattern), it walks the tree of dependencies in this case the /// least dependent would be first. The Chain of Responsiblity pattern is /// invoke by the inherited member 'Dispatch' which is called for each /// dependency. /// </remarks> /// <param name="action">The action to perform.</param> /// <param name="document">The document to perform it on.</param> private bool OrderByLeastDependent(DispatchDelegate action, Document document) { return(ChainOfDependencies <Document> .OrderByLeastDependent( document, delegate(Document member) { return this.Dispatch(delegate( IDocumentController controller, Document subject) { return action(controller, subject); }, member); })); }
public void Register(DispatchDelegate <T> func) { if (func == null) { throw new Exception("Callback function must not be null."); } if ((this.m_CCallbackBase.m_nCallbackFlags & 1) == 1) { this.Unregister(); } if (this.m_bGameServer) { this.SetGameserverFlag(); } this.m_Func = func; NativeMethods.SteamAPI_RegisterCallback(this.m_pCCallbackBase.AddrOfPinnedObject(), CallbackIdentities.GetCallbackIdentity(typeof(T))); }
// Manual registration of the callback public void Register(DispatchDelegate func) { if (func == null) { throw new Exception("Callback function must not be null."); } if ((m_CCallbackBase.m_nCallbackFlags & CCallbackBase.k_ECallbackFlagsRegistered) == CCallbackBase.k_ECallbackFlagsRegistered) { Unregister(); } if (m_bGameServer) { SetGameserverFlag(); } m_Func = func; // k_ECallbackFlagsRegistered is set by SteamAPI_RegisterCallback. NativeMethods.SteamAPI_RegisterCallback(m_pCCallbackBase.AddrOfPinnedObject(), CallbackIdentities.GetCallbackIdentity(typeof(T))); }
public Callback(DispatchDelegate func, bool bGameServer = false, bool bKeepAlive = true) { m_bGameServer = bGameServer; BuildCCallbackBase(); Register(func); // This is a temporary hack to preserve backwards compatability with the old CallbackDispatcher. // If this is still here in 5.0.0 yell at me. if (bKeepAlive) { if (!bWarnedOnce) { bWarnedOnce = true; const string deprecatedMsg = "Please use the new (as of 3.0.0) api for creating Callbacks. Callback<Type>.Create(func). You must now maintain a handle to the callback so that the GC does not clean it up prematurely."; #if UNITY_BUILD UnityEngine.Debug.LogWarning(deprecatedMsg); #else throw new System.InvalidOperationException(deprecatedMsg); #endif } GCKeepAlive.Add(this); } }
public void Register(DispatchDelegate func) { }
public static Callback <T> CreateGameServer(DispatchDelegate func) => default;
} // Dummy constructor public Callback(DispatchDelegate func, bool bGameServer = false /* Metadata: 0x00650B29 */) { }
public static Callback <T> Create(DispatchDelegate func) { return(new Callback <T>(func, false)); }
/// <summary> /// Creates a new GameServer Callback. You must be calling GameServer.RunCallbacks() to retrieve the callbacks. /// <para>Returns a handle to the Callback. This must be assigned to a member variable to prevent the GC from cleaning it up.</para> /// </summary> public static Callback <T> CreateGameServer(DispatchDelegate func) { return(new Callback <T>(func, bGameServer: true)); }
public DummyMiddleware(IStore <TState> store, DispatchDelegate next) { _store = store; _next = next; }
public static Callback <T> Create(DispatchDelegate <T> func) => new Callback <T>(func, false);
/// <summary> /// Creates a new Callback. You must be calling SteamAPI.RunCallbacks() to retrieve the callbacks. /// <para>Returns a handle to the Callback. This must be assigned to a member variable to prevent the GC from cleaning it up.</para> /// </summary> public static Callback <T> Create(DispatchDelegate func) => new Callback <T>(func);
public static extern void AsyncFunction(IntPtr queue, IntPtr context, DispatchDelegate work);
public static Callback <T> Create(DispatchDelegate func) { return(new Callback <T>(func, bGameServer: false, bKeepAlive: false)); }
public Callback(DispatchDelegate myFunc) : this() { }
public LoggerMiddleware(IStore <TState> store, DispatchDelegate next, LoggerOptions options) { _store = store; _next = next; _options = options; }
public Callback(DispatchDelegate myFunc, int iCallback) : this( iCallback ) { this.OnRun += myFunc; }
public static Callback <T> CreateGameServer(DispatchDelegate <T> func) => new Callback <T>(func, true);
public Callback(DispatchDelegate myFunc) : this() { this.OnRun += myFunc; }
/// <summary> /// 将一个方法延迟到主线程中运行 /// </summary> /// <param name="function"></param> /// <param name="param"></param> public void Dispatch(DispatchDelegate function, object param = null) { dispathMessageQueue.Enqueue(new DispatchMessage(function, param)); }
public DispatchMessage(DispatchDelegate f, object p) { function = f; param = p; }
public Callback(DispatchDelegate func, bool bGameServer = false) { m_bGameServer = bGameServer; BuildCCallbackBase(); Register(func); }
protected override Task <DataWithStateCode> ProcessHandler(TRequest header, RequestContext <TRequest> context, CancellationToken token) { _cacheDispatcher = _cacheDispatcher ?? GenerateMethod(ExecutionSide); return(_cacheDispatcher(this, header, context, token)); }