From 1fa6839e99c3fa65ce89fd2ac1d10eea4b753053 Mon Sep 17 00:00:00 2001 From: sigureling <1678348940@qq.com> Date: Mon, 15 Apr 2024 01:10:55 +0800 Subject: [PATCH] style: :art: style format --- logic/Server/RpcServices.cs | 70 ++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 40 deletions(-) diff --git a/logic/Server/RpcServices.cs b/logic/Server/RpcServices.cs index ab8e4700..7edde2a2 100755 --- a/logic/Server/RpcServices.cs +++ b/logic/Server/RpcServices.cs @@ -13,14 +13,11 @@ partial class GameServer : ServerBase protected bool isSpectatorJoin = false; protected bool IsSpectatorJoin { - get - { - lock (spectatorLock) - return isSpectatorJoin; + get { + lock (spectatorLock) return isSpectatorJoin; } - set - { + set { lock (spectatorLock) isSpectatorJoin = value; } @@ -29,7 +26,7 @@ public override Task TryConnection(IDMsg request, ServerCallContext con { #if DEBUG Console.WriteLine($"TRY TryConnection: Player {request.PlayerId} from Team {request.TeamId}"); -#endif +#endif var onConnection = new BoolRes(); lock (gameLock) { @@ -43,11 +40,11 @@ public override Task TryConnection(IDMsg request, ServerCallContext con onConnection.ActSuccess = false; #if DEBUG Console.WriteLine("END TryConnection"); -#endif +#endif return Task.FromResult(onConnection); } - #region 游戏开局调用一次的服务 +#region 游戏开局调用一次的服务 protected readonly object addPlayerLock = new(); public override async Task AddPlayer(PlayerMsg request, IServerStreamWriter responseStream, ServerCallContext context) @@ -61,7 +58,7 @@ public override async Task AddPlayer(PlayerMsg request, IServerStreamWriter GetMap(NullRequest request, ServerCallContext return Task.FromResult(MapMsg()); } - #endregion +#endregion - #region 游戏过程中玩家执行操作的服务 +#region 游戏过程中玩家执行操作的服务 - #region 船 +#region 船 /*public override Task Activate(ActivateMsg request, ServerCallContext context) { @@ -275,7 +273,8 @@ public override Task Move(MoveMsg request, ServerCallContext context) } // var gameID = communicationToGameID[request.TeamId][request.PlayerId]; moveRes.ActSuccess = game.MoveShip(request.TeamId, request.PlayerId, (int)request.TimeInMilliseconds, request.Angle); - if (!game.GameMap.Timer.IsGaming) moveRes.ActSuccess = false; + if (!game.GameMap.Timer.IsGaming) + moveRes.ActSuccess = false; #if DEBUG Console.WriteLine($"END Move: {moveRes.ActSuccess}"); #endif @@ -413,8 +412,7 @@ public override Task Send(SendMsg request, ServerCallContext context) boolRes.ActSuccess = false; return Task.FromResult(boolRes); } - MessageOfNews news = new() - { + MessageOfNews news = new() { TextMessage = request.TextMessage, FromId = request.PlayerId, ToId = request.ToPlayerId @@ -442,8 +440,7 @@ public override Task Send(SendMsg request, ServerCallContext context) boolRes.ActSuccess = false; return Task.FromResult(boolRes); } - MessageOfNews news = new() - { + MessageOfNews news = new() { BinaryMessage = request.BinaryMessage, FromId = request.PlayerId, ToId = request.ToPlayerId @@ -470,9 +467,9 @@ public override Task Send(SendMsg request, ServerCallContext context) } } - #endregion +#endregion - #region 大本营 +#region 大本营 public override Task InstallModule(InstallMsg request, ServerCallContext context) { @@ -517,13 +514,9 @@ public override Task BuildShip(BuildShipMsg request, ServerCallContext #if DEBUG Console.WriteLine($"TRY BuildShip: ShipType {request.ShipType} from Team {request.TeamId}"); #endif - BoolRes boolRes = new() - { + BoolRes boolRes = new() { ActSuccess = - game.ActivateShip(request.TeamId, - Transformation.ShipTypeFromProto(request.ShipType), - request.BirthpointIndex) - != GameObj.invalidID + game.ActivateShip(request.TeamId, Transformation.ShipTypeFromProto(request.ShipType), request.BirthpointIndex) != GameObj.invalidID }; #if DEBUG Console.WriteLine("END BuildShip"); @@ -536,11 +529,8 @@ public override Task BuildShipRID(BuildShipMsg request, ServerCall #if DEBUG Console.WriteLine($"TRY BuildShipRID: ShipType {request.ShipType} from Team {request.TeamId}"); #endif - var playerId = game.ActivateShip(request.TeamId, - Transformation.ShipTypeFromProto(request.ShipType), - request.BirthpointIndex); - BuildShipRes buildShipRes = new() - { + var playerId = game.ActivateShip(request.TeamId, Transformation.ShipTypeFromProto(request.ShipType), request.BirthpointIndex); + BuildShipRes buildShipRes = new() { ActSuccess = playerId != GameObj.invalidID, PlayerId = playerId }; @@ -569,8 +559,8 @@ public override Task EndAllAction(IDMsg request, ServerCallContext cont return Task.FromResult(boolRes); } - #endregion +#endregion - #endregion +#endregion } }