Exemplo n.º 1
0
 /// <summary>Register service method with a service binder with or without implementation. Useful when customizing the  service binding logic.
 /// Note: this method is part of an experimental API that can change or be removed without any prior notice.</summary>
 /// <param name="serviceBinder">Service methods will be bound by calling <c>AddMethod</c> on this object.</param>
 /// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
 public static void BindService(grpc::ServiceBinderBase serviceBinder, MatchMakerBase serviceImpl)
 {
     serviceBinder.AddMethod(__Method_CreateGame, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::GameCreationRequest, global::GameCreationResult>(serviceImpl.CreateGame));
     serviceBinder.AddMethod(__Method_GetActiveGames, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::GetActiveGamesRequest, global::GameList>(serviceImpl.GetActiveGames));
     serviceBinder.AddMethod(__Method_ConnectToGame, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::GameConnectionRequest, global::GameConnectionResult>(serviceImpl.ConnectToGame));
     serviceBinder.AddMethod(__Method_DisconnectFromGame, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::GameDisconnectionRequest, global::GameDisconnectionResult>(serviceImpl.DisconnectFromGame));
 }
Exemplo n.º 2
0
 /// <summary>Creates service definition that can be registered with a server</summary>
 /// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
 public static grpc::ServerServiceDefinition BindService(MatchMakerBase serviceImpl)
 {
     return(grpc::ServerServiceDefinition.CreateBuilder()
            .AddMethod(__Method_CreateGame, serviceImpl.CreateGame)
            .AddMethod(__Method_GetActiveGames, serviceImpl.GetActiveGames)
            .AddMethod(__Method_ConnectToGame, serviceImpl.ConnectToGame)
            .AddMethod(__Method_DisconnectFromGame, serviceImpl.DisconnectFromGame).Build());
 }