Пример #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, JinrouBase serviceImpl)
 {
     serviceBinder.AddMethod(__Method_Register, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::Jinrou.RegisterRequest, global::Jinrou.RegisterResponse>(serviceImpl.Register));
     serviceBinder.AddMethod(__Method_Refresh, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::Jinrou.RefreshRequest, global::Jinrou.RefreshResponse>(serviceImpl.Refresh));
     serviceBinder.AddMethod(__Method_CreateGame, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::Jinrou.CreateGameRequest, global::Jinrou.CreateGameResponse>(serviceImpl.CreateGame));
     serviceBinder.AddMethod(__Method_Join, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::Jinrou.JoinRequest, global::Jinrou.JoinResponse>(serviceImpl.Join));
     serviceBinder.AddMethod(__Method_Leave, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::Jinrou.LeaveRequest, global::Jinrou.LeaveResponse>(serviceImpl.Leave));
     serviceBinder.AddMethod(__Method_Vote, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::Jinrou.VoteRequest, global::Jinrou.VoteResponse>(serviceImpl.Vote));
     serviceBinder.AddMethod(__Method_Kill, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::Jinrou.KillRequest, global::Jinrou.KillResponse>(serviceImpl.Kill));
     serviceBinder.AddMethod(__Method_Next, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::Jinrou.NextRequest, global::Jinrou.NextResponse>(serviceImpl.Next));
     serviceBinder.AddMethod(__Method_GetRoles, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::Jinrou.GetRolesRequest, global::Jinrou.GetRolesResponse>(serviceImpl.GetRoles));
     serviceBinder.AddMethod(__Method_ObserveState, serviceImpl == null ? null : new grpc::ServerStreamingServerMethod <global::Jinrou.ObserveStateRequest, global::Jinrou.ObserveStateResponse>(serviceImpl.ObserveState));
     serviceBinder.AddMethod(__Method_UnobserveState, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::Jinrou.UnobserveStateRequest, global::Jinrou.UnobserveStateResponse>(serviceImpl.UnobserveState));
 }
Пример #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(JinrouBase serviceImpl)
 {
     return(grpc::ServerServiceDefinition.CreateBuilder()
            .AddMethod(__Method_Register, serviceImpl.Register)
            .AddMethod(__Method_Refresh, serviceImpl.Refresh)
            .AddMethod(__Method_CreateGame, serviceImpl.CreateGame)
            .AddMethod(__Method_Join, serviceImpl.Join)
            .AddMethod(__Method_Leave, serviceImpl.Leave)
            .AddMethod(__Method_Vote, serviceImpl.Vote)
            .AddMethod(__Method_Kill, serviceImpl.Kill)
            .AddMethod(__Method_Next, serviceImpl.Next)
            .AddMethod(__Method_GetRoles, serviceImpl.GetRoles)
            .AddMethod(__Method_ObserveState, serviceImpl.ObserveState)
            .AddMethod(__Method_UnobserveState, serviceImpl.UnobserveState).Build());
 }