(client) chore:Clean code
This commit is contained in:
@ -1,8 +1,9 @@
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Grpc.Net.Client;
|
||||
using Grpc.Net.Client.Web;
|
||||
using Protocol;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using Utils;
|
||||
|
||||
namespace Network
|
||||
@ -18,21 +19,17 @@ namespace Network
|
||||
|
||||
public GrpcClient()
|
||||
{
|
||||
var httpHandler = new GrpcWebHandler(GrpcWebMode.GrpcWeb, new HttpClientHandler());
|
||||
var channelOptions = new GrpcChannelOptions
|
||||
{
|
||||
HttpHandler = httpHandler
|
||||
HttpHandler = new GrpcWebHandler(GrpcWebMode.GrpcWeb, new HttpClientHandler())
|
||||
};
|
||||
|
||||
_channel = GrpcChannel.ForAddress(ServerAddress, channelOptions);
|
||||
|
||||
_general = new GeneralService.GeneralServiceClient(_channel);
|
||||
_game = new GameService.GameServiceClient(_channel);
|
||||
}
|
||||
|
||||
~GrpcClient()
|
||||
{
|
||||
_channel.ShutdownAsync().Wait();
|
||||
Application.quitting += () => _channel.ShutdownAsync().Wait();
|
||||
}
|
||||
|
||||
public async Task<ServerInfo> GetServerInfo()
|
||||
|
Reference in New Issue
Block a user