(client) chore:Clean code

This commit is contained in:
2025-08-28 16:20:24 +08:00
parent 909e995e15
commit c3bff1cf88
76 changed files with 5689 additions and 445 deletions

View File

@ -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()