From 2f4d57f8756948aa3cf9028864355de53c656441 Mon Sep 17 00:00:00 2001
From: gsy1519 <614054460@qq.com>
Date: Tue, 8 Nov 2022 14:08:57 +0800
Subject: [PATCH 01/16] chore: start
---
logic/ClientTest/ClientTest.csproj | 20 +++++
logic/ClientTest/Program.cs | 36 +++++++++
logic/Protos/Message2Clients.proto | 125 +++++++++++++++++++++++++++++
logic/Protos/Message2Server.proto | 62 ++++++++++++++
logic/Protos/MessageType.proto | 110 +++++++++++++++++++++++++
logic/Protos/Protos.csproj | 32 ++++++++
logic/Server/Game.cs | 104 ++++++++++++++++++++++++
logic/Server/GameServer.cs | 123 ++++++++++++++++++++++++++++
logic/Server/Program.cs | 37 ++++++++-
logic/Server/Server.csproj | 15 ++++
logic/logic.sln | 12 +++
logic/test.cmd | 7 ++
12 files changed, 681 insertions(+), 2 deletions(-)
create mode 100644 logic/ClientTest/ClientTest.csproj
create mode 100644 logic/ClientTest/Program.cs
create mode 100644 logic/Protos/Message2Clients.proto
create mode 100644 logic/Protos/Message2Server.proto
create mode 100644 logic/Protos/MessageType.proto
create mode 100644 logic/Protos/Protos.csproj
create mode 100644 logic/Server/Game.cs
create mode 100644 logic/Server/GameServer.cs
create mode 100644 logic/test.cmd
diff --git a/logic/ClientTest/ClientTest.csproj b/logic/ClientTest/ClientTest.csproj
new file mode 100644
index 0000000..e9bbb1e
--- /dev/null
+++ b/logic/ClientTest/ClientTest.csproj
@@ -0,0 +1,20 @@
+
+
+
+ Exe
+ net6.0
+ enable
+ enable
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/logic/ClientTest/Program.cs b/logic/ClientTest/Program.cs
new file mode 100644
index 0000000..529dce3
--- /dev/null
+++ b/logic/ClientTest/Program.cs
@@ -0,0 +1,36 @@
+using Grpc.Core;
+using Protobuf;
+
+namespace ClientTest
+{
+ public class Program
+ {
+ public static async Task Main(string[] args)
+ {
+ Channel channel = new Channel("127.0.0.1:8888", ChannelCredentials.Insecure);
+ var client = new AvailableService.AvailableServiceClient(channel);
+ PlayerMsg playerInfo = new();
+ playerInfo.PlayerId = Convert.ToInt32(args[0]);
+ playerInfo.PlayerType = (PlayerType)Convert.ToInt32(args[1]);
+ var call = client.AddPlayer(playerInfo);
+ while (await call.ResponseStream.MoveNext())
+ {
+ var currentGameInfo = call.ResponseStream.Current;
+ if (playerInfo.PlayerType == PlayerType.HumanPlayer)
+ {
+ for (int i = 0; i < currentGameInfo.HumanMessage.Count; i++)
+ {
+ Console.WriteLine($"Human is at ({currentGameInfo.HumanMessage[i].X}, {currentGameInfo.HumanMessage[i].Y})");
+ }
+ }
+ if (playerInfo.PlayerType == PlayerType.ButcherPlayer)
+ {
+ for (int i = 0; i < currentGameInfo.ButcherMessage.Count; i++)
+ {
+ Console.WriteLine($"Butcher is at ({currentGameInfo.ButcherMessage[i].X}, {currentGameInfo.ButcherMessage[i].Y})");
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/logic/Protos/Message2Clients.proto b/logic/Protos/Message2Clients.proto
new file mode 100644
index 0000000..edae464
--- /dev/null
+++ b/logic/Protos/Message2Clients.proto
@@ -0,0 +1,125 @@
+// Message2Client
+syntax = "proto3";
+package protobuf;
+
+import "MessageType.proto";
+import "Message2Server.proto";
+
+message MessageOfHuman
+{
+ int32 x = 1;
+ int32 y = 2;
+ int32 speed = 3;
+ int32 life = 4; // 本次未倒地前的血量,也即还可以受的伤害
+ int32 hanged_time = 5; // 被挂上的次数
+ double time_until_skill_available = 6;
+ PlaceType place = 7;
+ PropType prop = 8;
+ HumanType human_type = 9;
+ int64 guid = 10;
+ bool on_chair = 11; // 是否被挂
+ double chair_time = 12; // 被挂的时间
+ bool on_ground = 13; // 是否倒地
+ double ground_time = 14; // 倒地时间
+ int64 player_id = 15;
+ int32 view_range = 16; // 视野距离
+ repeated HumanBuffType buff = 17;
+}
+
+message MessageOfButcher
+{
+ int32 x = 1;
+ int32 y = 2;
+ int32 speed = 3;
+ int32 damage = 4;
+ double time_until_skill_available = 5;
+ PlaceType place = 6;
+ PropType prop = 7;
+ ButcherType butcher_type = 8;
+ int64 guid = 9;
+ bool movable = 10; // 是否进入了攻击后摇
+ int64 playerID = 11;
+ int32 view_range = 12; // 视野距离
+ repeated ButcherBuffType buff = 13;
+}
+
+message MessageOfProp // 可拾取道具的信息
+{
+ PropType type = 1;
+ int32 x = 2;
+ int32 y = 3;
+ double facing_direction = 4;
+ int64 guid = 5;
+ PlaceType place = 6;
+ int32 size = 7;
+ bool is_moving = 8;
+}
+
+message MessageOfPickedProp //for Unity,直接继承自THUAI5
+{
+ PropType type = 1;
+ int32 x = 2;
+ int32 y = 3;
+ double facing_direction = 4;
+ int64 mapping_id = 5;
+}
+
+message MessageOfMap
+{
+ message Row
+ {
+ repeated PlaceType col = 1;
+ }
+ repeated Row row = 2;
+}
+
+message MessageToClient
+{
+ repeated MessageOfHuman human_message = 1;
+ repeated MessageOfButcher butcher_message = 2; // 是否真正repeated待定
+ repeated MessageOfProp prop_message = 3;
+ MessageOfMap map_massage = 4;
+}
+
+message MoveRes // 如果打算设计撞墙保留平行速度分量,且需要返回值则可用这个(大概没啥用)
+{
+ int64 actual_speed = 1;
+ double actual_angle = 2;
+}
+
+message BoolRes // 用于只需要判断执行操作是否成功的行为,如捡起道具、使用道具
+{
+ bool act_success = 1;
+}
+
+message MsgRes // 用于获取队友发来的消息
+{
+ bool have_message = 1; // 是否有待接收的消息
+ int64 from_player_id = 2;
+ string message_received = 3;
+}
+
+service AvailableService
+{
+ rpc TryConnection(IDMsg) returns(BoolRes);
+
+ // 游戏开局调用一次的服务
+ rpc AddPlayer(PlayerMsg) returns(stream MessageToClient); // 连接上后等待游戏开始,server会定时通过该服务向所有client发送消息。
+
+ // 游戏过程中玩家执行操作的服务
+ rpc Move(MoveMsg) returns (MoveRes);
+ rpc PickProp(PickMsg) returns (BoolRes);
+ rpc UseProp(IDMsg) returns (BoolRes);
+ rpc UseSkill(IDMsg) returns (BoolRes);
+ rpc SendMessage(SendMsg) returns (BoolRes);
+ rpc HaveMessage(IDMsg) returns (BoolRes);
+ rpc GetMessage(IDMsg) returns (MsgRes);
+ rpc FixMachine(stream IDMsg) returns (stream BoolRes); // 若正常修复且未被打断则返回修复成功,位置错误/被打断则返回修复失败,下同
+ rpc SaveHuman(stream IDMsg) returns (stream BoolRes);
+ rpc Attack (AttackMsg) returns (BoolRes);
+ rpc CarryHuman (IDMsg) returns (BoolRes);
+ rpc ReleaseHuman (IDMsg) returns (BoolRes);
+ rpc HangHuman (IDMsg) returns (BoolRes);
+ rpc Escape (IDMsg) returns (BoolRes);
+
+}
\ No newline at end of file
diff --git a/logic/Protos/Message2Server.proto b/logic/Protos/Message2Server.proto
new file mode 100644
index 0000000..b3891b6
--- /dev/null
+++ b/logic/Protos/Message2Server.proto
@@ -0,0 +1,62 @@
+// Message2Server
+syntax = "proto3";
+package protobuf;
+
+import "MessageType.proto";
+
+message PlayerMsg
+{
+ int64 player_id = 1;
+ PlayerType player_type = 2;
+ oneof job_type
+ {
+ HumanType human_type = 3;
+ ButcherType butcher_type = 4;
+ }
+}
+
+message MoveMsg
+{
+ int64 player_id = 1;
+ double angle = 2;
+ int64 time_in_milliseconds = 3;
+}
+
+message PickMsg
+{
+ int64 player_id = 1;
+ PropType prop_type = 2;
+}
+
+message SendMsg
+{
+ int64 player_id = 1;
+ int64 to_player_id = 2;
+ string message = 3;
+}
+
+message AttackMsg
+{
+ int64 player_id = 1;
+ double angle = 2;
+}
+
+message IDMsg
+{
+ int64 player_id = 1;
+}
+
+// 基本继承于THUAI5,为了使发送的信息尽可能不被浪费,暂定不发这类大包。
+// message MessageToServer
+// {
+// MessageType messageType = 1;
+// int64 playerID = 2; // 消息发送者的playerID
+// PlayerType playerType = 3;
+// HumanType humanType= 4;
+// ButcherType butcherType = 5;
+// double angle = 6; // messageType为Move, Attack时的角度
+// PropType propType = 7; // messageType为PickProp时要捡起的道具类型,防止多个道具堆叠时出现问题
+// int64 timeInMilliseconds = 8;//时间参数
+// int64 ToPlayerID = 9; // messageType为Send时要发送的对象的ID
+// string message = 10; // messageType为Send时发送的消息内容
+// }
\ No newline at end of file
diff --git a/logic/Protos/MessageType.proto b/logic/Protos/MessageType.proto
new file mode 100644
index 0000000..2041fe0
--- /dev/null
+++ b/logic/Protos/MessageType.proto
@@ -0,0 +1,110 @@
+// MessageType
+syntax = "proto3";
+package protobuf;
+
+enum PlaceType // 地图中的所有物件类型
+{
+ NULL_PLACE_TYPE = 0;
+
+ // 地图情况,其中Gate是总体的大门,HiddenGate是地窖
+ LAND = 1;
+ WALL = 2;
+ GRASS = 3;
+ MACHINE = 4;
+ GATE = 5;
+ HIDDEN_GATE = 6;
+ // 待补充有特殊效果的地形
+
+}
+
+enum ShapeType // 形状类型
+{
+ NULL_SHAPE_TYPE = 0;
+ CIRCLE = 1; // 人类、屠夫、可拾取道具等为圆形
+ SQUARE = 2; // 地形均为方形
+}
+
+enum PropType // 地图中的可拾取道具类型
+{
+ NULL_PROP_TYPE = 0;
+ PTYPE1 = 1;
+ PTYPE2 = 2;
+ PTYPE3 = 3;
+ PTYPE4 = 4;
+
+}
+
+enum HumanBuffType // 人类可用的增益效果类型
+{
+ NULL_HBUFF_TYPE = 0;
+ HBUFFTYPE1 = 1;
+ HBUFFTYPE2 = 2;
+ HBUFFTYPE3 = 3;
+ HBUFFTYPE4 = 4;
+}
+
+enum ButcherBuffType // 屠夫可用的增益效果类型
+{
+ NULL_BBUFF_TYPE = 0;
+ BBUFFTYPE1 = 1;
+ BBUFFTYPE2 = 2;
+ BBUFFTYPE3 = 3;
+ BBUFFTYPE4 = 4;
+}
+
+// 特别说明:由于Human阵营和Butcher阵营有显著的隔离,且暂定职业、主动技能和被动效果相互绑定,故不按照THUAI5的方式区分ActiveSkillType和PassiveSkillType,而是选择了按照阵营来给不同阵营赋予不同的职业(及技能)。
+
+enum PlayerType
+{
+ NULL_PLAYER_TYPE = 0;
+ HUMAN_PLAYER = 1;
+ BUTCHER_PLAYER = 2;
+}
+
+enum HumanType
+{
+ NULL_HUMAN_TYPE = 0;
+ HUMANTYPE1 = 1;
+ HUMANTYPE2 = 2;
+ HUMANTYPE3 = 3;
+ HUMANTYPE4 = 4;
+}
+
+enum ButcherType
+{
+ NULL_BUTCHER_TYPE = 0;
+ BUTCHERTYPE1 = 1;
+ BUTCHERTYPE2 = 2;
+ BUTCHERTYPE3 = 3;
+ BUTCHERTYPE4 = 4;
+}
+
+// 取消了大包之后,MessageType的枚举是否有必要保留还有待商榷
+// enum MessageType
+// {
+// // 公共信息类型
+// Move = 0;
+// PickProp = 1;
+// UseProp = 2;
+// UseSkill = 3;
+// Map = 4;
+// Send = 5;
+
+// // 人类限定信息类型
+// FixMachine = 6;
+// SaveHuman = 7;
+
+// // 屠夫限定信息类型
+// Attack = 8;
+// CarryHuman = 9;
+// ReleaseHuman = 10;
+// HangHuman = 11;
+
+// // 游戏相关信息类型
+// AddPlayer = 12;
+// InvalidPlayer = 13;
+// ValidPlayer = 14;
+// StartGame = 15;
+// Gaming = 16;
+// EndGame = 17;
+// }
diff --git a/logic/Protos/Protos.csproj b/logic/Protos/Protos.csproj
new file mode 100644
index 0000000..e6fac69
--- /dev/null
+++ b/logic/Protos/Protos.csproj
@@ -0,0 +1,32 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+
+
+
+
diff --git a/logic/Server/Game.cs b/logic/Server/Game.cs
new file mode 100644
index 0000000..96e7680
--- /dev/null
+++ b/logic/Server/Game.cs
@@ -0,0 +1,104 @@
+using Grpc.Core;
+using Protobuf;
+using System.Threading;
+using Timothy.FrameRateTask;
+using System;
+using System.Net.Http.Headers;
+
+namespace Server
+{
+ public class Game
+ {
+ private const int gameTime = 3000;
+ public int GameTime => gameTime;
+
+ private MessageToClient gameInfo = new();
+ private object gameInfoLock = new();
+ private int isGaming = 0;
+ public bool IsGaming
+ {
+ get => Interlocked.CompareExchange(ref isGaming, 0, 0) != 0;
+ set => Interlocked.Exchange(ref isGaming, value ? 1 : 0);
+ }
+
+ public MessageToClient GetCopiedGameInfo()
+ {
+ lock (gameInfoLock)
+ {
+ return gameInfo.Clone();
+ }
+ }
+ public void AddPlayer(PlayerMsg player)
+ {
+ lock (gameInfoLock)
+ {
+ if (player.PlayerType == PlayerType.NullPlayerType) return;
+ if (player.PlayerType == PlayerType.HumanPlayer)
+ {
+ gameInfo.HumanMessage.Add(new MessageOfHuman()
+ {
+ PlayerId = player.PlayerId
+ });
+ return;
+ }
+ if (player.PlayerType == PlayerType.ButcherPlayer)
+ {
+ gameInfo.ButcherMessage.Add(new MessageOfButcher()
+ {
+ PlayerID = player.PlayerId
+ });
+ return;
+ }
+ }
+ }
+
+ public SemaphoreSlim StartGame()
+ {
+ IsGaming = true;
+ var waitHandle = new SemaphoreSlim(0);
+
+ new Thread
+ (
+ () =>
+ {
+ new FrameRateTaskExecutor
+ (
+ () => IsGaming,
+ () =>
+ {
+ lock (gameInfo)
+ {
+ for (int i = 0; i < gameInfo.HumanMessage.Count; i++)
+ {
+ if (gameInfo.HumanMessage[i] != null)
+ {
+ gameInfo.HumanMessage[i].X++;
+ gameInfo.HumanMessage[i].Y--;
+ }
+ }
+ for (int i = 0; i < gameInfo.ButcherMessage.Count; i++)
+ {
+ if (gameInfo.ButcherMessage[i] != null)
+ {
+ gameInfo.ButcherMessage[i].X--;
+ gameInfo.ButcherMessage[i].Y++;
+ }
+ }
+ }
+ },
+ 100,
+ () =>
+ {
+ IsGaming = false;
+ waitHandle.Release();
+ return 0;
+ },
+ gameTime
+ ).Start();
+ }
+ )
+ { IsBackground = true }.Start();
+ return waitHandle;
+ }
+ }
+}
diff --git a/logic/Server/GameServer.cs b/logic/Server/GameServer.cs
new file mode 100644
index 0000000..c31d611
--- /dev/null
+++ b/logic/Server/GameServer.cs
@@ -0,0 +1,123 @@
+using Grpc.Core;
+using Protobuf;
+using System.Threading;
+using Timothy.FrameRateTask;
+using System;
+using System.Net.Http.Headers;
+
+namespace Server
+{
+ public class GameServer : AvailableService.AvailableServiceBase
+ {
+ private Dictionary semaDict = new();
+ private object gameLock = new();
+ private const int playerNum = 2;
+ private MessageToClient currentGameInfo = new();
+ private Game game = new();
+ public int GameTime => game.GameTime;
+ private SemaphoreSlim endGameSem = new(0);
+
+ public override Task TryConnection(IDMsg request, ServerCallContext context)
+ {
+ var onConnection = new BoolRes();
+ lock (gameLock)
+ {
+ if (0 <= request.PlayerId && request.PlayerId < playerNum)
+ {
+ onConnection.ActSuccess = true;
+ return Task.FromResult(onConnection);
+ }
+ }
+ onConnection.ActSuccess = false;
+ return Task.FromResult(onConnection);
+ }
+
+ public override async Task AddPlayer(PlayerMsg request, IServerStreamWriter responseStream, ServerCallContext context)
+ {
+ lock (gameLock)
+ {
+ if (game.IsGaming)
+ return;
+ game.AddPlayer(request);
+ var temp = (new SemaphoreSlim(0, 1), new SemaphoreSlim(0, 1));
+
+ bool start = false;
+ Console.WriteLine($"Id: {request.PlayerId} joins.");
+ lock (semaDict)
+ {
+ semaDict.Add(request.PlayerId, temp);
+ start = semaDict.Count == playerNum;
+ }
+
+ if (start)
+ {
+ Console.WriteLine("Game starts!");
+ StartGame();
+ }
+ }
+
+ do
+ {
+ semaDict[request.PlayerId].Item1.Wait();
+
+ if (currentGameInfo != null)
+ {
+ await responseStream.WriteAsync(currentGameInfo);
+ Console.WriteLine("Send!");
+ }
+ semaDict[request.PlayerId].Item2.Release();
+ } while (game.IsGaming);
+ }
+ public void StartGame()
+ {
+ var waitHandle = game.StartGame();
+ new Thread(() =>
+ {
+ new FrameRateTaskExecutor
+ (
+ () => game.IsGaming,
+ ReportGame,
+ 1000,
+ () =>
+ {
+ ReportGame(); // 最后发一次消息,唤醒发消息的线程,防止发消息的线程由于有概率处在 Wait 状态而卡住
+ return 0;
+ }
+ ).Start();
+ })
+ { IsBackground = true }.Start();
+ new Thread(() =>
+ {
+ waitHandle.Wait();
+ this.endGameSem.Release();
+ })
+ { IsBackground = true }.Start();
+
+
+ }
+ public void WaitForEnd()
+ {
+ this.endGameSem.Wait();
+ }
+
+ public void ReportGame()
+ {
+ currentGameInfo = game.GetCopiedGameInfo();
+
+ foreach (var kvp in semaDict)
+ {
+ kvp.Value.Item1.Release();
+ }
+
+ foreach (var kvp in semaDict)
+ {
+ kvp.Value.Item2.Wait();
+ }
+ }
+
+ public GameServer()
+ {
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/logic/Server/Program.cs b/logic/Server/Program.cs
index 3751555..155a97b 100644
--- a/logic/Server/Program.cs
+++ b/logic/Server/Program.cs
@@ -1,2 +1,35 @@
-// See https://aka.ms/new-console-template for more information
-Console.WriteLine("Hello, World!");
+using Grpc.Core;
+using Protobuf;
+using System.Threading;
+using Timothy.FrameRateTask;
+using System;
+using System.Net.Http.Headers;
+
+namespace Server
+{
+ public class Program
+ {
+ public static void Main()
+ {
+ try
+ {
+ GameServer gameServer = new();
+ Grpc.Core.Server server = new Grpc.Core.Server(new[] { new ChannelOption(ChannelOptions.SoReuseport, 0) })
+ {
+ Services = { AvailableService.BindService(gameServer) },
+ Ports = { new ServerPort("0.0.0.0", 8888, ServerCredentials.Insecure) }
+ };
+ server.Start();
+
+ Console.WriteLine("Server begins to listen!");
+ gameServer.WaitForEnd();
+ Console.WriteLine("Server end!");
+ server.ShutdownAsync().Wait();
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine(ex.ToString());
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/logic/Server/Server.csproj b/logic/Server/Server.csproj
index 74abf5c..b87aa89 100644
--- a/logic/Server/Server.csproj
+++ b/logic/Server/Server.csproj
@@ -7,4 +7,19 @@
enable
+
+
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+
diff --git a/logic/logic.sln b/logic/logic.sln
index 51f61b6..2fc1991 100644
--- a/logic/logic.sln
+++ b/logic/logic.sln
@@ -5,6 +5,10 @@ VisualStudioVersion = 17.0.32014.148
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Server", "Server\Server.csproj", "{D033B809-2FB7-4340-B8B4-DDA30D6CA6FF}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Protos", "Protos\Protos.csproj", "{EA81EE05-A0E3-4D3E-8D7A-C5CD0C9255CD}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClientTest", "ClientTest\ClientTest.csproj", "{F3C98717-DD4F-45B8-B0F0-C217E7E2B5D4}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -15,6 +19,14 @@ Global
{D033B809-2FB7-4340-B8B4-DDA30D6CA6FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D033B809-2FB7-4340-B8B4-DDA30D6CA6FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D033B809-2FB7-4340-B8B4-DDA30D6CA6FF}.Release|Any CPU.Build.0 = Release|Any CPU
+ {EA81EE05-A0E3-4D3E-8D7A-C5CD0C9255CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {EA81EE05-A0E3-4D3E-8D7A-C5CD0C9255CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {EA81EE05-A0E3-4D3E-8D7A-C5CD0C9255CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {EA81EE05-A0E3-4D3E-8D7A-C5CD0C9255CD}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F3C98717-DD4F-45B8-B0F0-C217E7E2B5D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F3C98717-DD4F-45B8-B0F0-C217E7E2B5D4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F3C98717-DD4F-45B8-B0F0-C217E7E2B5D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F3C98717-DD4F-45B8-B0F0-C217E7E2B5D4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/logic/test.cmd b/logic/test.cmd
new file mode 100644
index 0000000..0ea590e
--- /dev/null
+++ b/logic/test.cmd
@@ -0,0 +1,7 @@
+@echo off
+
+start cmd /k .\Server\bin\Debug\net6.0\Server.exe
+
+start cmd /k .\ClientTest\bin\Debug\net6.0\ClientTest.exe 0 1
+
+start cmd /k .\ClientTest\bin\Debug\net6.0\ClientTest.exe 1 2
From d20065bca5922911d0d616589a8714a2bfdf0861 Mon Sep 17 00:00:00 2001
From: gsy1519 <614054460@qq.com>
Date: Tue, 8 Nov 2022 15:24:53 +0800
Subject: [PATCH 02/16] chore: start
---
logic/ClientTest/Program.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/logic/ClientTest/Program.cs b/logic/ClientTest/Program.cs
index 529dce3..cc4c95d 100644
--- a/logic/ClientTest/Program.cs
+++ b/logic/ClientTest/Program.cs
@@ -16,14 +16,14 @@ namespace ClientTest
while (await call.ResponseStream.MoveNext())
{
var currentGameInfo = call.ResponseStream.Current;
- if (playerInfo.PlayerType == PlayerType.HumanPlayer)
+ //if (playerInfo.PlayerType == PlayerType.HumanPlayer)
{
for (int i = 0; i < currentGameInfo.HumanMessage.Count; i++)
{
Console.WriteLine($"Human is at ({currentGameInfo.HumanMessage[i].X}, {currentGameInfo.HumanMessage[i].Y})");
}
}
- if (playerInfo.PlayerType == PlayerType.ButcherPlayer)
+ //if (playerInfo.PlayerType == PlayerType.ButcherPlayer)
{
for (int i = 0; i < currentGameInfo.ButcherMessage.Count; i++)
{
From 84c540f00fbe3e840611d069f5823dc51370156f Mon Sep 17 00:00:00 2001
From: gsy1519 <614054460@qq.com>
Date: Tue, 8 Nov 2022 19:43:42 +0800
Subject: [PATCH 03/16] chore: :sparkles: start server
server
---
logic/ClientTest/Program.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/logic/ClientTest/Program.cs b/logic/ClientTest/Program.cs
index cc4c95d..529dce3 100644
--- a/logic/ClientTest/Program.cs
+++ b/logic/ClientTest/Program.cs
@@ -16,14 +16,14 @@ namespace ClientTest
while (await call.ResponseStream.MoveNext())
{
var currentGameInfo = call.ResponseStream.Current;
- //if (playerInfo.PlayerType == PlayerType.HumanPlayer)
+ if (playerInfo.PlayerType == PlayerType.HumanPlayer)
{
for (int i = 0; i < currentGameInfo.HumanMessage.Count; i++)
{
Console.WriteLine($"Human is at ({currentGameInfo.HumanMessage[i].X}, {currentGameInfo.HumanMessage[i].Y})");
}
}
- //if (playerInfo.PlayerType == PlayerType.ButcherPlayer)
+ if (playerInfo.PlayerType == PlayerType.ButcherPlayer)
{
for (int i = 0; i < currentGameInfo.ButcherMessage.Count; i++)
{
From 0c20f615e91700040c1d1f6baa43955efa3bebc0 Mon Sep 17 00:00:00 2001
From: wihn2021
Date: Thu, 17 Nov 2022 14:23:31 +0800
Subject: [PATCH 04/16] =?UTF-8?q?=F0=9F=8C=88=20style(API.h):=20replace=20?=
=?UTF-8?q?{}=20with=20;?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
CAPI/API/include/API.h | 84 +++++++++++-------------------------------
1 file changed, 21 insertions(+), 63 deletions(-)
diff --git a/CAPI/API/include/API.h b/CAPI/API/include/API.h
index ed0276d..99964e5 100644
--- a/CAPI/API/include/API.h
+++ b/CAPI/API/include/API.h
@@ -179,32 +179,16 @@ public:
{
}
- std::future MoveRight(int64_t timeInMilliseconds) override
- {
- }
- std::future MoveUp(int64_t timeInMilliseconds) override
- {
- }
- std::future MoveLeft(int64_t timeInMilliseconds) override
- {
- }
- std::future MoveDown(int64_t timeInMilliseconds) override
- {
- }
+ std::future MoveRight(int64_t timeInMilliseconds) override;
+ std::future MoveUp(int64_t timeInMilliseconds) override;
+ std::future MoveLeft(int64_t timeInMilliseconds) override;
+ std::future MoveDown(int64_t timeInMilliseconds) override;
- std::future PickProp(THUAI6::PropType prop) override
- {
- }
- std::future UseProp() override
- {
- }
- std::future UseSkill() override
- {
- }
+ std::future PickProp(THUAI6::PropType prop) override;
+ std::future UseProp() override;
+ std::future UseSkill() override;
- std::future SendMessage(int64_t, std::string) override
- {
- }
+ std::future SendMessage(int64_t, std::string) override;
[[nodiscard]] std::future HaveMessage() override
{
}
@@ -216,20 +200,12 @@ public:
{
}
- [[nodiscard]] std::vector> GetHuman() const override
- {
- }
- [[nodiscard]] std::vector> GetButcher() const override
- {
- }
+ [[nodiscard]] std::vector> GetHuman() const override;
+ [[nodiscard]] std::vector> GetButcher() const override;
- [[nodiscard]] std::vector> GetProps() const override
- {
- }
+ [[nodiscard]] std::vector> GetProps() const override;
- [[nodiscard]] std::vector> GetFullMap() const override
- {
- }
+ [[nodiscard]] std::vector> GetFullMap() const override;
[[nodiscard]] THUAI6::PlaceType GetPlaceType(int32_t CellX, int32_t CellY) const override
{
}
@@ -282,40 +258,22 @@ public:
}
void Play(IAI& ai) override;
- std::future Move(int64_t timeInMilliseconds, double angleInRadian) override
- {
- }
+ std::future Move(int64_t timeInMilliseconds, double angleInRadian) override;
[[nodiscard]] int GetFrameCount() const override
{
}
- std::future MoveRight(int64_t timeInMilliseconds) override
- {
- }
- std::future MoveUp(int64_t timeInMilliseconds) override
- {
- }
- std::future MoveLeft(int64_t timeInMilliseconds) override
- {
- }
- std::future MoveDown(int64_t timeInMilliseconds) override
- {
- }
+ std::future MoveRight(int64_t timeInMilliseconds) override;
+ std::future MoveUp(int64_t timeInMilliseconds) override;
+ std::future MoveLeft(int64_t timeInMilliseconds) override;
+ std::future MoveDown(int64_t timeInMilliseconds) override;
- std::future PickProp(THUAI6::PropType prop) override
- {
- }
- std::future UseProp() override
- {
- }
- std::future UseSkill() override
- {
- }
+ std::future PickProp(THUAI6::PropType prop) override;
+ std::future UseProp() override;
+ std::future UseSkill() override;
- std::future SendMessage(int64_t, std::string) override
- {
- }
+ std::future SendMessage(int64_t, std::string) override;
[[nodiscard]] std::future HaveMessage() override
{
}
From 3937ad00af3acf17cb3b5c1725fcd0704d7099db Mon Sep 17 00:00:00 2001
From: DragonAura
Date: Sat, 19 Nov 2022 20:54:15 +0800
Subject: [PATCH 05/16] feat(CAPI): :sparkles: complete most communication
functions, test required
---
CAPI/API/include/API.h | 119 ++++++++---------------
CAPI/API/include/Communication.h | 21 +++-
CAPI/API/include/logic.h | 47 +++------
CAPI/API/include/utils.hpp | 8 ++
CAPI/API/src/API.cpp | 158 +++++++++++++++++++++++++++----
CAPI/API/src/Communication.cpp | 126 +++++++++++++++++++++++-
CAPI/API/src/logic.cpp | 141 +++++++++++----------------
7 files changed, 400 insertions(+), 220 deletions(-)
diff --git a/CAPI/API/include/API.h b/CAPI/API/include/API.h
index 1b672e2..d42a89d 100644
--- a/CAPI/API/include/API.h
+++ b/CAPI/API/include/API.h
@@ -34,6 +34,7 @@ public:
virtual std::shared_ptr ButcherGetSelfInfo() const = 0;
virtual std::vector> GetFullMap() const = 0;
+ virtual THUAI6::PlaceType GetPlaceType(int32_t CellX, int32_t CellY) const = 0;
// 供IAPI使用的操作相关的部分
virtual bool Move(int64_t time, double angle) = 0;
@@ -42,17 +43,17 @@ public:
virtual bool UseSkill() = 0;
virtual bool SendMessage(int64_t toID, std::string message) = 0;
virtual bool HaveMessage() = 0;
- virtual std::pair GetMessage() = 0;
+ virtual std::pair GetMessage() = 0;
virtual bool Escape() = 0;
// 说明:双向stream由三个函数共同实现,两个记录开始和结束,结果由Logic里的私有的成员变量记录,获得返回值则另调函数
- virtual bool StartFixMachine() = 0;
- virtual bool EndFixMachine() = 0;
+ virtual void StartFixMachine() = 0;
+ virtual void EndFixMachine() = 0;
virtual bool GetFixStatus() = 0;
- virtual bool StartSaveHuman() = 0;
- virtual bool EndSaveHuman() = 0;
+ virtual void StartSaveHuman() = 0;
+ virtual void EndSaveHuman() = 0;
virtual bool GetSaveStatus() = 0;
virtual bool Attack(double angle) = 0;
@@ -128,11 +129,11 @@ class IHumanAPI : public IAPI
public:
/*****人类阵营的特定函数*****/
- virtual std::future StartFixMachine() = 0;
- virtual std::future EndFixMachine() = 0;
+ virtual void StartFixMachine() = 0;
+ virtual void EndFixMachine() = 0;
virtual std::future GetFixStatus() = 0;
- virtual std::future StartSaveHuman() = 0;
- virtual std::future EndSaveHuman() = 0;
+ virtual void StartSaveHuman() = 0;
+ virtual void EndSaveHuman() = 0;
virtual std::future GetSaveStatus() = 0;
virtual std::future Escape() = 0;
[[nodiscard]] virtual std::shared_ptr GetSelfInfo() const = 0;
@@ -189,12 +190,8 @@ public:
std::future UseSkill() override;
std::future SendMessage(int64_t, std::string) override;
- [[nodiscard]] std::future HaveMessage() override
- {
- }
- [[nodiscard]] std::future> GetMessage() override
- {
- }
+ [[nodiscard]] std::future HaveMessage() override;
+ [[nodiscard]] std::future> GetMessage() override;
std::future Wait() override
{
@@ -206,38 +203,20 @@ public:
[[nodiscard]] std::vector> GetProps() const override;
[[nodiscard]] std::vector> GetFullMap() const override;
- [[nodiscard]] THUAI6::PlaceType GetPlaceType(int32_t CellX, int32_t CellY) const override
- {
- }
+ [[nodiscard]] THUAI6::PlaceType GetPlaceType(int32_t CellX, int32_t CellY) const override;
[[nodiscard]] const std::vector GetPlayerGUIDs() const override
{
}
- std::future StartFixMachine() override
- {
- }
- std::future EndFixMachine() override
- {
- }
- std::future GetFixStatus() override
- {
- }
- std::future StartSaveHuman() override
- {
- }
- std::future EndSaveHuman() override
- {
- }
- std::future GetSaveStatus() override
- {
- }
- std::future Escape() override
- {
- }
- [[nodiscard]] virtual std::shared_ptr GetSelfInfo() const override
- {
- }
+ void StartFixMachine() override;
+ void EndFixMachine() override;
+ std::future GetFixStatus() override;
+ void StartSaveHuman() override;
+ void EndSaveHuman() override;
+ std::future GetSaveStatus() override;
+ std::future Escape() override;
+ [[nodiscard]] std::shared_ptr GetSelfInfo() const override;
private:
ILogic& logic;
@@ -273,54 +252,30 @@ public:
std::future UseSkill() override;
std::future SendMessage(int64_t, std::string) override;
- [[nodiscard]] std::future HaveMessage() override
- {
- }
- [[nodiscard]] std::future> GetMessage() override
- {
- }
+ [[nodiscard]] std::future HaveMessage() override;
+ [[nodiscard]] std::future> GetMessage() override;
std::future Wait() override
{
}
- [[nodiscard]] std::vector> GetHuman() const override
- {
- }
- [[nodiscard]] std::vector> GetButcher() const override
- {
- }
+ [[nodiscard]] std::vector> GetHuman() const override;
+ [[nodiscard]] std::vector> GetButcher() const override;
- [[nodiscard]] std::vector> GetProps() const override
- {
- }
+ [[nodiscard]] std::vector> GetProps() const override;
- [[nodiscard]] std::vector> GetFullMap() const override
- {
- }
- [[nodiscard]] THUAI6::PlaceType GetPlaceType(int32_t CellX, int32_t CellY) const override
- {
- }
+ [[nodiscard]] std::vector> GetFullMap() const override;
+ [[nodiscard]] THUAI6::PlaceType GetPlaceType(int32_t CellX, int32_t CellY) const override;
[[nodiscard]] const std::vector GetPlayerGUIDs() const override
{
}
- std::future Attack(double angleInRadian) override
- {
- }
- std::future CarryHuman() override
- {
- }
- std::future ReleaseHuman() override
- {
- }
- std::future HangHuman() override
- {
- }
- [[nodiscard]] std::shared_ptr GetSelfInfo() const override
- {
- }
+ std::future Attack(double angleInRadian) override;
+ std::future CarryHuman() override;
+ std::future ReleaseHuman() override;
+ std::future HangHuman() override;
+ [[nodiscard]] std::shared_ptr GetSelfInfo() const override;
private:
ILogic& logic;
@@ -408,19 +363,19 @@ public:
{
}
- std::future StartFixMachine() override
+ void StartFixMachine() override
{
}
- std::future EndFixMachine() override
+ void EndFixMachine() override
{
}
std::future GetFixStatus() override
{
}
- std::future StartSaveHuman() override
+ void StartSaveHuman() override
{
}
- std::future EndSaveHuman() override
+ void EndSaveHuman() override
{
}
std::future GetSaveStatus() override
diff --git a/CAPI/API/include/Communication.h b/CAPI/API/include/Communication.h
index 3dc7668..35c2711 100644
--- a/CAPI/API/include/Communication.h
+++ b/CAPI/API/include/Communication.h
@@ -8,6 +8,7 @@
#include "Services.pb.h"
#include
#include "structures.h"
+#include
class Logic;
@@ -24,17 +25,35 @@ public:
bool UseSkill(int64_t playerID);
bool SendMessage(int64_t toID, std::string message, int64_t playerID);
bool HaveMessage(int64_t playerID);
- std::pair GetMessage(int64_t playerID);
+ std::pair GetMessage(int64_t playerID);
bool Escape(int64_t playerID);
+
+ void StartFixMachine(int64_t playerID);
+ void EndFixMachine();
+ bool GetFixStatus();
+ void StartSaveHuman(int64_t playerID);
+ void EndSaveHuman();
+ bool GetSaveStatus();
+
+ bool Attack(double angle, int64_t playerID);
+
+ bool CarryHuman(int64_t playerID);
+ bool ReleaseHuman(int64_t playerID);
+ bool HangHuman(int64_t playerID);
+
bool TryConnection(int64_t playerID);
protobuf::MessageToClient GetMessage2Client();
bool HaveMessage2Client();
void AddPlayer(int64_t playerID, THUAI6::PlayerType playerType, THUAI6::HumanType humanType, THUAI6::ButcherType butcherType);
private:
+ void FixMachine(int64_t playerID);
+ void SaveHuman(int64_t playerID);
std::unique_ptr THUAI6Stub;
bool haveNewMessage = false;
protobuf::MessageToClient message2Client;
+ bool isFixing = false;
+ bool isSaving = false;
};
#endif
\ No newline at end of file
diff --git a/CAPI/API/include/logic.h b/CAPI/API/include/logic.h
index 6c00ca1..160f9a2 100644
--- a/CAPI/API/include/logic.h
+++ b/CAPI/API/include/logic.h
@@ -90,6 +90,7 @@ private:
std::shared_ptr ButcherGetSelfInfo() const override;
std::vector> GetFullMap() const override;
+ THUAI6::PlaceType GetPlaceType(int32_t CellX, int32_t CellY) const override;
// 供IAPI使用的操作相关的部分
bool Move(int64_t time, double angle) override;
@@ -98,43 +99,23 @@ private:
bool UseSkill() override;
bool SendMessage(int64_t toID, std::string message) override;
bool HaveMessage() override;
- std::pair GetMessage() override;
+ std::pair GetMessage() override;
bool Escape() override;
// 说明:双向stream由三个函数共同实现,两个记录开始和结束,结果由Logic里的私有的成员变量记录,获得返回值则另调函数
- bool StartFixMachine() override
- {
- }
- bool EndFixMachine() override
- {
- }
- bool GetFixStatus() override
- {
- }
-
- bool StartSaveHuman() override
- {
- }
- bool EndSaveHuman() override
- {
- }
- bool GetSaveStatus() override
- {
- }
-
- bool Attack(double angle) override
- {
- }
- bool CarryHuman() override
- {
- }
- bool ReleaseHuman() override
- {
- }
- bool HangHuman() override
- {
- }
+ void StartFixMachine() override;
+ void EndFixMachine() override;
+ bool GetFixStatus() override;
+
+ void StartSaveHuman() override;
+ void EndSaveHuman() override;
+ bool GetSaveStatus() override;
+
+ bool Attack(double angle) override;
+ bool CarryHuman() override;
+ bool ReleaseHuman() override;
+ bool HangHuman() override;
bool WaitThread() override
{
diff --git a/CAPI/API/include/utils.hpp b/CAPI/API/include/utils.hpp
index a785837..1f5a5f9 100644
--- a/CAPI/API/include/utils.hpp
+++ b/CAPI/API/include/utils.hpp
@@ -272,6 +272,14 @@ namespace THUAI62Proto
sendMsg.set_player_id(id);
return sendMsg;
}
+
+ inline protobuf::AttackMsg THUAI62ProtobufAttack(double angle, int64_t id)
+ {
+ protobuf::AttackMsg attackMsg;
+ attackMsg.set_angle(angle);
+ attackMsg.set_player_id(id);
+ return attackMsg;
+ }
} // namespace THUAI62Proto
#endif
\ No newline at end of file
diff --git a/CAPI/API/src/API.cpp b/CAPI/API/src/API.cpp
index 506c802..dd29eeb 100644
--- a/CAPI/API/src/API.cpp
+++ b/CAPI/API/src/API.cpp
@@ -10,26 +10,22 @@ std::future HumanAPI::Move(int64_t timeInMilliseconds, double angleInRadia
std::future HumanAPI::MoveDown(int64_t timeInMilliseconds)
{
- return std::async(std::launch::async, [&]()
- { return logic.Move(timeInMilliseconds, 0); });
+ return Move(timeInMilliseconds, 0);
}
std::future HumanAPI::MoveRight(int64_t timeInMilliseconds)
{
- return std::async(std::launch::async, [&]()
- { return logic.Move(timeInMilliseconds, PI * 0.5); });
+ return Move(timeInMilliseconds, PI * 0.5);
}
std::future HumanAPI::MoveUp(int64_t timeInMilliseconds)
{
- return std::async(std::launch::async, [&]()
- { return logic.Move(timeInMilliseconds, PI); });
+ return Move(timeInMilliseconds, PI);
}
std::future HumanAPI::MoveLeft(int64_t timeInMilliseconds)
{
- return std::async(std::launch::async, [&]()
- { return logic.Move(timeInMilliseconds, PI * 1.5); });
+ return Move(timeInMilliseconds, PI * 1.5);
}
std::future ButcherAPI::Move(int64_t timeInMilliseconds, double angleInRadian)
@@ -40,26 +36,22 @@ std::future ButcherAPI::Move(int64_t timeInMilliseconds, double angleInRad
std::future ButcherAPI::MoveDown(int64_t timeInMilliseconds)
{
- return std::async(std::launch::async, [&]()
- { return logic.Move(timeInMilliseconds, 0); });
+ return Move(timeInMilliseconds, 0);
}
std::future ButcherAPI::MoveRight(int64_t timeInMilliseconds)
{
- return std::async(std::launch::async, [&]()
- { return logic.Move(timeInMilliseconds, PI * 0.5); });
+ return Move(timeInMilliseconds, PI * 0.5);
}
std::future ButcherAPI::MoveUp(int64_t timeInMilliseconds)
{
- return std::async(std::launch::async, [&]()
- { return logic.Move(timeInMilliseconds, PI); });
+ return Move(timeInMilliseconds, PI);
}
std::future ButcherAPI::MoveLeft(int64_t timeInMilliseconds)
{
- return std::async(std::launch::async, [&]()
- { return logic.Move(timeInMilliseconds, PI * 1.5); });
+ return Move(timeInMilliseconds, PI * 1.5);
}
std::future HumanAPI::PickProp(THUAI6::PropType prop)
@@ -110,6 +102,30 @@ std::future ButcherAPI::SendMessage(int64_t toID, std::string message)
{ return logic.SendMessage(toID, message); });
}
+std::future HumanAPI::HaveMessage()
+{
+ return std::async(std::launch::async, [&]()
+ { return logic.HaveMessage(); });
+}
+
+std::future ButcherAPI::HaveMessage()
+{
+ return std::async(std::launch::async, [&]()
+ { return logic.HaveMessage(); });
+}
+
+std::future> HumanAPI::GetMessage()
+{
+ return std::async(std::launch::async, [&]()
+ { return logic.GetMessage(); });
+}
+
+std::future> ButcherAPI::GetMessage()
+{
+ return std::async(std::launch::async, [&]()
+ { return logic.GetMessage(); });
+}
+
std::vector> HumanAPI::GetButcher() const
{
return logic.GetButchers();
@@ -120,16 +136,126 @@ std::vector> HumanAPI::GetHuman() const
return logic.GetHumans();
}
+std::vector> ButcherAPI::GetButcher() const
+{
+ return logic.GetButchers();
+}
+
+std::vector> ButcherAPI::GetHuman() const
+{
+ return logic.GetHumans();
+}
+
std::vector> HumanAPI::GetProps() const
{
return logic.GetProps();
}
+std::vector> ButcherAPI::GetProps() const
+{
+ return logic.GetProps();
+}
+
std::vector> HumanAPI::GetFullMap() const
{
return logic.GetFullMap();
}
+THUAI6::PlaceType HumanAPI::GetPlaceType(int32_t CellX, int32_t CellY) const
+{
+ return logic.GetPlaceType(CellX, CellY);
+}
+
+THUAI6::PlaceType ButcherAPI::GetPlaceType(int32_t CellX, int32_t CellY) const
+{
+ return logic.GetPlaceType(CellX, CellY);
+}
+
+std::vector> ButcherAPI::GetFullMap() const
+{
+ return logic.GetFullMap();
+}
+
+void HumanAPI::StartFixMachine()
+{
+ std::thread([&]()
+ { logic.StartFixMachine(); })
+ .detach();
+}
+
+void HumanAPI::EndFixMachine()
+{
+ std::thread([&]()
+ { logic.EndFixMachine(); })
+ .detach();
+}
+
+std::future HumanAPI::GetFixStatus()
+{
+ return std::async(std::launch::async, [&]()
+ { return logic.GetFixStatus(); });
+}
+
+void HumanAPI::StartSaveHuman()
+{
+ std::thread([&]()
+ { logic.StartSaveHuman(); })
+ .detach();
+}
+
+void HumanAPI::EndSaveHuman()
+{
+ std::thread([&]()
+ { logic.EndSaveHuman(); })
+ .detach();
+}
+
+std::future HumanAPI::GetSaveStatus()
+{
+ return std::async(std::launch::async, [&]()
+ { return logic.GetSaveStatus(); });
+}
+
+std::future HumanAPI::Escape()
+{
+ return std::async(std::launch::async, [&]()
+ { return logic.Escape(); });
+}
+
+std::shared_ptr HumanAPI::GetSelfInfo() const
+{
+ return logic.HumanGetSelfInfo();
+}
+
+std::future ButcherAPI::Attack(double angleInRadian)
+{
+ return std::async(std::launch::async, [&]()
+ { return logic.Attack(angleInRadian); });
+}
+
+std::future ButcherAPI::CarryHuman()
+{
+ return std::async(std::launch::async, [&]()
+ { return logic.CarryHuman(); });
+}
+
+std::future ButcherAPI::ReleaseHuman()
+{
+ return std::async(std::launch::async, [&]()
+ { return logic.ReleaseHuman(); });
+}
+
+std::future ButcherAPI::HangHuman()
+{
+ return std::async(std::launch::async, [&]()
+ { return logic.HangHuman(); });
+}
+
+std::shared_ptr ButcherAPI::GetSelfInfo() const
+{
+ return logic.ButcherGetSelfInfo();
+}
+
void HumanAPI::Play(IAI& ai)
{
ai.play(*this);
diff --git a/CAPI/API/src/Communication.cpp b/CAPI/API/src/Communication.cpp
index 3a0d83f..d1634fb 100644
--- a/CAPI/API/src/Communication.cpp
+++ b/CAPI/API/src/Communication.cpp
@@ -85,7 +85,7 @@ bool Communication::HaveMessage(int64_t playerID)
return false;
}
-std::pair Communication::GetMessage(int64_t playerID)
+std::pair Communication::GetMessage(int64_t playerID)
{
protobuf::MsgRes getMessageResult;
ClientContext context;
@@ -94,12 +94,12 @@ std::pair Communication::GetMessage(int64_t playerID)
if (status.ok())
{
if (getMessageResult.have_message())
- return std::make_pair(getMessageResult.message_received(), getMessageResult.from_player_id());
+ return std::make_pair(getMessageResult.from_player_id(), getMessageResult.message_received());
else
- return std::make_pair("", -1);
+ return std::make_pair(-1, "");
}
else
- return std::make_pair("", -1);
+ return std::make_pair(-1, "");
}
bool Communication::Escape(int64_t playerID)
@@ -114,6 +114,124 @@ bool Communication::Escape(int64_t playerID)
return false;
}
+void Communication::FixMachine(int64_t playerID)
+{
+ protobuf::BoolRes fixMachineResult;
+ auto request = THUAI62Proto::THUAI62ProtobufID(playerID);
+ ClientContext context;
+ while (isFixing)
+ {
+ auto fixStream = THUAI6Stub->FixMachine(&context);
+ fixStream->Write(request);
+ fixStream->Read(&fixMachineResult);
+ if (!fixMachineResult.act_success())
+ {
+ isFixing = false;
+ break;
+ }
+ std::this_thread::sleep_for(std::chrono::milliseconds(10)); // 防止巨量发信
+ }
+}
+
+void Communication::StartFixMachine(int64_t playerID)
+{
+ isFixing = true;
+ FixMachine(playerID);
+}
+
+void Communication::EndFixMachine()
+{
+ isFixing = false;
+}
+
+bool Communication::GetFixStatus()
+{
+ return isFixing;
+}
+
+void Communication::SaveHuman(int64_t playerID)
+{
+ protobuf::BoolRes saveHumanResult;
+ auto request = THUAI62Proto::THUAI62ProtobufID(playerID);
+ ClientContext context;
+ while (isSaving)
+ {
+ auto saveStream = THUAI6Stub->SaveHuman(&context);
+ saveStream->Write(request);
+ saveStream->Read(&saveHumanResult);
+ if (!saveHumanResult.act_success())
+ {
+ isSaving = false;
+ break;
+ }
+ std::this_thread::sleep_for(std::chrono::milliseconds(10)); // 防止巨量发信
+ }
+}
+
+void Communication::StartSaveHuman(int64_t playerID)
+{
+ isSaving = true;
+ SaveHuman(playerID);
+}
+
+void Communication::EndSaveHuman()
+{
+ isSaving = false;
+}
+
+bool Communication::GetSaveStatus()
+{
+ return isSaving;
+}
+
+bool Communication::Attack(double angle, int64_t playerID)
+{
+ protobuf::BoolRes attackResult;
+ ClientContext context;
+ auto request = THUAI62Proto::THUAI62ProtobufAttack(angle, playerID);
+ auto status = THUAI6Stub->Attack(&context, request, &attackResult);
+ if (status.ok())
+ return attackResult.act_success();
+ else
+ return false;
+}
+
+bool Communication::CarryHuman(int64_t playerID)
+{
+ protobuf::BoolRes carryHumanResult;
+ ClientContext context;
+ auto request = THUAI62Proto::THUAI62ProtobufID(playerID);
+ auto status = THUAI6Stub->CarryHuman(&context, request, &carryHumanResult);
+ if (status.ok())
+ return carryHumanResult.act_success();
+ else
+ return false;
+}
+
+bool Communication::ReleaseHuman(int64_t playerID)
+{
+ protobuf::BoolRes releaseHumanResult;
+ ClientContext context;
+ auto request = THUAI62Proto::THUAI62ProtobufID(playerID);
+ auto status = THUAI6Stub->ReleaseHuman(&context, request, &releaseHumanResult);
+ if (status.ok())
+ return releaseHumanResult.act_success();
+ else
+ return false;
+}
+
+bool Communication::HangHuman(int64_t playerID)
+{
+ protobuf::BoolRes hangHumanResult;
+ ClientContext context;
+ auto request = THUAI62Proto::THUAI62ProtobufID(playerID);
+ auto status = THUAI6Stub->HangHuman(&context, request, &hangHumanResult);
+ if (status.ok())
+ return hangHumanResult.act_success();
+ else
+ return false;
+}
+
bool Communication::TryConnection(int64_t playerID)
{
protobuf::BoolRes reply;
diff --git a/CAPI/API/src/logic.cpp b/CAPI/API/src/logic.cpp
index 8acdcc4..3cb688a 100644
--- a/CAPI/API/src/logic.cpp
+++ b/CAPI/API/src/logic.cpp
@@ -62,121 +62,102 @@ std::vector> Logic::GetFullMap() const
return currentState->gamemap;
}
+THUAI6::PlaceType Logic::GetPlaceType(int32_t CellX, int32_t CellY) const
+{
+ std::lock_guard lock(mtxState);
+ return currentState->gamemap[CellX][CellY];
+}
+
bool Logic::Move(int64_t time, double angle)
{
- // protobuf::MoveRes moveResult;
- // ClientContext context;
- // auto request = THUAI62Proto::THUAI62ProtobufMove(time, angle, playerID);
- // auto status = THUAI6Stub->Move(&context, request, &moveResult);
- // if (status.ok())
- // return moveResult.act_success();
- // else
- // return false;
return pComm->Move(time, angle, playerID);
}
bool Logic::PickProp(THUAI6::PropType prop)
{
- // protobuf::BoolRes pickPropResult;
- // ClientContext context;
- // auto request = THUAI62Proto::THUAI62ProtobufPick(prop, playerID);
- // auto status = THUAI6Stub->PickProp(&context, request, &pickPropResult);
- // if (status.ok())
- // return pickPropResult.act_success();
- // else
- // return false;
-
return pComm->PickProp(prop, playerID);
}
bool Logic::UseProp()
{
- // protobuf::BoolRes usePropResult;
- // ClientContext context;
- // auto request = THUAI62Proto::THUAI62ProtobufID(playerID);
- // auto status = THUAI6Stub->UseProp(&context, request, &usePropResult);
- // if (status.ok())
- // return usePropResult.act_success();
- // else
- // return false;
return pComm->UseProp(playerID);
}
bool Logic::UseSkill()
{
- // protobuf::BoolRes useSkillResult;
- // ClientContext context;
- // auto request = THUAI62Proto::THUAI62ProtobufID(playerID);
- // auto status = THUAI6Stub->UseSkill(&context, request, &useSkillResult);
- // if (status.ok())
- // return useSkillResult.act_success();
- // else
- // return false;
-
return pComm->UseSkill(playerID);
}
bool Logic::SendMessage(int64_t toID, std::string message)
{
- // protobuf::BoolRes sendMessageResult;
- // ClientContext context;
- // auto request = THUAI62Proto::THUAI62ProtobufSend(message, toID, playerID);
- // auto status = THUAI6Stub->SendMessage(&context, request, &sendMessageResult);
- // if (status.ok())
- // return sendMessageResult.act_success();
- // else
- // return false;
-
return pComm->SendMessage(toID, message, playerID);
}
bool Logic::HaveMessage()
{
- // protobuf::BoolRes haveMessageResult;
- // ClientContext context;
- // auto request = THUAI62Proto::THUAI62ProtobufID(playerID);
- // auto status = THUAI6Stub->HaveMessage(&context, request, &haveMessageResult);
- // if (status.ok())
- // return haveMessageResult.act_success();
- // else
- // return false;
-
return pComm->HaveMessage(playerID);
}
-std::pair Logic::GetMessage()
+std::pair Logic::GetMessage()
{
- // protobuf::MsgRes getMessageResult;
- // ClientContext context;
- // auto request = THUAI62Proto::THUAI62ProtobufID(playerID);
- // auto status = THUAI6Stub->GetMessage(&context, request, &getMessageResult);
- // if (status.ok())
- // {
- // if (getMessageResult.have_message())
- // return std::make_pair(getMessageResult.message_received(), getMessageResult.from_player_id());
- // else
- // return std::make_pair("", -1);
- // }
- // else
- // return std::make_pair("", -1);
-
return pComm->GetMessage(playerID);
}
bool Logic::Escape()
{
- // protobuf::BoolRes escapeResult;
- // ClientContext context;
- // auto request = THUAI62Proto::THUAI62ProtobufID(playerID);
- // auto status = THUAI6Stub->Escape(&context, request, &escapeResult);
- // if (status.ok())
- // return escapeResult.act_success();
- // else
- // return false;
-
return pComm->Escape(playerID);
}
+void Logic::StartFixMachine()
+{
+ pComm->StartFixMachine(playerID);
+}
+
+void Logic::EndFixMachine()
+{
+ pComm->EndFixMachine();
+}
+
+bool Logic::GetFixStatus()
+{
+ return pComm->GetFixStatus();
+}
+
+void Logic::StartSaveHuman()
+{
+ pComm->StartSaveHuman(playerID);
+}
+
+void Logic::EndSaveHuman()
+{
+ pComm->EndSaveHuman();
+}
+
+bool Logic::GetSaveStatus()
+{
+ return pComm->GetSaveStatus();
+}
+
+bool Logic::Attack(double angle)
+{
+ return pComm->Attack(angle, playerID);
+}
+
+bool Logic::CarryHuman()
+{
+ return pComm->CarryHuman(playerID);
+}
+
+bool Logic::ReleaseHuman()
+{
+ return pComm->ReleaseHuman(playerID);
+}
+
+bool Logic::HangHuman()
+{
+ return pComm->HangHuman(playerID);
+}
+
void Logic::ProcessMessage()
{
auto messageThread = [&]()
@@ -268,14 +249,6 @@ void Logic::PlayerWrapper(std::function player)
bool Logic::TryConnection()
{
- // IDMsg request = THUAI62Proto::THUAI62ProtobufID(playerID);
- // BoolRes reply;
- // ClientContext context;
- // auto status = THUAI6Stub->TryConnection(&context, request, &reply);
- // if (status.ok())
- // return true;
- // else
- // return false;
return pComm->TryConnection(playerID);
}
From bc12e302fe10898aebc3f3b672d5d1f94710bbf1 Mon Sep 17 00:00:00 2001
From: gsy1519 <614054460@qq.com>
Date: Sat, 19 Nov 2022 22:46:00 +0800
Subject: [PATCH 06/16] chore: :rocket: start
start
---
.../Protos => dependency/proto}/Protos.csproj | 4 +-
logic/ClientTest/ClientTest.csproj | 2 +-
logic/ClientTest/Program.cs | 2 +-
logic/Protos/Message2Clients.proto | 125 ------------------
logic/Protos/Message2Server.proto | 62 ---------
logic/Protos/MessageType.proto | 110 ---------------
logic/Server/Game.cs | 59 ++++-----
logic/Server/GameServer.cs | 63 +++++----
logic/Server/Program.cs | 3 +-
logic/Server/Server.csproj | 2 +-
logic/logic.sln | 12 +-
11 files changed, 72 insertions(+), 372 deletions(-)
rename {logic/Protos => dependency/proto}/Protos.csproj (86%)
delete mode 100644 logic/Protos/Message2Clients.proto
delete mode 100644 logic/Protos/Message2Server.proto
delete mode 100644 logic/Protos/MessageType.proto
diff --git a/logic/Protos/Protos.csproj b/dependency/proto/Protos.csproj
similarity index 86%
rename from logic/Protos/Protos.csproj
rename to dependency/proto/Protos.csproj
index e6fac69..8c98b0a 100644
--- a/logic/Protos/Protos.csproj
+++ b/dependency/proto/Protos.csproj
@@ -10,11 +10,12 @@
+
-
+
@@ -27,6 +28,7 @@
+
diff --git a/logic/ClientTest/ClientTest.csproj b/logic/ClientTest/ClientTest.csproj
index e9bbb1e..075a2ce 100644
--- a/logic/ClientTest/ClientTest.csproj
+++ b/logic/ClientTest/ClientTest.csproj
@@ -14,7 +14,7 @@
-
+
diff --git a/logic/ClientTest/Program.cs b/logic/ClientTest/Program.cs
index 529dce3..ef30dc9 100644
--- a/logic/ClientTest/Program.cs
+++ b/logic/ClientTest/Program.cs
@@ -7,7 +7,7 @@ namespace ClientTest
{
public static async Task Main(string[] args)
{
- Channel channel = new Channel("127.0.0.1:8888", ChannelCredentials.Insecure);
+ Channel channel = new Channel("0.0.0.0:8888", ChannelCredentials.Insecure);
var client = new AvailableService.AvailableServiceClient(channel);
PlayerMsg playerInfo = new();
playerInfo.PlayerId = Convert.ToInt32(args[0]);
diff --git a/logic/Protos/Message2Clients.proto b/logic/Protos/Message2Clients.proto
deleted file mode 100644
index edae464..0000000
--- a/logic/Protos/Message2Clients.proto
+++ /dev/null
@@ -1,125 +0,0 @@
-// Message2Client
-syntax = "proto3";
-package protobuf;
-
-import "MessageType.proto";
-import "Message2Server.proto";
-
-message MessageOfHuman
-{
- int32 x = 1;
- int32 y = 2;
- int32 speed = 3;
- int32 life = 4; // 本次未倒地前的血量,也即还可以受的伤害
- int32 hanged_time = 5; // 被挂上的次数
- double time_until_skill_available = 6;
- PlaceType place = 7;
- PropType prop = 8;
- HumanType human_type = 9;
- int64 guid = 10;
- bool on_chair = 11; // 是否被挂
- double chair_time = 12; // 被挂的时间
- bool on_ground = 13; // 是否倒地
- double ground_time = 14; // 倒地时间
- int64 player_id = 15;
- int32 view_range = 16; // 视野距离
- repeated HumanBuffType buff = 17;
-}
-
-message MessageOfButcher
-{
- int32 x = 1;
- int32 y = 2;
- int32 speed = 3;
- int32 damage = 4;
- double time_until_skill_available = 5;
- PlaceType place = 6;
- PropType prop = 7;
- ButcherType butcher_type = 8;
- int64 guid = 9;
- bool movable = 10; // 是否进入了攻击后摇
- int64 playerID = 11;
- int32 view_range = 12; // 视野距离
- repeated ButcherBuffType buff = 13;
-}
-
-message MessageOfProp // 可拾取道具的信息
-{
- PropType type = 1;
- int32 x = 2;
- int32 y = 3;
- double facing_direction = 4;
- int64 guid = 5;
- PlaceType place = 6;
- int32 size = 7;
- bool is_moving = 8;
-}
-
-message MessageOfPickedProp //for Unity,直接继承自THUAI5
-{
- PropType type = 1;
- int32 x = 2;
- int32 y = 3;
- double facing_direction = 4;
- int64 mapping_id = 5;
-}
-
-message MessageOfMap
-{
- message Row
- {
- repeated PlaceType col = 1;
- }
- repeated Row row = 2;
-}
-
-message MessageToClient
-{
- repeated MessageOfHuman human_message = 1;
- repeated MessageOfButcher butcher_message = 2; // 是否真正repeated待定
- repeated MessageOfProp prop_message = 3;
- MessageOfMap map_massage = 4;
-}
-
-message MoveRes // 如果打算设计撞墙保留平行速度分量,且需要返回值则可用这个(大概没啥用)
-{
- int64 actual_speed = 1;
- double actual_angle = 2;
-}
-
-message BoolRes // 用于只需要判断执行操作是否成功的行为,如捡起道具、使用道具
-{
- bool act_success = 1;
-}
-
-message MsgRes // 用于获取队友发来的消息
-{
- bool have_message = 1; // 是否有待接收的消息
- int64 from_player_id = 2;
- string message_received = 3;
-}
-
-service AvailableService
-{
- rpc TryConnection(IDMsg) returns(BoolRes);
-
- // 游戏开局调用一次的服务
- rpc AddPlayer(PlayerMsg) returns(stream MessageToClient); // 连接上后等待游戏开始,server会定时通过该服务向所有client发送消息。
-
- // 游戏过程中玩家执行操作的服务
- rpc Move(MoveMsg) returns (MoveRes);
- rpc PickProp(PickMsg) returns (BoolRes);
- rpc UseProp(IDMsg) returns (BoolRes);
- rpc UseSkill(IDMsg) returns (BoolRes);
- rpc SendMessage(SendMsg) returns (BoolRes);
- rpc HaveMessage(IDMsg) returns (BoolRes);
- rpc GetMessage(IDMsg) returns (MsgRes);
- rpc FixMachine(stream IDMsg) returns (stream BoolRes); // 若正常修复且未被打断则返回修复成功,位置错误/被打断则返回修复失败,下同
- rpc SaveHuman(stream IDMsg) returns (stream BoolRes);
- rpc Attack (AttackMsg) returns (BoolRes);
- rpc CarryHuman (IDMsg) returns (BoolRes);
- rpc ReleaseHuman (IDMsg) returns (BoolRes);
- rpc HangHuman (IDMsg) returns (BoolRes);
- rpc Escape (IDMsg) returns (BoolRes);
-
-}
\ No newline at end of file
diff --git a/logic/Protos/Message2Server.proto b/logic/Protos/Message2Server.proto
deleted file mode 100644
index b3891b6..0000000
--- a/logic/Protos/Message2Server.proto
+++ /dev/null
@@ -1,62 +0,0 @@
-// Message2Server
-syntax = "proto3";
-package protobuf;
-
-import "MessageType.proto";
-
-message PlayerMsg
-{
- int64 player_id = 1;
- PlayerType player_type = 2;
- oneof job_type
- {
- HumanType human_type = 3;
- ButcherType butcher_type = 4;
- }
-}
-
-message MoveMsg
-{
- int64 player_id = 1;
- double angle = 2;
- int64 time_in_milliseconds = 3;
-}
-
-message PickMsg
-{
- int64 player_id = 1;
- PropType prop_type = 2;
-}
-
-message SendMsg
-{
- int64 player_id = 1;
- int64 to_player_id = 2;
- string message = 3;
-}
-
-message AttackMsg
-{
- int64 player_id = 1;
- double angle = 2;
-}
-
-message IDMsg
-{
- int64 player_id = 1;
-}
-
-// 基本继承于THUAI5,为了使发送的信息尽可能不被浪费,暂定不发这类大包。
-// message MessageToServer
-// {
-// MessageType messageType = 1;
-// int64 playerID = 2; // 消息发送者的playerID
-// PlayerType playerType = 3;
-// HumanType humanType= 4;
-// ButcherType butcherType = 5;
-// double angle = 6; // messageType为Move, Attack时的角度
-// PropType propType = 7; // messageType为PickProp时要捡起的道具类型,防止多个道具堆叠时出现问题
-// int64 timeInMilliseconds = 8;//时间参数
-// int64 ToPlayerID = 9; // messageType为Send时要发送的对象的ID
-// string message = 10; // messageType为Send时发送的消息内容
-// }
\ No newline at end of file
diff --git a/logic/Protos/MessageType.proto b/logic/Protos/MessageType.proto
deleted file mode 100644
index 2041fe0..0000000
--- a/logic/Protos/MessageType.proto
+++ /dev/null
@@ -1,110 +0,0 @@
-// MessageType
-syntax = "proto3";
-package protobuf;
-
-enum PlaceType // 地图中的所有物件类型
-{
- NULL_PLACE_TYPE = 0;
-
- // 地图情况,其中Gate是总体的大门,HiddenGate是地窖
- LAND = 1;
- WALL = 2;
- GRASS = 3;
- MACHINE = 4;
- GATE = 5;
- HIDDEN_GATE = 6;
- // 待补充有特殊效果的地形
-
-}
-
-enum ShapeType // 形状类型
-{
- NULL_SHAPE_TYPE = 0;
- CIRCLE = 1; // 人类、屠夫、可拾取道具等为圆形
- SQUARE = 2; // 地形均为方形
-}
-
-enum PropType // 地图中的可拾取道具类型
-{
- NULL_PROP_TYPE = 0;
- PTYPE1 = 1;
- PTYPE2 = 2;
- PTYPE3 = 3;
- PTYPE4 = 4;
-
-}
-
-enum HumanBuffType // 人类可用的增益效果类型
-{
- NULL_HBUFF_TYPE = 0;
- HBUFFTYPE1 = 1;
- HBUFFTYPE2 = 2;
- HBUFFTYPE3 = 3;
- HBUFFTYPE4 = 4;
-}
-
-enum ButcherBuffType // 屠夫可用的增益效果类型
-{
- NULL_BBUFF_TYPE = 0;
- BBUFFTYPE1 = 1;
- BBUFFTYPE2 = 2;
- BBUFFTYPE3 = 3;
- BBUFFTYPE4 = 4;
-}
-
-// 特别说明:由于Human阵营和Butcher阵营有显著的隔离,且暂定职业、主动技能和被动效果相互绑定,故不按照THUAI5的方式区分ActiveSkillType和PassiveSkillType,而是选择了按照阵营来给不同阵营赋予不同的职业(及技能)。
-
-enum PlayerType
-{
- NULL_PLAYER_TYPE = 0;
- HUMAN_PLAYER = 1;
- BUTCHER_PLAYER = 2;
-}
-
-enum HumanType
-{
- NULL_HUMAN_TYPE = 0;
- HUMANTYPE1 = 1;
- HUMANTYPE2 = 2;
- HUMANTYPE3 = 3;
- HUMANTYPE4 = 4;
-}
-
-enum ButcherType
-{
- NULL_BUTCHER_TYPE = 0;
- BUTCHERTYPE1 = 1;
- BUTCHERTYPE2 = 2;
- BUTCHERTYPE3 = 3;
- BUTCHERTYPE4 = 4;
-}
-
-// 取消了大包之后,MessageType的枚举是否有必要保留还有待商榷
-// enum MessageType
-// {
-// // 公共信息类型
-// Move = 0;
-// PickProp = 1;
-// UseProp = 2;
-// UseSkill = 3;
-// Map = 4;
-// Send = 5;
-
-// // 人类限定信息类型
-// FixMachine = 6;
-// SaveHuman = 7;
-
-// // 屠夫限定信息类型
-// Attack = 8;
-// CarryHuman = 9;
-// ReleaseHuman = 10;
-// HangHuman = 11;
-
-// // 游戏相关信息类型
-// AddPlayer = 12;
-// InvalidPlayer = 13;
-// ValidPlayer = 14;
-// StartGame = 15;
-// Gaming = 16;
-// EndGame = 17;
-// }
diff --git a/logic/Server/Game.cs b/logic/Server/Game.cs
index 96e7680..9eef516 100644
--- a/logic/Server/Game.cs
+++ b/logic/Server/Game.cs
@@ -18,7 +18,7 @@ namespace Server
public bool IsGaming
{
get => Interlocked.CompareExchange(ref isGaming, 0, 0) != 0;
- set => Interlocked.Exchange(ref isGaming, value ? 1 : 0);
+ set => Interlocked.Exchange(ref isGaming, value? 1: 0);
}
public MessageToClient GetCopiedGameInfo()
@@ -32,19 +32,18 @@ namespace Server
{
lock (gameInfoLock)
{
- if (player.PlayerType == PlayerType.NullPlayerType) return;
+ if (player.PlayerType == PlayerType.NullPlayerType)
+ return;
if (player.PlayerType == PlayerType.HumanPlayer)
{
- gameInfo.HumanMessage.Add(new MessageOfHuman()
- {
+ gameInfo.HumanMessage.Add(new MessageOfHuman() {
PlayerId = player.PlayerId
});
return;
}
if (player.PlayerType == PlayerType.ButcherPlayer)
{
- gameInfo.ButcherMessage.Add(new MessageOfButcher()
- {
+ gameInfo.ButcherMessage.Add(new MessageOfButcher() {
PlayerID = player.PlayerId
});
return;
@@ -66,39 +65,39 @@ namespace Server
() => IsGaming,
() =>
{
- lock (gameInfo)
- {
- for (int i = 0; i < gameInfo.HumanMessage.Count; i++)
- {
- if (gameInfo.HumanMessage[i] != null)
- {
- gameInfo.HumanMessage[i].X++;
- gameInfo.HumanMessage[i].Y--;
- }
- }
- for (int i = 0; i < gameInfo.ButcherMessage.Count; i++)
- {
- if (gameInfo.ButcherMessage[i] != null)
- {
- gameInfo.ButcherMessage[i].X--;
- gameInfo.ButcherMessage[i].Y++;
- }
- }
- }
+ lock (gameInfo)
+ {
+ for (int i = 0; i < gameInfo.HumanMessage.Count; i++)
+ {
+ if (gameInfo.HumanMessage[i] != null)
+ {
+ gameInfo.HumanMessage[i].X++;
+ gameInfo.HumanMessage[i].Y--;
+ }
+ }
+ for (int i = 0; i < gameInfo.ButcherMessage.Count; i++)
+ {
+ if (gameInfo.ButcherMessage[i] != null)
+ {
+ gameInfo.ButcherMessage[i].X--;
+ gameInfo.ButcherMessage[i].Y++;
+ }
+ }
+ }
},
100,
() =>
{
- IsGaming = false;
- waitHandle.Release();
- return 0;
+ IsGaming = false;
+ waitHandle.Release();
+ return 0;
},
gameTime
).Start();
- }
+ }
)
{ IsBackground = true }.Start();
return waitHandle;
- }
}
}
+}
diff --git a/logic/Server/GameServer.cs b/logic/Server/GameServer.cs
index c31d611..f97a06f 100644
--- a/logic/Server/GameServer.cs
+++ b/logic/Server/GameServer.cs
@@ -11,7 +11,7 @@ namespace Server
{
private Dictionary semaDict = new();
private object gameLock = new();
- private const int playerNum = 2;
+ private const int playerNum = 1;
private MessageToClient currentGameInfo = new();
private Game game = new();
public int GameTime => game.GameTime;
@@ -22,11 +22,11 @@ namespace Server
var onConnection = new BoolRes();
lock (gameLock)
{
- if (0 <= request.PlayerId && request.PlayerId < playerNum)
+ // if (0 <= request.PlayerId && request.PlayerId < playerNum)
{
onConnection.ActSuccess = true;
return Task.FromResult(onConnection);
- }
+ }
}
onConnection.ActSuccess = false;
return Task.FromResult(onConnection);
@@ -53,13 +53,12 @@ namespace Server
{
Console.WriteLine("Game starts!");
StartGame();
- }
+ }
}
do
{
semaDict[request.PlayerId].Item1.Wait();
-
if (currentGameInfo != null)
{
await responseStream.WriteAsync(currentGameInfo);
@@ -80,44 +79,42 @@ namespace Server
1000,
() =>
{
- ReportGame(); // 最后发一次消息,唤醒发消息的线程,防止发消息的线程由于有概率处在 Wait 状态而卡住
- return 0;
+ ReportGame(); // 最后发一次消息,唤醒发消息的线程,防止发消息的线程由于有概率处在 Wait 状态而卡住
+ return 0;
}
).Start();
- })
+ })
{ IsBackground = true }.Start();
new Thread(() =>
{
waitHandle.Wait();
- this.endGameSem.Release();
- })
+ this.endGameSem.Release();
+ })
{ IsBackground = true }.Start();
+}
+public void WaitForEnd()
+{
+ this.endGameSem.Wait();
+}
- }
- public void WaitForEnd()
- {
- this.endGameSem.Wait();
- }
-
- public void ReportGame()
- {
- currentGameInfo = game.GetCopiedGameInfo();
-
- foreach (var kvp in semaDict)
- {
- kvp.Value.Item1.Release();
- }
+public void ReportGame()
+{
+ currentGameInfo = game.GetCopiedGameInfo();
- foreach (var kvp in semaDict)
- {
- kvp.Value.Item2.Wait();
- }
- }
+ foreach (var kvp in semaDict)
+ {
+ kvp.Value.Item1.Release();
+ }
- public GameServer()
- {
+ foreach (var kvp in semaDict)
+ {
+ kvp.Value.Item2.Wait();
+ }
+}
- }
- }
+public GameServer()
+{
+}
+}
}
\ No newline at end of file
diff --git a/logic/Server/Program.cs b/logic/Server/Program.cs
index 155a97b..080ac4d 100644
--- a/logic/Server/Program.cs
+++ b/logic/Server/Program.cs
@@ -14,8 +14,7 @@ namespace Server
try
{
GameServer gameServer = new();
- Grpc.Core.Server server = new Grpc.Core.Server(new[] { new ChannelOption(ChannelOptions.SoReuseport, 0) })
- {
+ Grpc.Core.Server server = new Grpc.Core.Server(new[] { new ChannelOption(ChannelOptions.SoReuseport, 0) }) {
Services = { AvailableService.BindService(gameServer) },
Ports = { new ServerPort("0.0.0.0", 8888, ServerCredentials.Insecure) }
};
diff --git a/logic/Server/Server.csproj b/logic/Server/Server.csproj
index b87aa89..62045cf 100644
--- a/logic/Server/Server.csproj
+++ b/logic/Server/Server.csproj
@@ -19,7 +19,7 @@
-
+
diff --git a/logic/logic.sln b/logic/logic.sln
index 2fc1991..d95a3b7 100644
--- a/logic/logic.sln
+++ b/logic/logic.sln
@@ -5,9 +5,9 @@ VisualStudioVersion = 17.0.32014.148
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Server", "Server\Server.csproj", "{D033B809-2FB7-4340-B8B4-DDA30D6CA6FF}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Protos", "Protos\Protos.csproj", "{EA81EE05-A0E3-4D3E-8D7A-C5CD0C9255CD}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClientTest", "ClientTest\ClientTest.csproj", "{F3C98717-DD4F-45B8-B0F0-C217E7E2B5D4}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClientTest", "ClientTest\ClientTest.csproj", "{F3C98717-DD4F-45B8-B0F0-C217E7E2B5D4}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Protos", "..\dependency\proto\Protos.csproj", "{9ADA1EF8-DF2F-4C2E-9DE2-BC94DF89B44D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -19,14 +19,14 @@ Global
{D033B809-2FB7-4340-B8B4-DDA30D6CA6FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D033B809-2FB7-4340-B8B4-DDA30D6CA6FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D033B809-2FB7-4340-B8B4-DDA30D6CA6FF}.Release|Any CPU.Build.0 = Release|Any CPU
- {EA81EE05-A0E3-4D3E-8D7A-C5CD0C9255CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {EA81EE05-A0E3-4D3E-8D7A-C5CD0C9255CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {EA81EE05-A0E3-4D3E-8D7A-C5CD0C9255CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {EA81EE05-A0E3-4D3E-8D7A-C5CD0C9255CD}.Release|Any CPU.Build.0 = Release|Any CPU
{F3C98717-DD4F-45B8-B0F0-C217E7E2B5D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F3C98717-DD4F-45B8-B0F0-C217E7E2B5D4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F3C98717-DD4F-45B8-B0F0-C217E7E2B5D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F3C98717-DD4F-45B8-B0F0-C217E7E2B5D4}.Release|Any CPU.Build.0 = Release|Any CPU
+ {9ADA1EF8-DF2F-4C2E-9DE2-BC94DF89B44D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9ADA1EF8-DF2F-4C2E-9DE2-BC94DF89B44D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9ADA1EF8-DF2F-4C2E-9DE2-BC94DF89B44D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9ADA1EF8-DF2F-4C2E-9DE2-BC94DF89B44D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
From ccf74413d859a25bd1e79682a6a3e4537d83d200 Mon Sep 17 00:00:00 2001
From: DragonAura
Date: Sat, 19 Nov 2022 23:01:23 +0800
Subject: [PATCH 07/16] feat(proto): :sparkles: add human status enum
---
CAPI/proto/Message2Clients.pb.cc | 84 +--
CAPI/proto/Message2Clients.pb.h | 78 +--
CAPI/proto/MessageType.pb.cc | 57 +-
CAPI/proto/MessageType.pb.h | 42 ++
CAPI/proto/Services.grpc.pb.cc | 204 +++++--
CAPI/proto/Services.grpc.pb.h | 771 ++++++++++++++++++++-----
CAPI/proto/Services.pb.cc | 27 +-
dependency/proto/Message2Clients.proto | 3 +-
dependency/proto/MessageType.proto | 10 +
dependency/proto/Services.proto | 6 +-
10 files changed, 951 insertions(+), 331 deletions(-)
diff --git a/CAPI/proto/Message2Clients.pb.cc b/CAPI/proto/Message2Clients.pb.cc
index b4ccac1..51b174f 100644
--- a/CAPI/proto/Message2Clients.pb.cc
+++ b/CAPI/proto/Message2Clients.pb.cc
@@ -26,7 +26,7 @@ namespace protobuf
::_pbi::ConstantInitialized
) :
_impl_{
- /*decltype(_impl_.buff_)*/ {}, /*decltype(_impl_._buff_cached_byte_size_)*/ {0}, /*decltype(_impl_.x_)*/ 0, /*decltype(_impl_.y_)*/ 0, /*decltype(_impl_.speed_)*/ 0, /*decltype(_impl_.life_)*/ 0, /*decltype(_impl_.time_until_skill_available_)*/ 0, /*decltype(_impl_.hanged_time_)*/ 0, /*decltype(_impl_.place_)*/ 0, /*decltype(_impl_.prop_)*/ 0, /*decltype(_impl_.human_type_)*/ 0, /*decltype(_impl_.guid_)*/ int64_t{0}, /*decltype(_impl_.chair_time_)*/ 0, /*decltype(_impl_.on_chair_)*/ false, /*decltype(_impl_.on_ground_)*/ false, /*decltype(_impl_.view_range_)*/ 0, /*decltype(_impl_.ground_time_)*/ 0, /*decltype(_impl_.player_id_)*/ int64_t{0}, /*decltype(_impl_.radius_)*/ 0, /*decltype(_impl_._cached_size_)*/ {}}
+ /*decltype(_impl_.buff_)*/ {}, /*decltype(_impl_._buff_cached_byte_size_)*/ {0}, /*decltype(_impl_.x_)*/ 0, /*decltype(_impl_.y_)*/ 0, /*decltype(_impl_.speed_)*/ 0, /*decltype(_impl_.life_)*/ 0, /*decltype(_impl_.time_until_skill_available_)*/ 0, /*decltype(_impl_.hanged_time_)*/ 0, /*decltype(_impl_.place_)*/ 0, /*decltype(_impl_.prop_)*/ 0, /*decltype(_impl_.human_type_)*/ 0, /*decltype(_impl_.guid_)*/ int64_t{0}, /*decltype(_impl_.chair_time_)*/ 0, /*decltype(_impl_.state_)*/ 0, /*decltype(_impl_.view_range_)*/ 0, /*decltype(_impl_.ground_time_)*/ 0, /*decltype(_impl_.player_id_)*/ int64_t{0}, /*decltype(_impl_.radius_)*/ 0, /*decltype(_impl_._cached_size_)*/ {}}
{
}
struct MessageOfHumanDefaultTypeInternal
@@ -264,9 +264,8 @@ const uint32_t TableStruct_Message2Clients_2eproto::offsets[] PROTOBUF_SECTION_V
PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfHuman, _impl_.prop_),
PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfHuman, _impl_.human_type_),
PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfHuman, _impl_.guid_),
- PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfHuman, _impl_.on_chair_),
+ PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfHuman, _impl_.state_),
PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfHuman, _impl_.chair_time_),
- PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfHuman, _impl_.on_ground_),
PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfHuman, _impl_.ground_time_),
PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfHuman, _impl_.player_id_),
PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfHuman, _impl_.view_range_),
@@ -369,15 +368,15 @@ const uint32_t TableStruct_Message2Clients_2eproto::offsets[] PROTOBUF_SECTION_V
};
static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
{0, -1, -1, sizeof(::protobuf::MessageOfHuman)},
- {24, -1, -1, sizeof(::protobuf::MessageOfButcher)},
- {44, -1, -1, sizeof(::protobuf::MessageOfProp)},
- {58, -1, -1, sizeof(::protobuf::MessageOfPickedProp)},
- {69, -1, -1, sizeof(::protobuf::MessageOfMap_Row)},
- {76, -1, -1, sizeof(::protobuf::MessageOfMap)},
- {83, -1, -1, sizeof(::protobuf::MessageToClient)},
- {93, -1, -1, sizeof(::protobuf::MoveRes)},
- {102, -1, -1, sizeof(::protobuf::BoolRes)},
- {109, -1, -1, sizeof(::protobuf::MsgRes)},
+ {23, -1, -1, sizeof(::protobuf::MessageOfButcher)},
+ {43, -1, -1, sizeof(::protobuf::MessageOfProp)},
+ {57, -1, -1, sizeof(::protobuf::MessageOfPickedProp)},
+ {68, -1, -1, sizeof(::protobuf::MessageOfMap_Row)},
+ {75, -1, -1, sizeof(::protobuf::MessageOfMap)},
+ {82, -1, -1, sizeof(::protobuf::MessageToClient)},
+ {92, -1, -1, sizeof(::protobuf::MoveRes)},
+ {101, -1, -1, sizeof(::protobuf::BoolRes)},
+ {108, -1, -1, sizeof(::protobuf::MsgRes)},
};
static const ::_pb::Message* const file_default_instances[] = {
@@ -401,9 +400,9 @@ const char descriptor_table_protodef_Message2Clients_2eproto[] PROTOBUF_SECTION_
"ill_available\030\006 \001(\001\022\"\n\005place\030\007 \001(\0162\023.pro"
"tobuf.PlaceType\022 \n\004prop\030\010 \001(\0162\022.protobuf"
".PropType\022\'\n\nhuman_type\030\t \001(\0162\023.protobuf"
- ".HumanType\022\014\n\004guid\030\n \001(\003\022\020\n\010on_chair\030\013 \001"
- "(\010\022\022\n\nchair_time\030\014 \001(\001\022\021\n\ton_ground\030\r \001("
- "\010\022\023\n\013ground_time\030\016 \001(\001\022\021\n\tplayer_id\030\017 \001("
+ ".HumanType\022\014\n\004guid\030\n \001(\003\022#\n\005state\030\013 \001(\0162"
+ "\024.protobuf.HumanState\022\022\n\nchair_time\030\014 \001("
+ "\001\022\023\n\013ground_time\030\016 \001(\001\022\021\n\tplayer_id\030\017 \001("
"\003\022\022\n\nview_range\030\020 \001(\005\022\016\n\006radius\030\021 \001(\005\022%\n"
"\004buff\030\022 \003(\0162\027.protobuf.HumanBuffType\"\335\002\n"
"\020MessageOfButcher\022\t\n\001x\030\001 \001(\005\022\t\n\001y\030\002 \001(\005\022"
@@ -486,7 +485,7 @@ namespace protobuf
MessageOfHuman* const _this = this;
(void)_this;
new (&_impl_) Impl_{
- decltype(_impl_.buff_){from._impl_.buff_}, /*decltype(_impl_._buff_cached_byte_size_)*/ {0}, decltype(_impl_.x_){}, decltype(_impl_.y_){}, decltype(_impl_.speed_){}, decltype(_impl_.life_){}, decltype(_impl_.time_until_skill_available_){}, decltype(_impl_.hanged_time_){}, decltype(_impl_.place_){}, decltype(_impl_.prop_){}, decltype(_impl_.human_type_){}, decltype(_impl_.guid_){}, decltype(_impl_.chair_time_){}, decltype(_impl_.on_chair_){}, decltype(_impl_.on_ground_){}, decltype(_impl_.view_range_){}, decltype(_impl_.ground_time_){}, decltype(_impl_.player_id_){}, decltype(_impl_.radius_){}, /*decltype(_impl_._cached_size_)*/ {}};
+ decltype(_impl_.buff_){from._impl_.buff_}, /*decltype(_impl_._buff_cached_byte_size_)*/ {0}, decltype(_impl_.x_){}, decltype(_impl_.y_){}, decltype(_impl_.speed_){}, decltype(_impl_.life_){}, decltype(_impl_.time_until_skill_available_){}, decltype(_impl_.hanged_time_){}, decltype(_impl_.place_){}, decltype(_impl_.prop_){}, decltype(_impl_.human_type_){}, decltype(_impl_.guid_){}, decltype(_impl_.chair_time_){}, decltype(_impl_.state_){}, decltype(_impl_.view_range_){}, decltype(_impl_.ground_time_){}, decltype(_impl_.player_id_){}, decltype(_impl_.radius_){}, /*decltype(_impl_._cached_size_)*/ {}};
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
::memcpy(&_impl_.x_, &from._impl_.x_, static_cast(reinterpret_cast(&_impl_.radius_) - reinterpret_cast(&_impl_.x_)) + sizeof(_impl_.radius_));
@@ -500,7 +499,7 @@ namespace protobuf
(void)arena;
(void)is_message_owned;
new (&_impl_) Impl_{
- decltype(_impl_.buff_){arena}, /*decltype(_impl_._buff_cached_byte_size_)*/ {0}, decltype(_impl_.x_){0}, decltype(_impl_.y_){0}, decltype(_impl_.speed_){0}, decltype(_impl_.life_){0}, decltype(_impl_.time_until_skill_available_){0}, decltype(_impl_.hanged_time_){0}, decltype(_impl_.place_){0}, decltype(_impl_.prop_){0}, decltype(_impl_.human_type_){0}, decltype(_impl_.guid_){int64_t{0}}, decltype(_impl_.chair_time_){0}, decltype(_impl_.on_chair_){false}, decltype(_impl_.on_ground_){false}, decltype(_impl_.view_range_){0}, decltype(_impl_.ground_time_){0}, decltype(_impl_.player_id_){int64_t{0}}, decltype(_impl_.radius_){0}, /*decltype(_impl_._cached_size_)*/ {}};
+ decltype(_impl_.buff_){arena}, /*decltype(_impl_._buff_cached_byte_size_)*/ {0}, decltype(_impl_.x_){0}, decltype(_impl_.y_){0}, decltype(_impl_.speed_){0}, decltype(_impl_.life_){0}, decltype(_impl_.time_until_skill_available_){0}, decltype(_impl_.hanged_time_){0}, decltype(_impl_.place_){0}, decltype(_impl_.prop_){0}, decltype(_impl_.human_type_){0}, decltype(_impl_.guid_){int64_t{0}}, decltype(_impl_.chair_time_){0}, decltype(_impl_.state_){0}, decltype(_impl_.view_range_){0}, decltype(_impl_.ground_time_){0}, decltype(_impl_.player_id_){int64_t{0}}, decltype(_impl_.radius_){0}, /*decltype(_impl_._cached_size_)*/ {}};
}
MessageOfHuman::~MessageOfHuman()
@@ -651,12 +650,13 @@ namespace protobuf
else
goto handle_unusual;
continue;
- // bool on_chair = 11;
+ // .protobuf.HumanState state = 11;
case 11:
if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 88))
{
- _impl_.on_chair_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+ uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
+ _internal_set_state(static_cast<::protobuf::HumanState>(val));
}
else
goto handle_unusual;
@@ -671,16 +671,6 @@ namespace protobuf
else
goto handle_unusual;
continue;
- // bool on_ground = 13;
- case 13:
- if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 104))
- {
- _impl_.on_ground_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
- CHK_(ptr);
- }
- else
- goto handle_unusual;
- continue;
// double ground_time = 14;
case 14:
if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 113))
@@ -851,11 +841,13 @@ namespace protobuf
target = ::_pbi::WireFormatLite::WriteInt64ToArray(10, this->_internal_guid(), target);
}
- // bool on_chair = 11;
- if (this->_internal_on_chair() != 0)
+ // .protobuf.HumanState state = 11;
+ if (this->_internal_state() != 0)
{
target = stream->EnsureSpace(target);
- target = ::_pbi::WireFormatLite::WriteBoolToArray(11, this->_internal_on_chair(), target);
+ target = ::_pbi::WireFormatLite::WriteEnumToArray(
+ 11, this->_internal_state(), target
+ );
}
// double chair_time = 12;
@@ -869,13 +861,6 @@ namespace protobuf
target = ::_pbi::WireFormatLite::WriteDoubleToArray(12, this->_internal_chair_time(), target);
}
- // bool on_ground = 13;
- if (this->_internal_on_ground() != 0)
- {
- target = stream->EnsureSpace(target);
- target = ::_pbi::WireFormatLite::WriteBoolToArray(13, this->_internal_on_ground(), target);
- }
-
// double ground_time = 14;
static_assert(sizeof(uint64_t) == sizeof(double), "Code assumes uint64_t and double are the same size.");
double tmp_ground_time = this->_internal_ground_time();
@@ -1035,16 +1020,11 @@ namespace protobuf
total_size += 1 + 8;
}
- // bool on_chair = 11;
- if (this->_internal_on_chair() != 0)
+ // .protobuf.HumanState state = 11;
+ if (this->_internal_state() != 0)
{
- total_size += 1 + 1;
- }
-
- // bool on_ground = 13;
- if (this->_internal_on_ground() != 0)
- {
- total_size += 1 + 1;
+ total_size += 1 +
+ ::_pbi::WireFormatLite::EnumSize(this->_internal_state());
}
// int32 view_range = 16;
@@ -1154,13 +1134,9 @@ namespace protobuf
{
_this->_internal_set_chair_time(from._internal_chair_time());
}
- if (from._internal_on_chair() != 0)
- {
- _this->_internal_set_on_chair(from._internal_on_chair());
- }
- if (from._internal_on_ground() != 0)
+ if (from._internal_state() != 0)
{
- _this->_internal_set_on_ground(from._internal_on_ground());
+ _this->_internal_set_state(from._internal_state());
}
if (from._internal_view_range() != 0)
{
diff --git a/CAPI/proto/Message2Clients.pb.h b/CAPI/proto/Message2Clients.pb.h
index 6585fad..dba5aca 100644
--- a/CAPI/proto/Message2Clients.pb.h
+++ b/CAPI/proto/Message2Clients.pb.h
@@ -277,8 +277,7 @@ namespace protobuf
kHumanTypeFieldNumber = 9,
kGuidFieldNumber = 10,
kChairTimeFieldNumber = 12,
- kOnChairFieldNumber = 11,
- kOnGroundFieldNumber = 13,
+ kStateFieldNumber = 11,
kViewRangeFieldNumber = 16,
kGroundTimeFieldNumber = 14,
kPlayerIdFieldNumber = 15,
@@ -415,24 +414,14 @@ namespace protobuf
void _internal_set_chair_time(double value);
public:
- // bool on_chair = 11;
- void clear_on_chair();
- bool on_chair() const;
- void set_on_chair(bool value);
+ // .protobuf.HumanState state = 11;
+ void clear_state();
+ ::protobuf::HumanState state() const;
+ void set_state(::protobuf::HumanState value);
private:
- bool _internal_on_chair() const;
- void _internal_set_on_chair(bool value);
-
- public:
- // bool on_ground = 13;
- void clear_on_ground();
- bool on_ground() const;
- void set_on_ground(bool value);
-
- private:
- bool _internal_on_ground() const;
- void _internal_set_on_ground(bool value);
+ ::protobuf::HumanState _internal_state() const;
+ void _internal_set_state(::protobuf::HumanState value);
public:
// int32 view_range = 16;
@@ -499,8 +488,7 @@ namespace protobuf
int human_type_;
int64_t guid_;
double chair_time_;
- bool on_chair_;
- bool on_ground_;
+ int state_;
int32_t view_range_;
double ground_time_;
int64_t player_id_;
@@ -2955,28 +2943,28 @@ namespace protobuf
// @@protoc_insertion_point(field_set:protobuf.MessageOfHuman.guid)
}
- // bool on_chair = 11;
- inline void MessageOfHuman::clear_on_chair()
+ // .protobuf.HumanState state = 11;
+ inline void MessageOfHuman::clear_state()
{
- _impl_.on_chair_ = false;
+ _impl_.state_ = 0;
}
- inline bool MessageOfHuman::_internal_on_chair() const
+ inline ::protobuf::HumanState MessageOfHuman::_internal_state() const
{
- return _impl_.on_chair_;
+ return static_cast<::protobuf::HumanState>(_impl_.state_);
}
- inline bool MessageOfHuman::on_chair() const
+ inline ::protobuf::HumanState MessageOfHuman::state() const
{
- // @@protoc_insertion_point(field_get:protobuf.MessageOfHuman.on_chair)
- return _internal_on_chair();
+ // @@protoc_insertion_point(field_get:protobuf.MessageOfHuman.state)
+ return _internal_state();
}
- inline void MessageOfHuman::_internal_set_on_chair(bool value)
+ inline void MessageOfHuman::_internal_set_state(::protobuf::HumanState value)
{
- _impl_.on_chair_ = value;
+ _impl_.state_ = value;
}
- inline void MessageOfHuman::set_on_chair(bool value)
+ inline void MessageOfHuman::set_state(::protobuf::HumanState value)
{
- _internal_set_on_chair(value);
- // @@protoc_insertion_point(field_set:protobuf.MessageOfHuman.on_chair)
+ _internal_set_state(value);
+ // @@protoc_insertion_point(field_set:protobuf.MessageOfHuman.state)
}
// double chair_time = 12;
@@ -3003,30 +2991,6 @@ namespace protobuf
// @@protoc_insertion_point(field_set:protobuf.MessageOfHuman.chair_time)
}
- // bool on_ground = 13;
- inline void MessageOfHuman::clear_on_ground()
- {
- _impl_.on_ground_ = false;
- }
- inline bool MessageOfHuman::_internal_on_ground() const
- {
- return _impl_.on_ground_;
- }
- inline bool MessageOfHuman::on_ground() const
- {
- // @@protoc_insertion_point(field_get:protobuf.MessageOfHuman.on_ground)
- return _internal_on_ground();
- }
- inline void MessageOfHuman::_internal_set_on_ground(bool value)
- {
- _impl_.on_ground_ = value;
- }
- inline void MessageOfHuman::set_on_ground(bool value)
- {
- _internal_set_on_ground(value);
- // @@protoc_insertion_point(field_set:protobuf.MessageOfHuman.on_ground)
- }
-
// double ground_time = 14;
inline void MessageOfHuman::clear_ground_time()
{
diff --git a/CAPI/proto/MessageType.pb.cc b/CAPI/proto/MessageType.pb.cc
index 4386d9d..b5fe3d7 100644
--- a/CAPI/proto/MessageType.pb.cc
+++ b/CAPI/proto/MessageType.pb.cc
@@ -23,7 +23,7 @@ namespace _pbi = _pb::internal;
namespace protobuf
{
} // namespace protobuf
-static const ::_pb::EnumDescriptor* file_level_enum_descriptors_MessageType_2eproto[8];
+static const ::_pb::EnumDescriptor* file_level_enum_descriptors_MessageType_2eproto[9];
static constexpr ::_pb::ServiceDescriptor const** file_level_service_descriptors_MessageType_2eproto = nullptr;
const uint32_t TableStruct_MessageType_2eproto::offsets[1] = {};
static constexpr ::_pbi::MigrationSchema* schemas = nullptr;
@@ -39,22 +39,24 @@ const char descriptor_table_protodef_MessageType_2eproto[] PROTOBUF_SECTION_VARI
"PTYPE2\020\002\022\n\n\006PTYPE3\020\003\022\n\n\006PTYPE4\020\004*d\n\rHuma"
"nBuffType\022\023\n\017NULL_HBUFF_TYPE\020\000\022\016\n\nHBUFFT"
"YPE1\020\001\022\016\n\nHBUFFTYPE2\020\002\022\016\n\nHBUFFTYPE3\020\003\022\016"
- "\n\nHBUFFTYPE4\020\004*f\n\017ButcherBuffType\022\023\n\017NUL"
- "L_BBUFF_TYPE\020\000\022\016\n\nBBUFFTYPE1\020\001\022\016\n\nBBUFFT"
- "YPE2\020\002\022\016\n\nBBUFFTYPE3\020\003\022\016\n\nBBUFFTYPE4\020\004*H"
- "\n\nPlayerType\022\024\n\020NULL_PLAYER_TYPE\020\000\022\020\n\014HU"
- "MAN_PLAYER\020\001\022\022\n\016BUTCHER_PLAYER\020\002*`\n\tHuma"
- "nType\022\023\n\017NULL_HUMAN_TYPE\020\000\022\016\n\nHUMANTYPE1"
- "\020\001\022\016\n\nHUMANTYPE2\020\002\022\016\n\nHUMANTYPE3\020\003\022\016\n\nHU"
- "MANTYPE4\020\004*l\n\013ButcherType\022\025\n\021NULL_BUTCHE"
- "R_TYPE\020\000\022\020\n\014BUTCHERTYPE1\020\001\022\020\n\014BUTCHERTYP"
- "E2\020\002\022\020\n\014BUTCHERTYPE3\020\003\022\020\n\014BUTCHERTYPE4\020\004"
- "b\006proto3";
+ "\n\nHBUFFTYPE4\020\004*V\n\nHumanState\022\017\n\013NULL_STA"
+ "TUS\020\000\022\010\n\004IDLE\020\001\022\n\n\006FIXING\020\002\022\t\n\005DYING\020\003\022\014"
+ "\n\010ON_CHAIR\020\004\022\010\n\004DEAD\020\005*f\n\017ButcherBuffTyp"
+ "e\022\023\n\017NULL_BBUFF_TYPE\020\000\022\016\n\nBBUFFTYPE1\020\001\022\016"
+ "\n\nBBUFFTYPE2\020\002\022\016\n\nBBUFFTYPE3\020\003\022\016\n\nBBUFFT"
+ "YPE4\020\004*H\n\nPlayerType\022\024\n\020NULL_PLAYER_TYPE"
+ "\020\000\022\020\n\014HUMAN_PLAYER\020\001\022\022\n\016BUTCHER_PLAYER\020\002"
+ "*`\n\tHumanType\022\023\n\017NULL_HUMAN_TYPE\020\000\022\016\n\nHU"
+ "MANTYPE1\020\001\022\016\n\nHUMANTYPE2\020\002\022\016\n\nHUMANTYPE3"
+ "\020\003\022\016\n\nHUMANTYPE4\020\004*l\n\013ButcherType\022\025\n\021NUL"
+ "L_BUTCHER_TYPE\020\000\022\020\n\014BUTCHERTYPE1\020\001\022\020\n\014BU"
+ "TCHERTYPE2\020\002\022\020\n\014BUTCHERTYPE3\020\003\022\020\n\014BUTCHE"
+ "RTYPE4\020\004b\006proto3";
static ::_pbi::once_flag descriptor_table_MessageType_2eproto_once;
const ::_pbi::DescriptorTable descriptor_table_MessageType_2eproto = {
false,
false,
- 768,
+ 856,
descriptor_table_protodef_MessageType_2eproto,
"MessageType.proto",
&descriptor_table_MessageType_2eproto_once,
@@ -157,11 +159,32 @@ namespace protobuf
}
}
- const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* ButcherBuffType_descriptor()
+ const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* HumanState_descriptor()
{
::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_MessageType_2eproto);
return file_level_enum_descriptors_MessageType_2eproto[4];
}
+ bool HumanState_IsValid(int value)
+ {
+ switch (value)
+ {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* ButcherBuffType_descriptor()
+ {
+ ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_MessageType_2eproto);
+ return file_level_enum_descriptors_MessageType_2eproto[5];
+ }
bool ButcherBuffType_IsValid(int value)
{
switch (value)
@@ -180,7 +203,7 @@ namespace protobuf
const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* PlayerType_descriptor()
{
::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_MessageType_2eproto);
- return file_level_enum_descriptors_MessageType_2eproto[5];
+ return file_level_enum_descriptors_MessageType_2eproto[6];
}
bool PlayerType_IsValid(int value)
{
@@ -198,7 +221,7 @@ namespace protobuf
const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* HumanType_descriptor()
{
::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_MessageType_2eproto);
- return file_level_enum_descriptors_MessageType_2eproto[6];
+ return file_level_enum_descriptors_MessageType_2eproto[7];
}
bool HumanType_IsValid(int value)
{
@@ -218,7 +241,7 @@ namespace protobuf
const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* ButcherType_descriptor()
{
::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_MessageType_2eproto);
- return file_level_enum_descriptors_MessageType_2eproto[7];
+ return file_level_enum_descriptors_MessageType_2eproto[8];
}
bool ButcherType_IsValid(int value)
{
diff --git a/CAPI/proto/MessageType.pb.h b/CAPI/proto/MessageType.pb.h
index 3f01977..3c1d55c 100644
--- a/CAPI/proto/MessageType.pb.h
+++ b/CAPI/proto/MessageType.pb.h
@@ -178,6 +178,39 @@ namespace protobuf
HumanBuffType_descriptor(), name, value
);
}
+ enum HumanState : int
+ {
+ NULL_STATUS = 0,
+ IDLE = 1,
+ FIXING = 2,
+ DYING = 3,
+ ON_CHAIR = 4,
+ DEAD = 5,
+ HumanState_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits::min(),
+ HumanState_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits::max()
+ };
+ bool HumanState_IsValid(int value);
+ constexpr HumanState HumanState_MIN = NULL_STATUS;
+ constexpr HumanState HumanState_MAX = DEAD;
+ constexpr int HumanState_ARRAYSIZE = HumanState_MAX + 1;
+
+ const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* HumanState_descriptor();
+ template
+ inline const std::string& HumanState_Name(T enum_t_value)
+ {
+ static_assert(::std::is_same::value || ::std::is_integral::value, "Incorrect type passed to function HumanState_Name.");
+ return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum(
+ HumanState_descriptor(), enum_t_value
+ );
+ }
+ inline bool HumanState_Parse(
+ ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, HumanState* value
+ )
+ {
+ return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum(
+ HumanState_descriptor(), name, value
+ );
+ }
enum ButcherBuffType : int
{
NULL_BBUFF_TYPE = 0,
@@ -361,6 +394,15 @@ inline const EnumDescriptor* GetEnumDescriptor<::protobuf::HumanBuffType>()
return ::protobuf::HumanBuffType_descriptor();
}
template<>
+struct is_proto_enum<::protobuf::HumanState> : ::std::true_type
+{
+};
+template<>
+inline const EnumDescriptor* GetEnumDescriptor<::protobuf::HumanState>()
+{
+ return ::protobuf::HumanState_descriptor();
+}
+template<>
struct is_proto_enum<::protobuf::ButcherBuffType> : ::std::true_type
{
};
diff --git a/CAPI/proto/Services.grpc.pb.cc b/CAPI/proto/Services.grpc.pb.cc
index 044ca39..b5edb79 100644
--- a/CAPI/proto/Services.grpc.pb.cc
+++ b/CAPI/proto/Services.grpc.pb.cc
@@ -32,8 +32,10 @@ namespace protobuf
"/protobuf.AvailableService/SendMessage",
"/protobuf.AvailableService/HaveMessage",
"/protobuf.AvailableService/GetMessage",
- "/protobuf.AvailableService/FixMachine",
+ "/protobuf.AvailableService/StartFixMachine",
+ "/protobuf.AvailableService/EndFixMachine",
"/protobuf.AvailableService/SaveHuman",
+ "/protobuf.AvailableService/EndSaveHuman",
"/protobuf.AvailableService/Attack",
"/protobuf.AvailableService/CarryHuman",
"/protobuf.AvailableService/ReleaseHuman",
@@ -59,13 +61,15 @@ namespace protobuf
rpcmethod_SendMessage_(AvailableService_method_names[6], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel),
rpcmethod_HaveMessage_(AvailableService_method_names[7], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel),
rpcmethod_GetMessage_(AvailableService_method_names[8], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel),
- rpcmethod_FixMachine_(AvailableService_method_names[9], options.suffix_for_stats(), ::grpc::internal::RpcMethod::BIDI_STREAMING, channel),
- rpcmethod_SaveHuman_(AvailableService_method_names[10], options.suffix_for_stats(), ::grpc::internal::RpcMethod::BIDI_STREAMING, channel),
- rpcmethod_Attack_(AvailableService_method_names[11], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel),
- rpcmethod_CarryHuman_(AvailableService_method_names[12], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel),
- rpcmethod_ReleaseHuman_(AvailableService_method_names[13], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel),
- rpcmethod_HangHuman_(AvailableService_method_names[14], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel),
- rpcmethod_Escape_(AvailableService_method_names[15], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel)
+ rpcmethod_StartFixMachine_(AvailableService_method_names[9], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel),
+ rpcmethod_EndFixMachine_(AvailableService_method_names[10], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel),
+ rpcmethod_SaveHuman_(AvailableService_method_names[11], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel),
+ rpcmethod_EndSaveHuman_(AvailableService_method_names[12], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel),
+ rpcmethod_Attack_(AvailableService_method_names[13], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel),
+ rpcmethod_CarryHuman_(AvailableService_method_names[14], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel),
+ rpcmethod_ReleaseHuman_(AvailableService_method_names[15], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel),
+ rpcmethod_HangHuman_(AvailableService_method_names[16], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel),
+ rpcmethod_Escape_(AvailableService_method_names[17], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel)
{
}
@@ -313,44 +317,116 @@ namespace protobuf
return result;
}
- ::grpc::ClientReaderWriter<::protobuf::IDMsg, ::protobuf::BoolRes>* AvailableService::Stub::FixMachineRaw(::grpc::ClientContext* context)
+ ::grpc::Status AvailableService::Stub::StartFixMachine(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::protobuf::BoolRes* response)
{
- return ::grpc::internal::ClientReaderWriterFactory<::protobuf::IDMsg, ::protobuf::BoolRes>::Create(channel_.get(), rpcmethod_FixMachine_, context);
+ return ::grpc::internal::BlockingUnaryCall<::protobuf::IDMsg, ::protobuf::BoolRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_StartFixMachine_, context, request, response);
}
- void AvailableService::Stub::async::FixMachine(::grpc::ClientContext* context, ::grpc::ClientBidiReactor<::protobuf::IDMsg, ::protobuf::BoolRes>* reactor)
+ void AvailableService::Stub::async::StartFixMachine(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, std::function f)
{
- ::grpc::internal::ClientCallbackReaderWriterFactory<::protobuf::IDMsg, ::protobuf::BoolRes>::Create(stub_->channel_.get(), stub_->rpcmethod_FixMachine_, context, reactor);
+ ::grpc::internal::CallbackUnaryCall<::protobuf::IDMsg, ::protobuf::BoolRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_StartFixMachine_, context, request, response, std::move(f));
}
- ::grpc::ClientAsyncReaderWriter<::protobuf::IDMsg, ::protobuf::BoolRes>* AvailableService::Stub::AsyncFixMachineRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag)
+ void AvailableService::Stub::async::StartFixMachine(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor)
{
- return ::grpc::internal::ClientAsyncReaderWriterFactory<::protobuf::IDMsg, ::protobuf::BoolRes>::Create(channel_.get(), cq, rpcmethod_FixMachine_, context, true, tag);
+ ::grpc::internal::ClientCallbackUnaryFactory::Create<::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_StartFixMachine_, context, request, response, reactor);
}
- ::grpc::ClientAsyncReaderWriter<::protobuf::IDMsg, ::protobuf::BoolRes>* AvailableService::Stub::PrepareAsyncFixMachineRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq)
+ ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AvailableService::Stub::PrepareAsyncStartFixMachineRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq)
{
- return ::grpc::internal::ClientAsyncReaderWriterFactory<::protobuf::IDMsg, ::protobuf::BoolRes>::Create(channel_.get(), cq, rpcmethod_FixMachine_, context, false, nullptr);
+ return ::grpc::internal::ClientAsyncResponseReaderHelper::Create<::protobuf::BoolRes, ::protobuf::IDMsg, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_StartFixMachine_, context, request);
}
- ::grpc::ClientReaderWriter<::protobuf::IDMsg, ::protobuf::BoolRes>* AvailableService::Stub::SaveHumanRaw(::grpc::ClientContext* context)
+ ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AvailableService::Stub::AsyncStartFixMachineRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq)
{
- return ::grpc::internal::ClientReaderWriterFactory<::protobuf::IDMsg, ::protobuf::BoolRes>::Create(channel_.get(), rpcmethod_SaveHuman_, context);
+ auto* result =
+ this->PrepareAsyncStartFixMachineRaw(context, request, cq);
+ result->StartCall();
+ return result;
+ }
+
+ ::grpc::Status AvailableService::Stub::EndFixMachine(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::protobuf::BoolRes* response)
+ {
+ return ::grpc::internal::BlockingUnaryCall<::protobuf::IDMsg, ::protobuf::BoolRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_EndFixMachine_, context, request, response);
+ }
+
+ void AvailableService::Stub::async::EndFixMachine(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, std::function f)
+ {
+ ::grpc::internal::CallbackUnaryCall<::protobuf::IDMsg, ::protobuf::BoolRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_EndFixMachine_, context, request, response, std::move(f));
}
- void AvailableService::Stub::async::SaveHuman(::grpc::ClientContext* context, ::grpc::ClientBidiReactor<::protobuf::IDMsg, ::protobuf::BoolRes>* reactor)
+ void AvailableService::Stub::async::EndFixMachine(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor)
{
- ::grpc::internal::ClientCallbackReaderWriterFactory<::protobuf::IDMsg, ::protobuf::BoolRes>::Create(stub_->channel_.get(), stub_->rpcmethod_SaveHuman_, context, reactor);
+ ::grpc::internal::ClientCallbackUnaryFactory::Create<::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_EndFixMachine_, context, request, response, reactor);
}
- ::grpc::ClientAsyncReaderWriter<::protobuf::IDMsg, ::protobuf::BoolRes>* AvailableService::Stub::AsyncSaveHumanRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag)
+ ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AvailableService::Stub::PrepareAsyncEndFixMachineRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq)
{
- return ::grpc::internal::ClientAsyncReaderWriterFactory<::protobuf::IDMsg, ::protobuf::BoolRes>::Create(channel_.get(), cq, rpcmethod_SaveHuman_, context, true, tag);
+ return ::grpc::internal::ClientAsyncResponseReaderHelper::Create<::protobuf::BoolRes, ::protobuf::IDMsg, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_EndFixMachine_, context, request);
}
- ::grpc::ClientAsyncReaderWriter<::protobuf::IDMsg, ::protobuf::BoolRes>* AvailableService::Stub::PrepareAsyncSaveHumanRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq)
+ ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AvailableService::Stub::AsyncEndFixMachineRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq)
{
- return ::grpc::internal::ClientAsyncReaderWriterFactory<::protobuf::IDMsg, ::protobuf::BoolRes>::Create(channel_.get(), cq, rpcmethod_SaveHuman_, context, false, nullptr);
+ auto* result =
+ this->PrepareAsyncEndFixMachineRaw(context, request, cq);
+ result->StartCall();
+ return result;
+ }
+
+ ::grpc::Status AvailableService::Stub::SaveHuman(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::protobuf::BoolRes* response)
+ {
+ return ::grpc::internal::BlockingUnaryCall<::protobuf::IDMsg, ::protobuf::BoolRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_SaveHuman_, context, request, response);
+ }
+
+ void AvailableService::Stub::async::SaveHuman(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, std::function f)
+ {
+ ::grpc::internal::CallbackUnaryCall<::protobuf::IDMsg, ::protobuf::BoolRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_SaveHuman_, context, request, response, std::move(f));
+ }
+
+ void AvailableService::Stub::async::SaveHuman(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor)
+ {
+ ::grpc::internal::ClientCallbackUnaryFactory::Create<::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_SaveHuman_, context, request, response, reactor);
+ }
+
+ ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AvailableService::Stub::PrepareAsyncSaveHumanRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq)
+ {
+ return ::grpc::internal::ClientAsyncResponseReaderHelper::Create<::protobuf::BoolRes, ::protobuf::IDMsg, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_SaveHuman_, context, request);
+ }
+
+ ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AvailableService::Stub::AsyncSaveHumanRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq)
+ {
+ auto* result =
+ this->PrepareAsyncSaveHumanRaw(context, request, cq);
+ result->StartCall();
+ return result;
+ }
+
+ ::grpc::Status AvailableService::Stub::EndSaveHuman(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::protobuf::BoolRes* response)
+ {
+ return ::grpc::internal::BlockingUnaryCall<::protobuf::IDMsg, ::protobuf::BoolRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_EndSaveHuman_, context, request, response);
+ }
+
+ void AvailableService::Stub::async::EndSaveHuman(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, std::function f)
+ {
+ ::grpc::internal::CallbackUnaryCall<::protobuf::IDMsg, ::protobuf::BoolRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_EndSaveHuman_, context, request, response, std::move(f));
+ }
+
+ void AvailableService::Stub::async::EndSaveHuman(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor)
+ {
+ ::grpc::internal::ClientCallbackUnaryFactory::Create<::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_EndSaveHuman_, context, request, response, reactor);
+ }
+
+ ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AvailableService::Stub::PrepareAsyncEndSaveHumanRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq)
+ {
+ return ::grpc::internal::ClientAsyncResponseReaderHelper::Create<::protobuf::BoolRes, ::protobuf::IDMsg, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_EndSaveHuman_, context, request);
+ }
+
+ ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AvailableService::Stub::AsyncEndSaveHumanRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq)
+ {
+ auto* result =
+ this->PrepareAsyncEndSaveHumanRaw(context, request, cq);
+ result->StartCall();
+ return result;
}
::grpc::Status AvailableService::Stub::Attack(::grpc::ClientContext* context, const ::protobuf::AttackMsg& request, ::protobuf::BoolRes* response)
@@ -623,26 +699,28 @@ namespace protobuf
));
AddMethod(new ::grpc::internal::RpcServiceMethod(
AvailableService_method_names[9],
- ::grpc::internal::RpcMethod::BIDI_STREAMING,
- new ::grpc::internal::BidiStreamingHandler(
+ ::grpc::internal::RpcMethod::NORMAL_RPC,
+ new ::grpc::internal::RpcMethodHandler(
[](AvailableService::Service* service,
::grpc::ServerContext* ctx,
- ::grpc::ServerReaderWriter<::protobuf::BoolRes, ::protobuf::IDMsg>* stream)
+ const ::protobuf::IDMsg* req,
+ ::protobuf::BoolRes* resp)
{
- return service->FixMachine(ctx, stream);
+ return service->StartFixMachine(ctx, req, resp);
},
this
)
));
AddMethod(new ::grpc::internal::RpcServiceMethod(
AvailableService_method_names[10],
- ::grpc::internal::RpcMethod::BIDI_STREAMING,
- new ::grpc::internal::BidiStreamingHandler(
+ ::grpc::internal::RpcMethod::NORMAL_RPC,
+ new ::grpc::internal::RpcMethodHandler(
[](AvailableService::Service* service,
::grpc::ServerContext* ctx,
- ::grpc::ServerReaderWriter<::protobuf::BoolRes, ::protobuf::IDMsg>* stream)
+ const ::protobuf::IDMsg* req,
+ ::protobuf::BoolRes* resp)
{
- return service->SaveHuman(ctx, stream);
+ return service->EndFixMachine(ctx, req, resp);
},
this
)
@@ -650,6 +728,34 @@ namespace protobuf
AddMethod(new ::grpc::internal::RpcServiceMethod(
AvailableService_method_names[11],
::grpc::internal::RpcMethod::NORMAL_RPC,
+ new ::grpc::internal::RpcMethodHandler(
+ [](AvailableService::Service* service,
+ ::grpc::ServerContext* ctx,
+ const ::protobuf::IDMsg* req,
+ ::protobuf::BoolRes* resp)
+ {
+ return service->SaveHuman(ctx, req, resp);
+ },
+ this
+ )
+ ));
+ AddMethod(new ::grpc::internal::RpcServiceMethod(
+ AvailableService_method_names[12],
+ ::grpc::internal::RpcMethod::NORMAL_RPC,
+ new ::grpc::internal::RpcMethodHandler(
+ [](AvailableService::Service* service,
+ ::grpc::ServerContext* ctx,
+ const ::protobuf::IDMsg* req,
+ ::protobuf::BoolRes* resp)
+ {
+ return service->EndSaveHuman(ctx, req, resp);
+ },
+ this
+ )
+ ));
+ AddMethod(new ::grpc::internal::RpcServiceMethod(
+ AvailableService_method_names[13],
+ ::grpc::internal::RpcMethod::NORMAL_RPC,
new ::grpc::internal::RpcMethodHandler(
[](AvailableService::Service* service,
::grpc::ServerContext* ctx,
@@ -662,7 +768,7 @@ namespace protobuf
)
));
AddMethod(new ::grpc::internal::RpcServiceMethod(
- AvailableService_method_names[12],
+ AvailableService_method_names[14],
::grpc::internal::RpcMethod::NORMAL_RPC,
new ::grpc::internal::RpcMethodHandler(
[](AvailableService::Service* service,
@@ -676,7 +782,7 @@ namespace protobuf
)
));
AddMethod(new ::grpc::internal::RpcServiceMethod(
- AvailableService_method_names[13],
+ AvailableService_method_names[15],
::grpc::internal::RpcMethod::NORMAL_RPC,
new ::grpc::internal::RpcMethodHandler(
[](AvailableService::Service* service,
@@ -690,7 +796,7 @@ namespace protobuf
)
));
AddMethod(new ::grpc::internal::RpcServiceMethod(
- AvailableService_method_names[14],
+ AvailableService_method_names[16],
::grpc::internal::RpcMethod::NORMAL_RPC,
new ::grpc::internal::RpcMethodHandler(
[](AvailableService::Service* service,
@@ -704,7 +810,7 @@ namespace protobuf
)
));
AddMethod(new ::grpc::internal::RpcServiceMethod(
- AvailableService_method_names[15],
+ AvailableService_method_names[17],
::grpc::internal::RpcMethod::NORMAL_RPC,
new ::grpc::internal::RpcMethodHandler(
[](AvailableService::Service* service,
@@ -795,17 +901,35 @@ namespace protobuf
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
- ::grpc::Status AvailableService::Service::FixMachine(::grpc::ServerContext* context, ::grpc::ServerReaderWriter<::protobuf::BoolRes, ::protobuf::IDMsg>* stream)
+ ::grpc::Status AvailableService::Service::StartFixMachine(::grpc::ServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response)
+ {
+ (void)context;
+ (void)request;
+ (void)response;
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+
+ ::grpc::Status AvailableService::Service::EndFixMachine(::grpc::ServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response)
{
(void)context;
- (void)stream;
+ (void)request;
+ (void)response;
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
- ::grpc::Status AvailableService::Service::SaveHuman(::grpc::ServerContext* context, ::grpc::ServerReaderWriter<::protobuf::BoolRes, ::protobuf::IDMsg>* stream)
+ ::grpc::Status AvailableService::Service::SaveHuman(::grpc::ServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response)
{
(void)context;
- (void)stream;
+ (void)request;
+ (void)response;
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+
+ ::grpc::Status AvailableService::Service::EndSaveHuman(::grpc::ServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response)
+ {
+ (void)context;
+ (void)request;
+ (void)response;
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
diff --git a/CAPI/proto/Services.grpc.pb.h b/CAPI/proto/Services.grpc.pb.h
index 9b6ecb1..bb709c6 100644
--- a/CAPI/proto/Services.grpc.pb.h
+++ b/CAPI/proto/Services.grpc.pb.h
@@ -128,31 +128,46 @@ namespace protobuf
{
return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::MsgRes>>(PrepareAsyncGetMessageRaw(context, request, cq));
}
- std::unique_ptr<::grpc::ClientReaderWriterInterface<::protobuf::IDMsg, ::protobuf::BoolRes>> FixMachine(::grpc::ClientContext* context)
+ virtual ::grpc::Status StartFixMachine(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::protobuf::BoolRes* response) = 0;
+ std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>> AsyncStartFixMachine(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq)
{
- return std::unique_ptr<::grpc::ClientReaderWriterInterface<::protobuf::IDMsg, ::protobuf::BoolRes>>(FixMachineRaw(context));
+ return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>>(AsyncStartFixMachineRaw(context, request, cq));
}
- std::unique_ptr<::grpc::ClientAsyncReaderWriterInterface<::protobuf::IDMsg, ::protobuf::BoolRes>> AsyncFixMachine(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag)
+ std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>> PrepareAsyncStartFixMachine(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq)
{
- return std::unique_ptr<::grpc::ClientAsyncReaderWriterInterface<::protobuf::IDMsg, ::protobuf::BoolRes>>(AsyncFixMachineRaw(context, cq, tag));
+ return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>>(PrepareAsyncStartFixMachineRaw(context, request, cq));
}
- std::unique_ptr<::grpc::ClientAsyncReaderWriterInterface<::protobuf::IDMsg, ::protobuf::BoolRes>> PrepareAsyncFixMachine(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq)
+ // 开始修理机器
+ virtual ::grpc::Status EndFixMachine(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::protobuf::BoolRes* response) = 0;
+ std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>> AsyncEndFixMachine(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq)
{
- return std::unique_ptr<::grpc::ClientAsyncReaderWriterInterface<::protobuf::IDMsg, ::protobuf::BoolRes>>(PrepareAsyncFixMachineRaw(context, cq));
+ return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>>(AsyncEndFixMachineRaw(context, request, cq));
}
- // 若正常修复且未被打断则返回修复成功,位置错误/被打断则返回修复失败,下同
- std::unique_ptr<::grpc::ClientReaderWriterInterface<::protobuf::IDMsg, ::protobuf::BoolRes>> SaveHuman(::grpc::ClientContext* context)
+ std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>> PrepareAsyncEndFixMachine(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq)
{
- return std::unique_ptr<::grpc::ClientReaderWriterInterface<::protobuf::IDMsg, ::protobuf::BoolRes>>(SaveHumanRaw(context));
+ return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>>(PrepareAsyncEndFixMachineRaw(context, request, cq));
}
- std::unique_ptr<::grpc::ClientAsyncReaderWriterInterface<::protobuf::IDMsg, ::protobuf::BoolRes>> AsyncSaveHuman(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag)
+ // 主动停止修复
+ virtual ::grpc::Status SaveHuman(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::protobuf::BoolRes* response) = 0;
+ std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>> AsyncSaveHuman(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq)
{
- return std::unique_ptr<::grpc::ClientAsyncReaderWriterInterface<::protobuf::IDMsg, ::protobuf::BoolRes>>(AsyncSaveHumanRaw(context, cq, tag));
+ return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>>(AsyncSaveHumanRaw(context, request, cq));
}
- std::unique_ptr<::grpc::ClientAsyncReaderWriterInterface<::protobuf::IDMsg, ::protobuf::BoolRes>> PrepareAsyncSaveHuman(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq)
+ std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>> PrepareAsyncSaveHuman(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq)
{
- return std::unique_ptr<::grpc::ClientAsyncReaderWriterInterface<::protobuf::IDMsg, ::protobuf::BoolRes>>(PrepareAsyncSaveHumanRaw(context, cq));
+ return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>>(PrepareAsyncSaveHumanRaw(context, request, cq));
}
+ // 开始救人
+ virtual ::grpc::Status EndSaveHuman(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::protobuf::BoolRes* response) = 0;
+ std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>> AsyncEndSaveHuman(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq)
+ {
+ return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>>(AsyncEndSaveHumanRaw(context, request, cq));
+ }
+ std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>> PrepareAsyncEndSaveHuman(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq)
+ {
+ return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>>(PrepareAsyncEndSaveHumanRaw(context, request, cq));
+ }
+ // 主动停止救人
virtual ::grpc::Status Attack(::grpc::ClientContext* context, const ::protobuf::AttackMsg& request, ::protobuf::BoolRes* response) = 0;
std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>> AsyncAttack(::grpc::ClientContext* context, const ::protobuf::AttackMsg& request, ::grpc::CompletionQueue* cq)
{
@@ -224,9 +239,18 @@ namespace protobuf
virtual void HaveMessage(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) = 0;
virtual void GetMessage(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::MsgRes* response, std::function) = 0;
virtual void GetMessage(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::MsgRes* response, ::grpc::ClientUnaryReactor* reactor) = 0;
- virtual void FixMachine(::grpc::ClientContext* context, ::grpc::ClientBidiReactor<::protobuf::IDMsg, ::protobuf::BoolRes>* reactor) = 0;
- // 若正常修复且未被打断则返回修复成功,位置错误/被打断则返回修复失败,下同
- virtual void SaveHuman(::grpc::ClientContext* context, ::grpc::ClientBidiReactor<::protobuf::IDMsg, ::protobuf::BoolRes>* reactor) = 0;
+ virtual void StartFixMachine(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, std::function) = 0;
+ virtual void StartFixMachine(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) = 0;
+ // 开始修理机器
+ virtual void EndFixMachine(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, std::function) = 0;
+ virtual void EndFixMachine(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) = 0;
+ // 主动停止修复
+ virtual void SaveHuman(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, std::function) = 0;
+ virtual void SaveHuman(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) = 0;
+ // 开始救人
+ virtual void EndSaveHuman(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, std::function) = 0;
+ virtual void EndSaveHuman(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) = 0;
+ // 主动停止救人
virtual void Attack(::grpc::ClientContext* context, const ::protobuf::AttackMsg* request, ::protobuf::BoolRes* response, std::function) = 0;
virtual void Attack(::grpc::ClientContext* context, const ::protobuf::AttackMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) = 0;
virtual void CarryHuman(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, std::function) = 0;
@@ -268,12 +292,14 @@ namespace protobuf
virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* PrepareAsyncHaveMessageRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) = 0;
virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::MsgRes>* AsyncGetMessageRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) = 0;
virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::MsgRes>* PrepareAsyncGetMessageRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) = 0;
- virtual ::grpc::ClientReaderWriterInterface<::protobuf::IDMsg, ::protobuf::BoolRes>* FixMachineRaw(::grpc::ClientContext* context) = 0;
- virtual ::grpc::ClientAsyncReaderWriterInterface<::protobuf::IDMsg, ::protobuf::BoolRes>* AsyncFixMachineRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) = 0;
- virtual ::grpc::ClientAsyncReaderWriterInterface<::protobuf::IDMsg, ::protobuf::BoolRes>* PrepareAsyncFixMachineRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq) = 0;
- virtual ::grpc::ClientReaderWriterInterface<::protobuf::IDMsg, ::protobuf::BoolRes>* SaveHumanRaw(::grpc::ClientContext* context) = 0;
- virtual ::grpc::ClientAsyncReaderWriterInterface<::protobuf::IDMsg, ::protobuf::BoolRes>* AsyncSaveHumanRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) = 0;
- virtual ::grpc::ClientAsyncReaderWriterInterface<::protobuf::IDMsg, ::protobuf::BoolRes>* PrepareAsyncSaveHumanRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq) = 0;
+ virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* AsyncStartFixMachineRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) = 0;
+ virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* PrepareAsyncStartFixMachineRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) = 0;
+ virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* AsyncEndFixMachineRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) = 0;
+ virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* PrepareAsyncEndFixMachineRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) = 0;
+ virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* AsyncSaveHumanRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) = 0;
+ virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* PrepareAsyncSaveHumanRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) = 0;
+ virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* AsyncEndSaveHumanRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) = 0;
+ virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* PrepareAsyncEndSaveHumanRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) = 0;
virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* AsyncAttackRaw(::grpc::ClientContext* context, const ::protobuf::AttackMsg& request, ::grpc::CompletionQueue* cq) = 0;
virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* PrepareAsyncAttackRaw(::grpc::ClientContext* context, const ::protobuf::AttackMsg& request, ::grpc::CompletionQueue* cq) = 0;
virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* AsyncCarryHumanRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) = 0;
@@ -373,29 +399,41 @@ namespace protobuf
{
return std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::MsgRes>>(PrepareAsyncGetMessageRaw(context, request, cq));
}
- std::unique_ptr<::grpc::ClientReaderWriter<::protobuf::IDMsg, ::protobuf::BoolRes>> FixMachine(::grpc::ClientContext* context)
+ ::grpc::Status StartFixMachine(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::protobuf::BoolRes* response) override;
+ std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>> AsyncStartFixMachine(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq)
+ {
+ return std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>>(AsyncStartFixMachineRaw(context, request, cq));
+ }
+ std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>> PrepareAsyncStartFixMachine(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq)
+ {
+ return std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>>(PrepareAsyncStartFixMachineRaw(context, request, cq));
+ }
+ ::grpc::Status EndFixMachine(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::protobuf::BoolRes* response) override;
+ std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>> AsyncEndFixMachine(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq)
{
- return std::unique_ptr<::grpc::ClientReaderWriter<::protobuf::IDMsg, ::protobuf::BoolRes>>(FixMachineRaw(context));
+ return std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>>(AsyncEndFixMachineRaw(context, request, cq));
}
- std::unique_ptr<::grpc::ClientAsyncReaderWriter<::protobuf::IDMsg, ::protobuf::BoolRes>> AsyncFixMachine(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag)
+ std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>> PrepareAsyncEndFixMachine(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq)
{
- return std::unique_ptr<::grpc::ClientAsyncReaderWriter<::protobuf::IDMsg, ::protobuf::BoolRes>>(AsyncFixMachineRaw(context, cq, tag));
+ return std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>>(PrepareAsyncEndFixMachineRaw(context, request, cq));
}
- std::unique_ptr<::grpc::ClientAsyncReaderWriter<::protobuf::IDMsg, ::protobuf::BoolRes>> PrepareAsyncFixMachine(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq)
+ ::grpc::Status SaveHuman(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::protobuf::BoolRes* response) override;
+ std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>> AsyncSaveHuman(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq)
{
- return std::unique_ptr<::grpc::ClientAsyncReaderWriter<::protobuf::IDMsg, ::protobuf::BoolRes>>(PrepareAsyncFixMachineRaw(context, cq));
+ return std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>>(AsyncSaveHumanRaw(context, request, cq));
}
- std::unique_ptr<::grpc::ClientReaderWriter<::protobuf::IDMsg, ::protobuf::BoolRes>> SaveHuman(::grpc::ClientContext* context)
+ std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>> PrepareAsyncSaveHuman(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq)
{
- return std::unique_ptr<::grpc::ClientReaderWriter<::protobuf::IDMsg, ::protobuf::BoolRes>>(SaveHumanRaw(context));
+ return std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>>(PrepareAsyncSaveHumanRaw(context, request, cq));
}
- std::unique_ptr<::grpc::ClientAsyncReaderWriter<::protobuf::IDMsg, ::protobuf::BoolRes>> AsyncSaveHuman(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag)
+ ::grpc::Status EndSaveHuman(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::protobuf::BoolRes* response) override;
+ std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>> AsyncEndSaveHuman(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq)
{
- return std::unique_ptr<::grpc::ClientAsyncReaderWriter<::protobuf::IDMsg, ::protobuf::BoolRes>>(AsyncSaveHumanRaw(context, cq, tag));
+ return std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>>(AsyncEndSaveHumanRaw(context, request, cq));
}
- std::unique_ptr<::grpc::ClientAsyncReaderWriter<::protobuf::IDMsg, ::protobuf::BoolRes>> PrepareAsyncSaveHuman(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq)
+ std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>> PrepareAsyncEndSaveHuman(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq)
{
- return std::unique_ptr<::grpc::ClientAsyncReaderWriter<::protobuf::IDMsg, ::protobuf::BoolRes>>(PrepareAsyncSaveHumanRaw(context, cq));
+ return std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>>(PrepareAsyncEndSaveHumanRaw(context, request, cq));
}
::grpc::Status Attack(::grpc::ClientContext* context, const ::protobuf::AttackMsg& request, ::protobuf::BoolRes* response) override;
std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>> AsyncAttack(::grpc::ClientContext* context, const ::protobuf::AttackMsg& request, ::grpc::CompletionQueue* cq)
@@ -463,8 +501,14 @@ namespace protobuf
void HaveMessage(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) override;
void GetMessage(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::MsgRes* response, std::function) override;
void GetMessage(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::MsgRes* response, ::grpc::ClientUnaryReactor* reactor) override;
- void FixMachine(::grpc::ClientContext* context, ::grpc::ClientBidiReactor<::protobuf::IDMsg, ::protobuf::BoolRes>* reactor) override;
- void SaveHuman(::grpc::ClientContext* context, ::grpc::ClientBidiReactor<::protobuf::IDMsg, ::protobuf::BoolRes>* reactor) override;
+ void StartFixMachine(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, std::function) override;
+ void StartFixMachine(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) override;
+ void EndFixMachine(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, std::function) override;
+ void EndFixMachine(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) override;
+ void SaveHuman(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, std::function) override;
+ void SaveHuman(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) override;
+ void EndSaveHuman(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, std::function) override;
+ void EndSaveHuman(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) override;
void Attack(::grpc::ClientContext* context, const ::protobuf::AttackMsg* request, ::protobuf::BoolRes* response, std::function) override;
void Attack(::grpc::ClientContext* context, const ::protobuf::AttackMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) override;
void CarryHuman(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, std::function) override;
@@ -518,12 +562,14 @@ namespace protobuf
::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* PrepareAsyncHaveMessageRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override;
::grpc::ClientAsyncResponseReader<::protobuf::MsgRes>* AsyncGetMessageRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override;
::grpc::ClientAsyncResponseReader<::protobuf::MsgRes>* PrepareAsyncGetMessageRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override;
- ::grpc::ClientReaderWriter<::protobuf::IDMsg, ::protobuf::BoolRes>* FixMachineRaw(::grpc::ClientContext* context) override;
- ::grpc::ClientAsyncReaderWriter<::protobuf::IDMsg, ::protobuf::BoolRes>* AsyncFixMachineRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) override;
- ::grpc::ClientAsyncReaderWriter<::protobuf::IDMsg, ::protobuf::BoolRes>* PrepareAsyncFixMachineRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq) override;
- ::grpc::ClientReaderWriter<::protobuf::IDMsg, ::protobuf::BoolRes>* SaveHumanRaw(::grpc::ClientContext* context) override;
- ::grpc::ClientAsyncReaderWriter<::protobuf::IDMsg, ::protobuf::BoolRes>* AsyncSaveHumanRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) override;
- ::grpc::ClientAsyncReaderWriter<::protobuf::IDMsg, ::protobuf::BoolRes>* PrepareAsyncSaveHumanRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq) override;
+ ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AsyncStartFixMachineRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override;
+ ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* PrepareAsyncStartFixMachineRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override;
+ ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AsyncEndFixMachineRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override;
+ ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* PrepareAsyncEndFixMachineRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override;
+ ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AsyncSaveHumanRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override;
+ ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* PrepareAsyncSaveHumanRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override;
+ ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AsyncEndSaveHumanRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override;
+ ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* PrepareAsyncEndSaveHumanRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override;
::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AsyncAttackRaw(::grpc::ClientContext* context, const ::protobuf::AttackMsg& request, ::grpc::CompletionQueue* cq) override;
::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* PrepareAsyncAttackRaw(::grpc::ClientContext* context, const ::protobuf::AttackMsg& request, ::grpc::CompletionQueue* cq) override;
::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AsyncCarryHumanRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override;
@@ -543,8 +589,10 @@ namespace protobuf
const ::grpc::internal::RpcMethod rpcmethod_SendMessage_;
const ::grpc::internal::RpcMethod rpcmethod_HaveMessage_;
const ::grpc::internal::RpcMethod rpcmethod_GetMessage_;
- const ::grpc::internal::RpcMethod rpcmethod_FixMachine_;
+ const ::grpc::internal::RpcMethod rpcmethod_StartFixMachine_;
+ const ::grpc::internal::RpcMethod rpcmethod_EndFixMachine_;
const ::grpc::internal::RpcMethod rpcmethod_SaveHuman_;
+ const ::grpc::internal::RpcMethod rpcmethod_EndSaveHuman_;
const ::grpc::internal::RpcMethod rpcmethod_Attack_;
const ::grpc::internal::RpcMethod rpcmethod_CarryHuman_;
const ::grpc::internal::RpcMethod rpcmethod_ReleaseHuman_;
@@ -570,9 +618,14 @@ namespace protobuf
virtual ::grpc::Status SendMessage(::grpc::ServerContext* context, const ::protobuf::SendMsg* request, ::protobuf::BoolRes* response);
virtual ::grpc::Status HaveMessage(::grpc::ServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response);
virtual ::grpc::Status GetMessage(::grpc::ServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::MsgRes* response);
- virtual ::grpc::Status FixMachine(::grpc::ServerContext* context, ::grpc::ServerReaderWriter<::protobuf::BoolRes, ::protobuf::IDMsg>* stream);
- // 若正常修复且未被打断则返回修复成功,位置错误/被打断则返回修复失败,下同
- virtual ::grpc::Status SaveHuman(::grpc::ServerContext* context, ::grpc::ServerReaderWriter<::protobuf::BoolRes, ::protobuf::IDMsg>* stream);
+ virtual ::grpc::Status StartFixMachine(::grpc::ServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response);
+ // 开始修理机器
+ virtual ::grpc::Status EndFixMachine(::grpc::ServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response);
+ // 主动停止修复
+ virtual ::grpc::Status SaveHuman(::grpc::ServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response);
+ // 开始救人
+ virtual ::grpc::Status EndSaveHuman(::grpc::ServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response);
+ // 主动停止救人
virtual ::grpc::Status Attack(::grpc::ServerContext* context, const ::protobuf::AttackMsg* request, ::protobuf::BoolRes* response);
virtual ::grpc::Status CarryHuman(::grpc::ServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response);
virtual ::grpc::Status ReleaseHuman(::grpc::ServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response);
@@ -832,7 +885,7 @@ namespace protobuf
}
};
template
- class WithAsyncMethod_FixMachine : public BaseClass
+ class WithAsyncMethod_StartFixMachine : public BaseClass
{
private:
void BaseClassMustBeDerivedFromService(const Service* /*service*/)
@@ -840,23 +893,51 @@ namespace protobuf
}
public:
- WithAsyncMethod_FixMachine()
+ WithAsyncMethod_StartFixMachine()
{
::grpc::Service::MarkMethodAsync(9);
}
- ~WithAsyncMethod_FixMachine() override
+ ~WithAsyncMethod_StartFixMachine() override
{
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
- ::grpc::Status FixMachine(::grpc::ServerContext* /*context*/, ::grpc::ServerReaderWriter<::protobuf::BoolRes, ::protobuf::IDMsg>* /*stream*/) override
+ ::grpc::Status StartFixMachine(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override
{
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
- void RequestFixMachine(::grpc::ServerContext* context, ::grpc::ServerAsyncReaderWriter<::protobuf::BoolRes, ::protobuf::IDMsg>* stream, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag)
+ void RequestStartFixMachine(::grpc::ServerContext* context, ::protobuf::IDMsg* request, ::grpc::ServerAsyncResponseWriter<::protobuf::BoolRes>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag)
{
- ::grpc::Service::RequestAsyncBidiStreaming(9, context, stream, new_call_cq, notification_cq, tag);
+ ::grpc::Service::RequestAsyncUnary(9, context, request, response, new_call_cq, notification_cq, tag);
+ }
+ };
+ template
+ class WithAsyncMethod_EndFixMachine : public BaseClass
+ {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service* /*service*/)
+ {
+ }
+
+ public:
+ WithAsyncMethod_EndFixMachine()
+ {
+ ::grpc::Service::MarkMethodAsync(10);
+ }
+ ~WithAsyncMethod_EndFixMachine() override
+ {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status EndFixMachine(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override
+ {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ void RequestEndFixMachine(::grpc::ServerContext* context, ::protobuf::IDMsg* request, ::grpc::ServerAsyncResponseWriter<::protobuf::BoolRes>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag)
+ {
+ ::grpc::Service::RequestAsyncUnary(10, context, request, response, new_call_cq, notification_cq, tag);
}
};
template
@@ -870,21 +951,49 @@ namespace protobuf
public:
WithAsyncMethod_SaveHuman()
{
- ::grpc::Service::MarkMethodAsync(10);
+ ::grpc::Service::MarkMethodAsync(11);
}
~WithAsyncMethod_SaveHuman() override
{
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
- ::grpc::Status SaveHuman(::grpc::ServerContext* /*context*/, ::grpc::ServerReaderWriter<::protobuf::BoolRes, ::protobuf::IDMsg>* /*stream*/) override
+ ::grpc::Status SaveHuman(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override
+ {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ void RequestSaveHuman(::grpc::ServerContext* context, ::protobuf::IDMsg* request, ::grpc::ServerAsyncResponseWriter<::protobuf::BoolRes>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag)
+ {
+ ::grpc::Service::RequestAsyncUnary(11, context, request, response, new_call_cq, notification_cq, tag);
+ }
+ };
+ template
+ class WithAsyncMethod_EndSaveHuman : public BaseClass
+ {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service* /*service*/)
+ {
+ }
+
+ public:
+ WithAsyncMethod_EndSaveHuman()
+ {
+ ::grpc::Service::MarkMethodAsync(12);
+ }
+ ~WithAsyncMethod_EndSaveHuman() override
+ {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status EndSaveHuman(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override
{
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
- void RequestSaveHuman(::grpc::ServerContext* context, ::grpc::ServerAsyncReaderWriter<::protobuf::BoolRes, ::protobuf::IDMsg>* stream, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag)
+ void RequestEndSaveHuman(::grpc::ServerContext* context, ::protobuf::IDMsg* request, ::grpc::ServerAsyncResponseWriter<::protobuf::BoolRes>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag)
{
- ::grpc::Service::RequestAsyncBidiStreaming(10, context, stream, new_call_cq, notification_cq, tag);
+ ::grpc::Service::RequestAsyncUnary(12, context, request, response, new_call_cq, notification_cq, tag);
}
};
template
@@ -898,7 +1007,7 @@ namespace protobuf
public:
WithAsyncMethod_Attack()
{
- ::grpc::Service::MarkMethodAsync(11);
+ ::grpc::Service::MarkMethodAsync(13);
}
~WithAsyncMethod_Attack() override
{
@@ -912,7 +1021,7 @@ namespace protobuf
}
void RequestAttack(::grpc::ServerContext* context, ::protobuf::AttackMsg* request, ::grpc::ServerAsyncResponseWriter<::protobuf::BoolRes>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag)
{
- ::grpc::Service::RequestAsyncUnary(11, context, request, response, new_call_cq, notification_cq, tag);
+ ::grpc::Service::RequestAsyncUnary(13, context, request, response, new_call_cq, notification_cq, tag);
}
};
template
@@ -926,7 +1035,7 @@ namespace protobuf
public:
WithAsyncMethod_CarryHuman()
{
- ::grpc::Service::MarkMethodAsync(12);
+ ::grpc::Service::MarkMethodAsync(14);
}
~WithAsyncMethod_CarryHuman() override
{
@@ -940,7 +1049,7 @@ namespace protobuf
}
void RequestCarryHuman(::grpc::ServerContext* context, ::protobuf::IDMsg* request, ::grpc::ServerAsyncResponseWriter<::protobuf::BoolRes>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag)
{
- ::grpc::Service::RequestAsyncUnary(12, context, request, response, new_call_cq, notification_cq, tag);
+ ::grpc::Service::RequestAsyncUnary(14, context, request, response, new_call_cq, notification_cq, tag);
}
};
template
@@ -954,7 +1063,7 @@ namespace protobuf
public:
WithAsyncMethod_ReleaseHuman()
{
- ::grpc::Service::MarkMethodAsync(13);
+ ::grpc::Service::MarkMethodAsync(15);
}
~WithAsyncMethod_ReleaseHuman() override
{
@@ -968,7 +1077,7 @@ namespace protobuf
}
void RequestReleaseHuman(::grpc::ServerContext* context, ::protobuf::IDMsg* request, ::grpc::ServerAsyncResponseWriter<::protobuf::BoolRes>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag)
{
- ::grpc::Service::RequestAsyncUnary(13, context, request, response, new_call_cq, notification_cq, tag);
+ ::grpc::Service::RequestAsyncUnary(15, context, request, response, new_call_cq, notification_cq, tag);
}
};
template
@@ -982,7 +1091,7 @@ namespace protobuf
public:
WithAsyncMethod_HangHuman()
{
- ::grpc::Service::MarkMethodAsync(14);
+ ::grpc::Service::MarkMethodAsync(16);
}
~WithAsyncMethod_HangHuman() override
{
@@ -996,7 +1105,7 @@ namespace protobuf
}
void RequestHangHuman(::grpc::ServerContext* context, ::protobuf::IDMsg* request, ::grpc::ServerAsyncResponseWriter<::protobuf::BoolRes>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag)
{
- ::grpc::Service::RequestAsyncUnary(14, context, request, response, new_call_cq, notification_cq, tag);
+ ::grpc::Service::RequestAsyncUnary(16, context, request, response, new_call_cq, notification_cq, tag);
}
};
template
@@ -1010,7 +1119,7 @@ namespace protobuf
public:
WithAsyncMethod_Escape()
{
- ::grpc::Service::MarkMethodAsync(15);
+ ::grpc::Service::MarkMethodAsync(17);
}
~WithAsyncMethod_Escape() override
{
@@ -1024,10 +1133,10 @@ namespace protobuf
}
void RequestEscape(::grpc::ServerContext* context, ::protobuf::IDMsg* request, ::grpc::ServerAsyncResponseWriter<::protobuf::BoolRes>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag)
{
- ::grpc::Service::RequestAsyncUnary(15, context, request, response, new_call_cq, notification_cq, tag);
+ ::grpc::Service::RequestAsyncUnary(17, context, request, response, new_call_cq, notification_cq, tag);
}
};
- typedef WithAsyncMethod_TryConnection>>>>>>>>>>>>>>> AsyncService;
+ typedef WithAsyncMethod_TryConnection>>>>>>>>>>>>>>>>> AsyncService;
template
class WithCallbackMethod_TryConnection : public BaseClass
{
@@ -1372,7 +1481,7 @@ namespace protobuf
}
};
template
- class WithCallbackMethod_FixMachine : public BaseClass
+ class WithCallbackMethod_StartFixMachine : public BaseClass
{
private:
void BaseClassMustBeDerivedFromService(const Service* /*service*/)
@@ -1380,23 +1489,70 @@ namespace protobuf
}
public:
- WithCallbackMethod_FixMachine()
+ WithCallbackMethod_StartFixMachine()
{
- ::grpc::Service::MarkMethodCallback(9, new ::grpc::internal::CallbackBidiHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context)
- { return this->FixMachine(context); }));
+ ::grpc::Service::MarkMethodCallback(9, new ::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response)
+ { return this->StartFixMachine(context, request, response); }));
}
- ~WithCallbackMethod_FixMachine() override
+ void SetMessageAllocatorFor_StartFixMachine(
+ ::grpc::MessageAllocator<::protobuf::IDMsg, ::protobuf::BoolRes>* allocator
+ )
+ {
+ ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(9);
+ static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>*>(handler)
+ ->SetMessageAllocator(allocator);
+ }
+ ~WithCallbackMethod_StartFixMachine() override
{
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
- ::grpc::Status FixMachine(::grpc::ServerContext* /*context*/, ::grpc::ServerReaderWriter<::protobuf::BoolRes, ::protobuf::IDMsg>* /*stream*/) override
+ ::grpc::Status StartFixMachine(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override
{
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
- virtual ::grpc::ServerBidiReactor<::protobuf::IDMsg, ::protobuf::BoolRes>* FixMachine(
- ::grpc::CallbackServerContext* /*context*/
+ virtual ::grpc::ServerUnaryReactor* StartFixMachine(
+ ::grpc::CallbackServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/
+ )
+ {
+ return nullptr;
+ }
+ };
+ template
+ class WithCallbackMethod_EndFixMachine : public BaseClass
+ {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service* /*service*/)
+ {
+ }
+
+ public:
+ WithCallbackMethod_EndFixMachine()
+ {
+ ::grpc::Service::MarkMethodCallback(10, new ::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response)
+ { return this->EndFixMachine(context, request, response); }));
+ }
+ void SetMessageAllocatorFor_EndFixMachine(
+ ::grpc::MessageAllocator<::protobuf::IDMsg, ::protobuf::BoolRes>* allocator
+ )
+ {
+ ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(10);
+ static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>*>(handler)
+ ->SetMessageAllocator(allocator);
+ }
+ ~WithCallbackMethod_EndFixMachine() override
+ {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status EndFixMachine(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override
+ {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ virtual ::grpc::ServerUnaryReactor* EndFixMachine(
+ ::grpc::CallbackServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/
)
{
return nullptr;
@@ -1413,21 +1569,68 @@ namespace protobuf
public:
WithCallbackMethod_SaveHuman()
{
- ::grpc::Service::MarkMethodCallback(10, new ::grpc::internal::CallbackBidiHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context)
- { return this->SaveHuman(context); }));
+ ::grpc::Service::MarkMethodCallback(11, new ::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response)
+ { return this->SaveHuman(context, request, response); }));
+ }
+ void SetMessageAllocatorFor_SaveHuman(
+ ::grpc::MessageAllocator<::protobuf::IDMsg, ::protobuf::BoolRes>* allocator
+ )
+ {
+ ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(11);
+ static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>*>(handler)
+ ->SetMessageAllocator(allocator);
}
~WithCallbackMethod_SaveHuman() override
{
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
- ::grpc::Status SaveHuman(::grpc::ServerContext* /*context*/, ::grpc::ServerReaderWriter<::protobuf::BoolRes, ::protobuf::IDMsg>* /*stream*/) override
+ ::grpc::Status SaveHuman(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override
{
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
- virtual ::grpc::ServerBidiReactor<::protobuf::IDMsg, ::protobuf::BoolRes>* SaveHuman(
- ::grpc::CallbackServerContext* /*context*/
+ virtual ::grpc::ServerUnaryReactor* SaveHuman(
+ ::grpc::CallbackServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/
+ )
+ {
+ return nullptr;
+ }
+ };
+ template
+ class WithCallbackMethod_EndSaveHuman : public BaseClass
+ {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service* /*service*/)
+ {
+ }
+
+ public:
+ WithCallbackMethod_EndSaveHuman()
+ {
+ ::grpc::Service::MarkMethodCallback(12, new ::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response)
+ { return this->EndSaveHuman(context, request, response); }));
+ }
+ void SetMessageAllocatorFor_EndSaveHuman(
+ ::grpc::MessageAllocator<::protobuf::IDMsg, ::protobuf::BoolRes>* allocator
+ )
+ {
+ ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(12);
+ static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>*>(handler)
+ ->SetMessageAllocator(allocator);
+ }
+ ~WithCallbackMethod_EndSaveHuman() override
+ {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status EndSaveHuman(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override
+ {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ virtual ::grpc::ServerUnaryReactor* EndSaveHuman(
+ ::grpc::CallbackServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/
)
{
return nullptr;
@@ -1444,14 +1647,14 @@ namespace protobuf
public:
WithCallbackMethod_Attack()
{
- ::grpc::Service::MarkMethodCallback(11, new ::grpc::internal::CallbackUnaryHandler<::protobuf::AttackMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::AttackMsg* request, ::protobuf::BoolRes* response)
+ ::grpc::Service::MarkMethodCallback(13, new ::grpc::internal::CallbackUnaryHandler<::protobuf::AttackMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::AttackMsg* request, ::protobuf::BoolRes* response)
{ return this->Attack(context, request, response); }));
}
void SetMessageAllocatorFor_Attack(
::grpc::MessageAllocator<::protobuf::AttackMsg, ::protobuf::BoolRes>* allocator
)
{
- ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(11);
+ ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(13);
static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::AttackMsg, ::protobuf::BoolRes>*>(handler)
->SetMessageAllocator(allocator);
}
@@ -1483,14 +1686,14 @@ namespace protobuf
public:
WithCallbackMethod_CarryHuman()
{
- ::grpc::Service::MarkMethodCallback(12, new ::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response)
+ ::grpc::Service::MarkMethodCallback(14, new ::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response)
{ return this->CarryHuman(context, request, response); }));
}
void SetMessageAllocatorFor_CarryHuman(
::grpc::MessageAllocator<::protobuf::IDMsg, ::protobuf::BoolRes>* allocator
)
{
- ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(12);
+ ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(14);
static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>*>(handler)
->SetMessageAllocator(allocator);
}
@@ -1522,14 +1725,14 @@ namespace protobuf
public:
WithCallbackMethod_ReleaseHuman()
{
- ::grpc::Service::MarkMethodCallback(13, new ::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response)
+ ::grpc::Service::MarkMethodCallback(15, new ::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response)
{ return this->ReleaseHuman(context, request, response); }));
}
void SetMessageAllocatorFor_ReleaseHuman(
::grpc::MessageAllocator<::protobuf::IDMsg, ::protobuf::BoolRes>* allocator
)
{
- ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(13);
+ ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(15);
static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>*>(handler)
->SetMessageAllocator(allocator);
}
@@ -1561,14 +1764,14 @@ namespace protobuf
public:
WithCallbackMethod_HangHuman()
{
- ::grpc::Service::MarkMethodCallback(14, new ::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response)
+ ::grpc::Service::MarkMethodCallback(16, new ::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response)
{ return this->HangHuman(context, request, response); }));
}
void SetMessageAllocatorFor_HangHuman(
::grpc::MessageAllocator<::protobuf::IDMsg, ::protobuf::BoolRes>* allocator
)
{
- ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(14);
+ ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(16);
static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>*>(handler)
->SetMessageAllocator(allocator);
}
@@ -1600,14 +1803,14 @@ namespace protobuf
public:
WithCallbackMethod_Escape()
{
- ::grpc::Service::MarkMethodCallback(15, new ::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response)
+ ::grpc::Service::MarkMethodCallback(17, new ::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response)
{ return this->Escape(context, request, response); }));
}
void SetMessageAllocatorFor_Escape(
::grpc::MessageAllocator<::protobuf::IDMsg, ::protobuf::BoolRes>* allocator
)
{
- ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(15);
+ ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(17);
static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>*>(handler)
->SetMessageAllocator(allocator);
}
@@ -1628,7 +1831,7 @@ namespace protobuf
return nullptr;
}
};
- typedef WithCallbackMethod_TryConnection>>>>>>>>>>>>>>> CallbackService;
+ typedef WithCallbackMethod_TryConnection>>>>>>>>>>>>>>>>> CallbackService;
typedef CallbackService ExperimentalCallbackService;
template
class WithGenericMethod_TryConnection : public BaseClass
@@ -1847,7 +2050,7 @@ namespace protobuf
}
};
template
- class WithGenericMethod_FixMachine : public BaseClass
+ class WithGenericMethod_StartFixMachine : public BaseClass
{
private:
void BaseClassMustBeDerivedFromService(const Service* /*service*/)
@@ -1855,16 +2058,40 @@ namespace protobuf
}
public:
- WithGenericMethod_FixMachine()
+ WithGenericMethod_StartFixMachine()
{
::grpc::Service::MarkMethodGeneric(9);
}
- ~WithGenericMethod_FixMachine() override
+ ~WithGenericMethod_StartFixMachine() override
+ {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status StartFixMachine(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override
+ {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ };
+ template
+ class WithGenericMethod_EndFixMachine : public BaseClass
+ {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service* /*service*/)
+ {
+ }
+
+ public:
+ WithGenericMethod_EndFixMachine()
+ {
+ ::grpc::Service::MarkMethodGeneric(10);
+ }
+ ~WithGenericMethod_EndFixMachine() override
{
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
- ::grpc::Status FixMachine(::grpc::ServerContext* /*context*/, ::grpc::ServerReaderWriter<::protobuf::BoolRes, ::protobuf::IDMsg>* /*stream*/) override
+ ::grpc::Status EndFixMachine(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override
{
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
@@ -1881,14 +2108,38 @@ namespace protobuf
public:
WithGenericMethod_SaveHuman()
{
- ::grpc::Service::MarkMethodGeneric(10);
+ ::grpc::Service::MarkMethodGeneric(11);
}
~WithGenericMethod_SaveHuman() override
{
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
- ::grpc::Status SaveHuman(::grpc::ServerContext* /*context*/, ::grpc::ServerReaderWriter<::protobuf::BoolRes, ::protobuf::IDMsg>* /*stream*/) override
+ ::grpc::Status SaveHuman(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override
+ {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ };
+ template
+ class WithGenericMethod_EndSaveHuman : public BaseClass
+ {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service* /*service*/)
+ {
+ }
+
+ public:
+ WithGenericMethod_EndSaveHuman()
+ {
+ ::grpc::Service::MarkMethodGeneric(12);
+ }
+ ~WithGenericMethod_EndSaveHuman() override
+ {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status EndSaveHuman(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override
{
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
@@ -1905,7 +2156,7 @@ namespace protobuf
public:
WithGenericMethod_Attack()
{
- ::grpc::Service::MarkMethodGeneric(11);
+ ::grpc::Service::MarkMethodGeneric(13);
}
~WithGenericMethod_Attack() override
{
@@ -1929,7 +2180,7 @@ namespace protobuf
public:
WithGenericMethod_CarryHuman()
{
- ::grpc::Service::MarkMethodGeneric(12);
+ ::grpc::Service::MarkMethodGeneric(14);
}
~WithGenericMethod_CarryHuman() override
{
@@ -1953,7 +2204,7 @@ namespace protobuf
public:
WithGenericMethod_ReleaseHuman()
{
- ::grpc::Service::MarkMethodGeneric(13);
+ ::grpc::Service::MarkMethodGeneric(15);
}
~WithGenericMethod_ReleaseHuman() override
{
@@ -1977,7 +2228,7 @@ namespace protobuf
public:
WithGenericMethod_HangHuman()
{
- ::grpc::Service::MarkMethodGeneric(14);
+ ::grpc::Service::MarkMethodGeneric(16);
}
~WithGenericMethod_HangHuman() override
{
@@ -2001,7 +2252,7 @@ namespace protobuf
public:
WithGenericMethod_Escape()
{
- ::grpc::Service::MarkMethodGeneric(15);
+ ::grpc::Service::MarkMethodGeneric(17);
}
~WithGenericMethod_Escape() override
{
@@ -2267,7 +2518,7 @@ namespace protobuf
}
};
template
- class WithRawMethod_FixMachine : public BaseClass
+ class WithRawMethod_StartFixMachine : public BaseClass
{
private:
void BaseClassMustBeDerivedFromService(const Service* /*service*/)
@@ -2275,23 +2526,51 @@ namespace protobuf
}
public:
- WithRawMethod_FixMachine()
+ WithRawMethod_StartFixMachine()
{
::grpc::Service::MarkMethodRaw(9);
}
- ~WithRawMethod_FixMachine() override
+ ~WithRawMethod_StartFixMachine() override
{
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
- ::grpc::Status FixMachine(::grpc::ServerContext* /*context*/, ::grpc::ServerReaderWriter<::protobuf::BoolRes, ::protobuf::IDMsg>* /*stream*/) override
+ ::grpc::Status StartFixMachine(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override
{
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
- void RequestFixMachine(::grpc::ServerContext* context, ::grpc::ServerAsyncReaderWriter<::grpc::ByteBuffer, ::grpc::ByteBuffer>* stream, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag)
+ void RequestStartFixMachine(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter<::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag)
{
- ::grpc::Service::RequestAsyncBidiStreaming(9, context, stream, new_call_cq, notification_cq, tag);
+ ::grpc::Service::RequestAsyncUnary(9, context, request, response, new_call_cq, notification_cq, tag);
+ }
+ };
+ template
+ class WithRawMethod_EndFixMachine : public BaseClass
+ {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service* /*service*/)
+ {
+ }
+
+ public:
+ WithRawMethod_EndFixMachine()
+ {
+ ::grpc::Service::MarkMethodRaw(10);
+ }
+ ~WithRawMethod_EndFixMachine() override
+ {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status EndFixMachine(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override
+ {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ void RequestEndFixMachine(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter<::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag)
+ {
+ ::grpc::Service::RequestAsyncUnary(10, context, request, response, new_call_cq, notification_cq, tag);
}
};
template
@@ -2305,21 +2584,49 @@ namespace protobuf
public:
WithRawMethod_SaveHuman()
{
- ::grpc::Service::MarkMethodRaw(10);
+ ::grpc::Service::MarkMethodRaw(11);
}
~WithRawMethod_SaveHuman() override
{
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
- ::grpc::Status SaveHuman(::grpc::ServerContext* /*context*/, ::grpc::ServerReaderWriter<::protobuf::BoolRes, ::protobuf::IDMsg>* /*stream*/) override
+ ::grpc::Status SaveHuman(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override
{
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
- void RequestSaveHuman(::grpc::ServerContext* context, ::grpc::ServerAsyncReaderWriter<::grpc::ByteBuffer, ::grpc::ByteBuffer>* stream, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag)
+ void RequestSaveHuman(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter<::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag)
{
- ::grpc::Service::RequestAsyncBidiStreaming(10, context, stream, new_call_cq, notification_cq, tag);
+ ::grpc::Service::RequestAsyncUnary(11, context, request, response, new_call_cq, notification_cq, tag);
+ }
+ };
+ template
+ class WithRawMethod_EndSaveHuman : public BaseClass
+ {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service* /*service*/)
+ {
+ }
+
+ public:
+ WithRawMethod_EndSaveHuman()
+ {
+ ::grpc::Service::MarkMethodRaw(12);
+ }
+ ~WithRawMethod_EndSaveHuman() override
+ {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status EndSaveHuman(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override
+ {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ void RequestEndSaveHuman(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter<::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag)
+ {
+ ::grpc::Service::RequestAsyncUnary(12, context, request, response, new_call_cq, notification_cq, tag);
}
};
template
@@ -2333,7 +2640,7 @@ namespace protobuf
public:
WithRawMethod_Attack()
{
- ::grpc::Service::MarkMethodRaw(11);
+ ::grpc::Service::MarkMethodRaw(13);
}
~WithRawMethod_Attack() override
{
@@ -2347,7 +2654,7 @@ namespace protobuf
}
void RequestAttack(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter<::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag)
{
- ::grpc::Service::RequestAsyncUnary(11, context, request, response, new_call_cq, notification_cq, tag);
+ ::grpc::Service::RequestAsyncUnary(13, context, request, response, new_call_cq, notification_cq, tag);
}
};
template
@@ -2361,7 +2668,7 @@ namespace protobuf
public:
WithRawMethod_CarryHuman()
{
- ::grpc::Service::MarkMethodRaw(12);
+ ::grpc::Service::MarkMethodRaw(14);
}
~WithRawMethod_CarryHuman() override
{
@@ -2375,7 +2682,7 @@ namespace protobuf
}
void RequestCarryHuman(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter<::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag)
{
- ::grpc::Service::RequestAsyncUnary(12, context, request, response, new_call_cq, notification_cq, tag);
+ ::grpc::Service::RequestAsyncUnary(14, context, request, response, new_call_cq, notification_cq, tag);
}
};
template
@@ -2389,7 +2696,7 @@ namespace protobuf
public:
WithRawMethod_ReleaseHuman()
{
- ::grpc::Service::MarkMethodRaw(13);
+ ::grpc::Service::MarkMethodRaw(15);
}
~WithRawMethod_ReleaseHuman() override
{
@@ -2403,7 +2710,7 @@ namespace protobuf
}
void RequestReleaseHuman(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter<::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag)
{
- ::grpc::Service::RequestAsyncUnary(13, context, request, response, new_call_cq, notification_cq, tag);
+ ::grpc::Service::RequestAsyncUnary(15, context, request, response, new_call_cq, notification_cq, tag);
}
};
template
@@ -2417,7 +2724,7 @@ namespace protobuf
public:
WithRawMethod_HangHuman()
{
- ::grpc::Service::MarkMethodRaw(14);
+ ::grpc::Service::MarkMethodRaw(16);
}
~WithRawMethod_HangHuman() override
{
@@ -2431,7 +2738,7 @@ namespace protobuf
}
void RequestHangHuman(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter<::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag)
{
- ::grpc::Service::RequestAsyncUnary(14, context, request, response, new_call_cq, notification_cq, tag);
+ ::grpc::Service::RequestAsyncUnary(16, context, request, response, new_call_cq, notification_cq, tag);
}
};
template
@@ -2445,7 +2752,7 @@ namespace protobuf
public:
WithRawMethod_Escape()
{
- ::grpc::Service::MarkMethodRaw(15);
+ ::grpc::Service::MarkMethodRaw(17);
}
~WithRawMethod_Escape() override
{
@@ -2459,7 +2766,7 @@ namespace protobuf
}
void RequestEscape(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter<::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag)
{
- ::grpc::Service::RequestAsyncUnary(15, context, request, response, new_call_cq, notification_cq, tag);
+ ::grpc::Service::RequestAsyncUnary(17, context, request, response, new_call_cq, notification_cq, tag);
}
};
template
@@ -2742,7 +3049,7 @@ namespace protobuf
}
};
template
- class WithRawCallbackMethod_FixMachine : public BaseClass
+ class WithRawCallbackMethod_StartFixMachine : public BaseClass
{
private:
void BaseClassMustBeDerivedFromService(const Service* /*service*/)
@@ -2750,23 +3057,54 @@ namespace protobuf
}
public:
- WithRawCallbackMethod_FixMachine()
+ WithRawCallbackMethod_StartFixMachine()
{
- ::grpc::Service::MarkMethodRawCallback(9, new ::grpc::internal::CallbackBidiHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context)
- { return this->FixMachine(context); }));
+ ::grpc::Service::MarkMethodRawCallback(9, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response)
+ { return this->StartFixMachine(context, request, response); }));
}
- ~WithRawCallbackMethod_FixMachine() override
+ ~WithRawCallbackMethod_StartFixMachine() override
{
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
- ::grpc::Status FixMachine(::grpc::ServerContext* /*context*/, ::grpc::ServerReaderWriter<::protobuf::BoolRes, ::protobuf::IDMsg>* /*stream*/) override
+ ::grpc::Status StartFixMachine(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override
{
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
- virtual ::grpc::ServerBidiReactor<::grpc::ByteBuffer, ::grpc::ByteBuffer>* FixMachine(
- ::grpc::CallbackServerContext* /*context*/
+ virtual ::grpc::ServerUnaryReactor* StartFixMachine(
+ ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/
+ )
+ {
+ return nullptr;
+ }
+ };
+ template
+ class WithRawCallbackMethod_EndFixMachine : public BaseClass
+ {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service* /*service*/)
+ {
+ }
+
+ public:
+ WithRawCallbackMethod_EndFixMachine()
+ {
+ ::grpc::Service::MarkMethodRawCallback(10, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response)
+ { return this->EndFixMachine(context, request, response); }));
+ }
+ ~WithRawCallbackMethod_EndFixMachine() override
+ {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status EndFixMachine(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override
+ {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ virtual ::grpc::ServerUnaryReactor* EndFixMachine(
+ ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/
)
{
return nullptr;
@@ -2783,21 +3121,52 @@ namespace protobuf
public:
WithRawCallbackMethod_SaveHuman()
{
- ::grpc::Service::MarkMethodRawCallback(10, new ::grpc::internal::CallbackBidiHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context)
- { return this->SaveHuman(context); }));
+ ::grpc::Service::MarkMethodRawCallback(11, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response)
+ { return this->SaveHuman(context, request, response); }));
}
~WithRawCallbackMethod_SaveHuman() override
{
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
- ::grpc::Status SaveHuman(::grpc::ServerContext* /*context*/, ::grpc::ServerReaderWriter<::protobuf::BoolRes, ::protobuf::IDMsg>* /*stream*/) override
+ ::grpc::Status SaveHuman(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override
{
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
- virtual ::grpc::ServerBidiReactor<::grpc::ByteBuffer, ::grpc::ByteBuffer>* SaveHuman(
- ::grpc::CallbackServerContext* /*context*/
+ virtual ::grpc::ServerUnaryReactor* SaveHuman(
+ ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/
+ )
+ {
+ return nullptr;
+ }
+ };
+ template
+ class WithRawCallbackMethod_EndSaveHuman : public BaseClass
+ {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service* /*service*/)
+ {
+ }
+
+ public:
+ WithRawCallbackMethod_EndSaveHuman()
+ {
+ ::grpc::Service::MarkMethodRawCallback(12, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response)
+ { return this->EndSaveHuman(context, request, response); }));
+ }
+ ~WithRawCallbackMethod_EndSaveHuman() override
+ {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status EndSaveHuman(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override
+ {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ virtual ::grpc::ServerUnaryReactor* EndSaveHuman(
+ ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/
)
{
return nullptr;
@@ -2814,7 +3183,7 @@ namespace protobuf
public:
WithRawCallbackMethod_Attack()
{
- ::grpc::Service::MarkMethodRawCallback(11, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response)
+ ::grpc::Service::MarkMethodRawCallback(13, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response)
{ return this->Attack(context, request, response); }));
}
~WithRawCallbackMethod_Attack() override
@@ -2845,7 +3214,7 @@ namespace protobuf
public:
WithRawCallbackMethod_CarryHuman()
{
- ::grpc::Service::MarkMethodRawCallback(12, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response)
+ ::grpc::Service::MarkMethodRawCallback(14, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response)
{ return this->CarryHuman(context, request, response); }));
}
~WithRawCallbackMethod_CarryHuman() override
@@ -2876,7 +3245,7 @@ namespace protobuf
public:
WithRawCallbackMethod_ReleaseHuman()
{
- ::grpc::Service::MarkMethodRawCallback(13, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response)
+ ::grpc::Service::MarkMethodRawCallback(15, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response)
{ return this->ReleaseHuman(context, request, response); }));
}
~WithRawCallbackMethod_ReleaseHuman() override
@@ -2907,7 +3276,7 @@ namespace protobuf
public:
WithRawCallbackMethod_HangHuman()
{
- ::grpc::Service::MarkMethodRawCallback(14, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response)
+ ::grpc::Service::MarkMethodRawCallback(16, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response)
{ return this->HangHuman(context, request, response); }));
}
~WithRawCallbackMethod_HangHuman() override
@@ -2938,7 +3307,7 @@ namespace protobuf
public:
WithRawCallbackMethod_Escape()
{
- ::grpc::Service::MarkMethodRawCallback(15, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response)
+ ::grpc::Service::MarkMethodRawCallback(17, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response)
{ return this->Escape(context, request, response); }));
}
~WithRawCallbackMethod_Escape() override
@@ -3175,6 +3544,114 @@ namespace protobuf
virtual ::grpc::Status StreamedGetMessage(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::MsgRes>* server_unary_streamer) = 0;
};
template
+ class WithStreamedUnaryMethod_StartFixMachine : public BaseClass
+ {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service* /*service*/)
+ {
+ }
+
+ public:
+ WithStreamedUnaryMethod_StartFixMachine()
+ {
+ ::grpc::Service::MarkMethodStreamed(9, new ::grpc::internal::StreamedUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* streamer)
+ { return this->StreamedStartFixMachine(context, streamer); }));
+ }
+ ~WithStreamedUnaryMethod_StartFixMachine() override
+ {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable regular version of this method
+ ::grpc::Status StartFixMachine(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override
+ {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ // replace default version of method with streamed unary
+ virtual ::grpc::Status StreamedStartFixMachine(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* server_unary_streamer) = 0;
+ };
+ template
+ class WithStreamedUnaryMethod_EndFixMachine : public BaseClass
+ {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service* /*service*/)
+ {
+ }
+
+ public:
+ WithStreamedUnaryMethod_EndFixMachine()
+ {
+ ::grpc::Service::MarkMethodStreamed(10, new ::grpc::internal::StreamedUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* streamer)
+ { return this->StreamedEndFixMachine(context, streamer); }));
+ }
+ ~WithStreamedUnaryMethod_EndFixMachine() override
+ {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable regular version of this method
+ ::grpc::Status EndFixMachine(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override
+ {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ // replace default version of method with streamed unary
+ virtual ::grpc::Status StreamedEndFixMachine(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* server_unary_streamer) = 0;
+ };
+ template
+ class WithStreamedUnaryMethod_SaveHuman : public BaseClass
+ {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service* /*service*/)
+ {
+ }
+
+ public:
+ WithStreamedUnaryMethod_SaveHuman()
+ {
+ ::grpc::Service::MarkMethodStreamed(11, new ::grpc::internal::StreamedUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* streamer)
+ { return this->StreamedSaveHuman(context, streamer); }));
+ }
+ ~WithStreamedUnaryMethod_SaveHuman() override
+ {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable regular version of this method
+ ::grpc::Status SaveHuman(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override
+ {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ // replace default version of method with streamed unary
+ virtual ::grpc::Status StreamedSaveHuman(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* server_unary_streamer) = 0;
+ };
+ template
+ class WithStreamedUnaryMethod_EndSaveHuman : public BaseClass
+ {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service* /*service*/)
+ {
+ }
+
+ public:
+ WithStreamedUnaryMethod_EndSaveHuman()
+ {
+ ::grpc::Service::MarkMethodStreamed(12, new ::grpc::internal::StreamedUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* streamer)
+ { return this->StreamedEndSaveHuman(context, streamer); }));
+ }
+ ~WithStreamedUnaryMethod_EndSaveHuman() override
+ {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable regular version of this method
+ ::grpc::Status EndSaveHuman(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override
+ {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ // replace default version of method with streamed unary
+ virtual ::grpc::Status StreamedEndSaveHuman(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* server_unary_streamer) = 0;
+ };
+ template
class WithStreamedUnaryMethod_Attack : public BaseClass
{
private:
@@ -3185,7 +3662,7 @@ namespace protobuf
public:
WithStreamedUnaryMethod_Attack()
{
- ::grpc::Service::MarkMethodStreamed(11, new ::grpc::internal::StreamedUnaryHandler<::protobuf::AttackMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::AttackMsg, ::protobuf::BoolRes>* streamer)
+ ::grpc::Service::MarkMethodStreamed(13, new ::grpc::internal::StreamedUnaryHandler<::protobuf::AttackMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::AttackMsg, ::protobuf::BoolRes>* streamer)
{ return this->StreamedAttack(context, streamer); }));
}
~WithStreamedUnaryMethod_Attack() override
@@ -3212,7 +3689,7 @@ namespace protobuf
public:
WithStreamedUnaryMethod_CarryHuman()
{
- ::grpc::Service::MarkMethodStreamed(12, new ::grpc::internal::StreamedUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* streamer)
+ ::grpc::Service::MarkMethodStreamed(14, new ::grpc::internal::StreamedUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* streamer)
{ return this->StreamedCarryHuman(context, streamer); }));
}
~WithStreamedUnaryMethod_CarryHuman() override
@@ -3239,7 +3716,7 @@ namespace protobuf
public:
WithStreamedUnaryMethod_ReleaseHuman()
{
- ::grpc::Service::MarkMethodStreamed(13, new ::grpc::internal::StreamedUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* streamer)
+ ::grpc::Service::MarkMethodStreamed(15, new ::grpc::internal::StreamedUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* streamer)
{ return this->StreamedReleaseHuman(context, streamer); }));
}
~WithStreamedUnaryMethod_ReleaseHuman() override
@@ -3266,7 +3743,7 @@ namespace protobuf
public:
WithStreamedUnaryMethod_HangHuman()
{
- ::grpc::Service::MarkMethodStreamed(14, new ::grpc::internal::StreamedUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* streamer)
+ ::grpc::Service::MarkMethodStreamed(16, new ::grpc::internal::StreamedUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* streamer)
{ return this->StreamedHangHuman(context, streamer); }));
}
~WithStreamedUnaryMethod_HangHuman() override
@@ -3293,7 +3770,7 @@ namespace protobuf
public:
WithStreamedUnaryMethod_Escape()
{
- ::grpc::Service::MarkMethodStreamed(15, new ::grpc::internal::StreamedUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* streamer)
+ ::grpc::Service::MarkMethodStreamed(17, new ::grpc::internal::StreamedUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* streamer)
{ return this->StreamedEscape(context, streamer); }));
}
~WithStreamedUnaryMethod_Escape() override
@@ -3309,7 +3786,7 @@ namespace protobuf
// replace default version of method with streamed unary
virtual ::grpc::Status StreamedEscape(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* server_unary_streamer) = 0;
};
- typedef WithStreamedUnaryMethod_TryConnection>>>>>>>>>>>> StreamedUnaryService;
+ typedef WithStreamedUnaryMethod_TryConnection>>>>>>>>>>>>>>>> StreamedUnaryService;
template
class WithSplitStreamingMethod_AddPlayer : public BaseClass
{
@@ -3338,7 +3815,7 @@ namespace protobuf
virtual ::grpc::Status StreamedAddPlayer(::grpc::ServerContext* context, ::grpc::ServerSplitStreamer<::protobuf::PlayerMsg, ::protobuf::MessageToClient>* server_split_streamer) = 0;
};
typedef WithSplitStreamingMethod_AddPlayer SplitStreamedService;
- typedef WithStreamedUnaryMethod_TryConnection