From cab03a228d82aff8cdfea74c18f13560744d31bf Mon Sep 17 00:00:00 2001 From: shangfengh <3495281661@qq.com> Date: Sat, 15 Oct 2022 00:49:27 +0800 Subject: [PATCH 01/15] chore:add logic/Preparation/Utility --- logic/Preparation/Utility/Debugger.cs | 14 ++++ logic/Preparation/Utility/EnumType.cs | 96 +++++++++++++++++++++++++ logic/Preparation/Utility/MapEncoder.cs | 17 +++++ logic/Preparation/Utility/Tools.cs | 20 ++++++ logic/Preparation/Utility/Vector.cs | 57 +++++++++++++++ logic/Preparation/Utility/XYPosition.cs | 49 +++++++++++++ 6 files changed, 253 insertions(+) create mode 100644 logic/Preparation/Utility/Debugger.cs create mode 100644 logic/Preparation/Utility/EnumType.cs create mode 100644 logic/Preparation/Utility/MapEncoder.cs create mode 100644 logic/Preparation/Utility/Tools.cs create mode 100644 logic/Preparation/Utility/Vector.cs create mode 100644 logic/Preparation/Utility/XYPosition.cs diff --git a/logic/Preparation/Utility/Debugger.cs b/logic/Preparation/Utility/Debugger.cs new file mode 100644 index 0000000..282d9b3 --- /dev/null +++ b/logic/Preparation/Utility/Debugger.cs @@ -0,0 +1,14 @@ +using System; + +namespace Preparation.Utility +{ + public class Debugger + { + static public void Output(object current, string str) + { +#if DEBUG + Console.WriteLine(current.GetType() + " " + current.ToString() + " " + str); +#endif + } + } +} diff --git a/logic/Preparation/Utility/EnumType.cs b/logic/Preparation/Utility/EnumType.cs new file mode 100644 index 0000000..5dfb8cc --- /dev/null +++ b/logic/Preparation/Utility/EnumType.cs @@ -0,0 +1,96 @@ + +namespace Preparation.Utility +{ + /// + /// 存放所有用到的枚举类型 + /// + public enum GameObjType + { + Null = 0, + Character = 1, + Prop = 2, + PickedProp = 3, + Bullet = 4, + BombedBullet = 5, + + Wall = 6, + Grass = 7, + Generator = 8, // 发电机 + BirthPoint = 9, + Exit = 10, + EmergencyExit = 11, + OutOfBoundBlock = 12, // 范围外 + } + public enum ShapeType + { + Null = 0, + Circle = 1, // 子弹和人物为圆形,格子为方形 + Square = 2 + } + public enum PlaceType // 位置标志,包括陆地(一般默认为陆地,如墙体等),草丛。游戏中每一帧都要刷新各个物体的该属性 + { + Null = 0, + Land = 1, + Grass1 = 2, + Grass2 = 3, + Grass3 = 4, + Grass4 = 5, + Grass5 = 6, + } + public enum BulletType // 子弹类型 + { + Null = 0, + OrdinaryBullet = 1, // 普通子弹 + AtomBomb = 2, // 原子弹 + FastBullet = 3, // 快速子弹 + LineBullet = 4 // 直线子弹 + } + public enum PropType // 道具类型 + { + Null = 0, + addSpeed = 1, + addLIFE = 2, + Shield = 3, + Spear = 4, + Gem = 5, // 新增:宝石 + } + public enum PassiveSkillType // 被动技能 + { + Null = 0, + RecoverAfterBattle = 1, + SpeedUpWhenLeavingGrass = 2, + Vampire = 3, + PSkill3 = 4, + PSkill4 = 5, + PSkill5 = 6 + } + public enum ActiveSkillType // 主动技能 + { + Null = 0, + BecomeVampire = 1, + BecomeAssassin = 2, + NuclearWeapon = 3, + SuperFast = 4, + ASkill4 = 5, + ASkill5 = 6 + } + public enum BuffType // buff + { + Null = 0, + AddSpeed = 1, + AddLIFE = 2, + Shield = 3, + Spear = 4 + } + public enum GameObjIdx + { + None = 0, + Player = 1, + Bullet = 2, + Prop = 3, + Gem = 4, + Map = 5, + BombedBullet = 6, + PickedProp = 7 + } +} diff --git a/logic/Preparation/Utility/MapEncoder.cs b/logic/Preparation/Utility/MapEncoder.cs new file mode 100644 index 0000000..d8e2c4e --- /dev/null +++ b/logic/Preparation/Utility/MapEncoder.cs @@ -0,0 +1,17 @@ +using System; + +namespace Preparation.Utility +{ + public class MapEncoder + { + static public char Dec2Hex(int d) + { + return char.Parse(d.ToString("X")); + } + static public int Hex2Dec(char h) + { + string hexabet = "0123456789ABCDEF"; + return hexabet.IndexOf(h); + } + } +} diff --git a/logic/Preparation/Utility/Tools.cs b/logic/Preparation/Utility/Tools.cs new file mode 100644 index 0000000..78ee847 --- /dev/null +++ b/logic/Preparation/Utility/Tools.cs @@ -0,0 +1,20 @@ +using System; + +namespace Preparation.Utility +{ + public static class Tools + { + public static double CorrectAngle(double angle) // 将幅角转化为主值0~2pi + { + if (double.IsNaN(angle) || double.IsInfinity(angle)) + { + return 0.0; + } + while (angle < 0) + angle += 2 * Math.PI; + while (angle >= 2 * Math.PI) + angle -= 2 * Math.PI; + return angle; + } + } +} diff --git a/logic/Preparation/Utility/Vector.cs b/logic/Preparation/Utility/Vector.cs new file mode 100644 index 0000000..50614f0 --- /dev/null +++ b/logic/Preparation/Utility/Vector.cs @@ -0,0 +1,57 @@ +using System; + +namespace Preparation.Utility +{ + public struct Vector + { + public double angle; + public double length; + + public static XYPosition VectorToXY(Vector v) + { + return new XYPosition((int)(v.length * Math.Cos(v.angle)), (int)(v.length * Math.Sin(v.angle))); + } + public Vector2 ToVector2() + { + return new Vector2((int)(this.length * Math.Cos(this.angle)), (int)(this.length * Math.Sin(this.angle))); + } + public static Vector XYToVector(double x, double y) + { + return new Vector(Math.Atan2(y, x), Math.Sqrt((x * x) + (y * y))); + } + public Vector(double angle, double length) + { + if (length < 0) + { + angle += Math.PI; + length = -length; + } + this.angle = Tools.CorrectAngle(angle); + this.length = length; + } + } + + public struct Vector2 + { + public double x; + public double y; + public Vector2(double x, double y) + { + this.x = x; + this.y = y; + } + + public static double operator*(Vector2 v1, Vector2 v2) + { + return (v1.x * v2.x) + (v1.y * v2.y); + } + public static Vector2 operator +(Vector2 v1, Vector2 v2) + { + return new Vector2(v1.x + v2.x, v1.y + v2.y); + } + public static Vector2 operator -(Vector2 v1, Vector2 v2) + { + return new Vector2(v1.x - v2.x, v1.y - v2.y); + } + } +} diff --git a/logic/Preparation/Utility/XYPosition.cs b/logic/Preparation/Utility/XYPosition.cs new file mode 100644 index 0000000..55647ec --- /dev/null +++ b/logic/Preparation/Utility/XYPosition.cs @@ -0,0 +1,49 @@ +using System; + +namespace Preparation.Utility +{ + public struct XYPosition + { + public int x; + public int y; + public XYPosition(int x, int y) + { + this.x = x; + this.y = y; + } + public override string ToString() + { + return "(" + x.ToString() + "," + y.ToString() + ")"; + } + public static XYPosition operator +(XYPosition p1, XYPosition p2) + { + return new XYPosition(p1.x + p2.x, p1.y + p2.y); + } + public static XYPosition operator -(XYPosition p1, XYPosition p2) + { + return new XYPosition(p1.x - p2.x, p1.y - p2.y); + } + public static double Distance(XYPosition p1, XYPosition p2) + { + return Math.Sqrt(((long)(p1.x - p2.x) * (p1.x - p2.x)) + ((long)(p1.y - p2.y) * (p1.y - p2.y))); + } + /*public static XYPosition[] GetSquareRange(uint edgeLen) // 从THUAI4的BULLET.CS移植而来,不知还有用否 + { + XYPosition[] range = new XYPosition[edgeLen * edgeLen]; + int offset = (int)(edgeLen >> 1); + for (int i = 0; i < (int)edgeLen; ++i) + { + for (int j = 0; j < (int)edgeLen; ++j) + { + range[i * edgeLen + j].x = i - offset; + range[i * edgeLen + j].y = j - offset; + } + } + return range; + }*/ + public Vector2 ToVector2() + { + return new Vector2(this.x, this.y); + } + } +} From 1616030e5a20b3bcca7a510bcc4b06a67ea510ab Mon Sep 17 00:00:00 2001 From: shangfengh <3495281661@qq.com> Date: Sat, 15 Oct 2022 11:46:15 +0800 Subject: [PATCH 02/15] chore: add logic/Preparation/Interface --- logic/Preparation/Interface/ICharacter.cs | 11 ++++++ logic/Preparation/Interface/IGameObj.cs | 20 +++++++++++ logic/Preparation/Interface/IMap.cs | 18 ++++++++++ logic/Preparation/Interface/IMoveable.cs | 36 +++++++++++++++++++ .../Preparation/Interface/IObjOfCharacter.cs | 9 +++++ logic/Preparation/Interface/ITimer.cs | 9 +++++ 6 files changed, 103 insertions(+) create mode 100644 logic/Preparation/Interface/ICharacter.cs create mode 100644 logic/Preparation/Interface/IGameObj.cs create mode 100644 logic/Preparation/Interface/IMap.cs create mode 100644 logic/Preparation/Interface/IMoveable.cs create mode 100644 logic/Preparation/Interface/IObjOfCharacter.cs create mode 100644 logic/Preparation/Interface/ITimer.cs diff --git a/logic/Preparation/Interface/ICharacter.cs b/logic/Preparation/Interface/ICharacter.cs new file mode 100644 index 0000000..a708e00 --- /dev/null +++ b/logic/Preparation/Interface/ICharacter.cs @@ -0,0 +1,11 @@ +using System; +using Preparation.Utility; + +namespace Preparation.Interface +{ + public interface ICharacter : IGameObj + { + public long TeamID { get; } + public int HP { get; set; } + } +} \ No newline at end of file diff --git a/logic/Preparation/Interface/IGameObj.cs b/logic/Preparation/Interface/IGameObj.cs new file mode 100644 index 0000000..a32a1c5 --- /dev/null +++ b/logic/Preparation/Interface/IGameObj.cs @@ -0,0 +1,20 @@ +using Preparation.Utility; + +namespace Preparation.Interface +{ + public interface IGameObj + { + public GameObjType Type { get; set; } + public long ID { get; } + public XYPosition Position { get; } // if Square, Pos equals the center + public double FacingDirection { get; } + public bool IsRigid { get; } + public ShapeType Shape { get; } + public bool CanMove { get; set; } + public bool IsMoving { get; set; } + public bool IsResetting { get; set; } // reviving + public bool IsAvailable { get; } + public int Radius { get; } // if Square, Radius equals half length of one side + public PlaceType Place { get; set; } + } +} diff --git a/logic/Preparation/Interface/IMap.cs b/logic/Preparation/Interface/IMap.cs new file mode 100644 index 0000000..0d781b3 --- /dev/null +++ b/logic/Preparation/Interface/IMap.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using System.Threading; +using Preparation.Utility; + +namespace Preparation.Interface +{ + public interface IMap + { + ITimer Timer { get; } + + // the two dicts must have same keys + Dictionary> GameObjDict { get; } + Dictionary GameObjLockDict { get; } + + public bool IsOutOfBound(IGameObj obj); + public IOutOfBound GetOutOfBound(XYPosition pos); // 返回新建的一个OutOfBound对象 + } +} diff --git a/logic/Preparation/Interface/IMoveable.cs b/logic/Preparation/Interface/IMoveable.cs new file mode 100644 index 0000000..000a534 --- /dev/null +++ b/logic/Preparation/Interface/IMoveable.cs @@ -0,0 +1,36 @@ +using System; +using Preparation.Utility; + +namespace Preparation.Interface +{ + public interface IMoveable : IGameObj + { + object MoveLock { get; } + public int MoveSpeed { get; } + public long Move(Vector moveVec); + // protected bool IgnoreCollide(IGameObj targetObj); // 忽略碰撞,在具体类中实现 + public bool WillCollideWith(IGameObj? targetObj, XYPosition nextPos) // 检查下一位置是否会和目标物碰撞 + { + if (targetObj == null) + return false; + // 会移动的只有子弹和人物,都是Circle + if (!targetObj.IsRigid || targetObj.ID == ID) + return false; + // if (IgnoreCollide(targetObj)) return false; + if (targetObj.Shape == ShapeType.Circle) + { + return XYPosition.Distance(nextPos, targetObj.Position) < targetObj.Radius + Radius; + } + else // Square + { + long deltaX = Math.Abs(nextPos.x - targetObj.Position.x), deltaY = Math.Abs(nextPos.y - targetObj.Position.y); + if (deltaX >= targetObj.Radius + Radius || deltaY >= targetObj.Radius + Radius) + return false; + if (deltaX < targetObj.Radius || deltaY < targetObj.Radius) + return true; + else + return ((long)(deltaX - targetObj.Radius) * (deltaX - targetObj.Radius)) + ((long)(deltaY - targetObj.Radius) * (deltaY - targetObj.Radius)) <= (long)Radius * (long)Radius; + } + } + } +} diff --git a/logic/Preparation/Interface/IObjOfCharacter.cs b/logic/Preparation/Interface/IObjOfCharacter.cs new file mode 100644 index 0000000..92c5e40 --- /dev/null +++ b/logic/Preparation/Interface/IObjOfCharacter.cs @@ -0,0 +1,9 @@ +using System; + +namespace Preparation.Interface +{ + public interface IObjOfCharacter : IGameObj + { + ICharacter? Parent { get; set; } + } +} diff --git a/logic/Preparation/Interface/ITimer.cs b/logic/Preparation/Interface/ITimer.cs new file mode 100644 index 0000000..bdcdcbc --- /dev/null +++ b/logic/Preparation/Interface/ITimer.cs @@ -0,0 +1,9 @@ + +namespace Preparation.Interface +{ + public interface ITimer + { + bool IsGaming { get; } + public bool StartGame(int timeInMilliseconds); + } +} From 8c975d57a112337f94e63082bd32fefd6454669b Mon Sep 17 00:00:00 2001 From: shangfengh <3495281661@qq.com> Date: Sat, 15 Oct 2022 12:02:37 +0800 Subject: [PATCH 03/15] add logic/Preparation/GameData --- logic/Preparation/GameData/GameData.cs | 77 ++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 logic/Preparation/GameData/GameData.cs diff --git a/logic/Preparation/GameData/GameData.cs b/logic/Preparation/GameData/GameData.cs new file mode 100644 index 0000000..2d13d58 --- /dev/null +++ b/logic/Preparation/GameData/GameData.cs @@ -0,0 +1,77 @@ +using Preparation.Utility; + +namespace Preparation.GameData +{ + public static class GameData + { +#region 基本常数与常方法 + public const int numOfPosGridPerCell = 1000; // 每格的【坐标单位】数 + public const int numOfStepPerSecond = 20; // 每秒行走的步数 + public const int lengthOfMap = 50000; // 地图长度 + public const int rows = 50; // 行数 + public const int cols = 50; // 列数 + public const long gameDuration = 600000; // 游戏时长600000ms = 10min + public const long frameDuration = 50; // 每帧时长 + + public const int MinSpeed = 1; // 最小速度 + public const int MaxSpeed = int.MaxValue; // 最大速度 + + public static XYPosition GetCellCenterPos(int x, int y) // 求格子的中心坐标 + { + XYPosition ret = new((x * numOfPosGridPerCell) + (numOfPosGridPerCell / 2), (y * numOfPosGridPerCell) + (numOfPosGridPerCell / 2)); + return ret; + } + public static int PosGridToCellX(XYPosition pos) // 求坐标所在的格子的x坐标 + { + return pos.x / numOfPosGridPerCell; + } + public static int PosGridToCellY(XYPosition pos) // 求坐标所在的格子的y坐标 + { + return pos.y / numOfPosGridPerCell; + } + public static bool IsInTheSameCell(XYPosition pos1, XYPosition pos2) + { + return PosGridToCellX(pos1) == PosGridToCellX(pos2) && PosGridToCellY(pos1) == PosGridToCellY(pos2); + } +#endregion +#region 角色相关 + /// + /// 玩家相关 + /// + public const int characterRadius = numOfPosGridPerCell / 2; // 人物半径 + public const int basicAp = 3000; // 初始攻击力 + public const int basicHp = 6000; // 初始血量 + public const int basicCD = 3000; // 初始子弹冷却 + public const int basicBulletNum = 3; // 基本初始子弹量 + public const int MinAP = 0; // 最小攻击力 + public const int MaxAP = int.MaxValue; // 最大攻击力 + public const double basicAttackRange = 9000; // 基本攻击范围 + public const double basicBulletBombRange = 3000; // 基本子弹爆炸范围 + public const int basicMoveSpeed = 3000; // 基本移动速度,单位:s-1 + public const int basicBulletMoveSpeed = 3000; // 基本子弹移动速度,单位:s-1 + public const int characterMaxSpeed = 12000; // 最大速度 + public const int addScoreWhenKillOneLevelPlayer = 30; // 击杀一级角色获得的加分 + public const int commonSkillCD = 30000; // 普通技能标准冷却时间 + public const int commonSkillTime = 10000; // 普通技能标准持续时间 + public const int bulletRadius = 200; // 默认子弹半径 + public const int reviveTime = 30000; // 复活时间 + public const int shieldTimeAtBirth = 3000; // 复活时的护盾时间 + public const int gemToScore = 4; // 一个宝石的标准加分 + /// + /// 道具相关 + /// + public const int MinPropTypeNum = 1; + public const int MaxPropTypeNum = 10; + public const int PropRadius = numOfPosGridPerCell / 2; + public const int PropMoveSpeed = 3000; + public const int PropMaxMoveDistance = 15 * numOfPosGridPerCell; + public const int MaxGemSize = 5; // 随机生成的宝石最大size + public const long GemProduceTime = 10000; + public const long PropProduceTime = 10000; + public const int PropDuration = 10000; +#endregion +#region 游戏帧相关 + public const long checkInterval = 50; // 检查位置标志、补充子弹的帧时长 +#endregion + } +} From 2b47e6091addd99b073dac74fa92b1c2cf3a66ce Mon Sep 17 00:00:00 2001 From: DragonAura Date: Sat, 15 Oct 2022 15:04:57 +0800 Subject: [PATCH 04/15] chore : add receive message interface --- CAPI/proto/Message2Clients.grpc.pb.cc | 130 +++++- CAPI/proto/Message2Clients.grpc.pb.h | 548 +++++++++++++++++++++---- CAPI/proto/Message2Clients.pb.cc | 391 +++++++++++++++++- CAPI/proto/Message2Clients.pb.h | 333 ++++++++++++++- dependency/proto/Message2Clients.proto | 11 +- 5 files changed, 1308 insertions(+), 105 deletions(-) diff --git a/CAPI/proto/Message2Clients.grpc.pb.cc b/CAPI/proto/Message2Clients.grpc.pb.cc index 8e33e9d..85ea789 100644 --- a/CAPI/proto/Message2Clients.grpc.pb.cc +++ b/CAPI/proto/Message2Clients.grpc.pb.cc @@ -29,6 +29,8 @@ namespace protobuf "/protobuf.AvailableService/UseProp", "/protobuf.AvailableService/UseSkill", "/protobuf.AvailableService/SendMessage", + "/protobuf.AvailableService/HaveMessage", + "/protobuf.AvailableService/GetMessage", "/protobuf.AvailableService/FixMachine", "/protobuf.AvailableService/SaveHuman", "/protobuf.AvailableService/Attack", @@ -53,13 +55,15 @@ namespace protobuf rpcmethod_UseProp_(AvailableService_method_names[3], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), rpcmethod_UseSkill_(AvailableService_method_names[4], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), rpcmethod_SendMessage_(AvailableService_method_names[5], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), - rpcmethod_FixMachine_(AvailableService_method_names[6], options.suffix_for_stats(), ::grpc::internal::RpcMethod::BIDI_STREAMING, channel), - rpcmethod_SaveHuman_(AvailableService_method_names[7], options.suffix_for_stats(), ::grpc::internal::RpcMethod::BIDI_STREAMING, channel), - rpcmethod_Attack_(AvailableService_method_names[8], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), - rpcmethod_CarryHuman_(AvailableService_method_names[9], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), - rpcmethod_ReleaseHuman_(AvailableService_method_names[10], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), - rpcmethod_HangHuman_(AvailableService_method_names[11], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), - rpcmethod_Escape_(AvailableService_method_names[12], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel) + rpcmethod_HaveMessage_(AvailableService_method_names[6], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), + rpcmethod_GetMessage_(AvailableService_method_names[7], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), + rpcmethod_FixMachine_(AvailableService_method_names[8], options.suffix_for_stats(), ::grpc::internal::RpcMethod::BIDI_STREAMING, channel), + rpcmethod_SaveHuman_(AvailableService_method_names[9], options.suffix_for_stats(), ::grpc::internal::RpcMethod::BIDI_STREAMING, channel), + rpcmethod_Attack_(AvailableService_method_names[10], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), + rpcmethod_CarryHuman_(AvailableService_method_names[11], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), + rpcmethod_ReleaseHuman_(AvailableService_method_names[12], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), + rpcmethod_HangHuman_(AvailableService_method_names[13], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), + rpcmethod_Escape_(AvailableService_method_names[14], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel) { } @@ -223,6 +227,62 @@ namespace protobuf return result; } + ::grpc::Status AvailableService::Stub::HaveMessage(::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_HaveMessage_, context, request, response); + } + + void AvailableService::Stub::async::HaveMessage(::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_HaveMessage_, context, request, response, std::move(f)); + } + + void AvailableService::Stub::async::HaveMessage(::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_HaveMessage_, context, request, response, reactor); + } + + ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AvailableService::Stub::PrepareAsyncHaveMessageRaw(::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_HaveMessage_, context, request); + } + + ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AvailableService::Stub::AsyncHaveMessageRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) + { + auto* result = + this->PrepareAsyncHaveMessageRaw(context, request, cq); + result->StartCall(); + return result; + } + + ::grpc::Status AvailableService::Stub::GetMessage(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::protobuf::MsgRes* response) + { + return ::grpc::internal::BlockingUnaryCall<::protobuf::IDMsg, ::protobuf::MsgRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_GetMessage_, context, request, response); + } + + void AvailableService::Stub::async::GetMessage(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::MsgRes* response, std::function f) + { + ::grpc::internal::CallbackUnaryCall<::protobuf::IDMsg, ::protobuf::MsgRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_GetMessage_, context, request, response, std::move(f)); + } + + void AvailableService::Stub::async::GetMessage(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::MsgRes* response, ::grpc::ClientUnaryReactor* reactor) + { + ::grpc::internal::ClientCallbackUnaryFactory::Create<::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_GetMessage_, context, request, response, reactor); + } + + ::grpc::ClientAsyncResponseReader<::protobuf::MsgRes>* AvailableService::Stub::PrepareAsyncGetMessageRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) + { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create<::protobuf::MsgRes, ::protobuf::IDMsg, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_GetMessage_, context, request); + } + + ::grpc::ClientAsyncResponseReader<::protobuf::MsgRes>* AvailableService::Stub::AsyncGetMessageRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) + { + auto* result = + this->PrepareAsyncGetMessageRaw(context, request, cq); + result->StartCall(); + return result; + } + ::grpc::ClientReaderWriter<::protobuf::IDMsg, ::protobuf::BoolRes>* AvailableService::Stub::FixMachineRaw(::grpc::ClientContext* context) { return ::grpc::internal::ClientReaderWriterFactory<::protobuf::IDMsg, ::protobuf::BoolRes>::Create(channel_.get(), rpcmethod_FixMachine_, context); @@ -491,6 +551,34 @@ namespace protobuf )); AddMethod(new ::grpc::internal::RpcServiceMethod( AvailableService_method_names[6], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler( + [](AvailableService::Service* service, + ::grpc::ServerContext* ctx, + const ::protobuf::IDMsg* req, + ::protobuf::BoolRes* resp) + { + return service->HaveMessage(ctx, req, resp); + }, + this + ) + )); + AddMethod(new ::grpc::internal::RpcServiceMethod( + AvailableService_method_names[7], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler( + [](AvailableService::Service* service, + ::grpc::ServerContext* ctx, + const ::protobuf::IDMsg* req, + ::protobuf::MsgRes* resp) + { + return service->GetMessage(ctx, req, resp); + }, + this + ) + )); + AddMethod(new ::grpc::internal::RpcServiceMethod( + AvailableService_method_names[8], ::grpc::internal::RpcMethod::BIDI_STREAMING, new ::grpc::internal::BidiStreamingHandler( [](AvailableService::Service* service, @@ -503,7 +591,7 @@ namespace protobuf ) )); AddMethod(new ::grpc::internal::RpcServiceMethod( - AvailableService_method_names[7], + AvailableService_method_names[9], ::grpc::internal::RpcMethod::BIDI_STREAMING, new ::grpc::internal::BidiStreamingHandler( [](AvailableService::Service* service, @@ -516,7 +604,7 @@ namespace protobuf ) )); AddMethod(new ::grpc::internal::RpcServiceMethod( - AvailableService_method_names[8], + AvailableService_method_names[10], ::grpc::internal::RpcMethod::NORMAL_RPC, new ::grpc::internal::RpcMethodHandler( [](AvailableService::Service* service, @@ -530,7 +618,7 @@ namespace protobuf ) )); AddMethod(new ::grpc::internal::RpcServiceMethod( - AvailableService_method_names[9], + AvailableService_method_names[11], ::grpc::internal::RpcMethod::NORMAL_RPC, new ::grpc::internal::RpcMethodHandler( [](AvailableService::Service* service, @@ -544,7 +632,7 @@ namespace protobuf ) )); AddMethod(new ::grpc::internal::RpcServiceMethod( - AvailableService_method_names[10], + AvailableService_method_names[12], ::grpc::internal::RpcMethod::NORMAL_RPC, new ::grpc::internal::RpcMethodHandler( [](AvailableService::Service* service, @@ -558,7 +646,7 @@ namespace protobuf ) )); AddMethod(new ::grpc::internal::RpcServiceMethod( - AvailableService_method_names[11], + AvailableService_method_names[13], ::grpc::internal::RpcMethod::NORMAL_RPC, new ::grpc::internal::RpcMethodHandler( [](AvailableService::Service* service, @@ -572,7 +660,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, @@ -639,6 +727,22 @@ namespace protobuf return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } + ::grpc::Status AvailableService::Service::HaveMessage(::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::GetMessage(::grpc::ServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::MsgRes* response) + { + (void)context; + (void)request; + (void)response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + ::grpc::Status AvailableService::Service::FixMachine(::grpc::ServerContext* context, ::grpc::ServerReaderWriter<::protobuf::BoolRes, ::protobuf::IDMsg>* stream) { (void)context; diff --git a/CAPI/proto/Message2Clients.grpc.pb.h b/CAPI/proto/Message2Clients.grpc.pb.h index 4dc2515..60af0ca 100644 --- a/CAPI/proto/Message2Clients.grpc.pb.h +++ b/CAPI/proto/Message2Clients.grpc.pb.h @@ -103,6 +103,24 @@ namespace protobuf { return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>>(PrepareAsyncSendMessageRaw(context, request, cq)); } + virtual ::grpc::Status HaveMessage(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::protobuf::BoolRes* response) = 0; + std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>> AsyncHaveMessage(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) + { + return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>>(AsyncHaveMessageRaw(context, request, cq)); + } + std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>> PrepareAsyncHaveMessage(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) + { + return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>>(PrepareAsyncHaveMessageRaw(context, request, cq)); + } + virtual ::grpc::Status GetMessage(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::protobuf::MsgRes* response) = 0; + std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::MsgRes>> AsyncGetMessage(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) + { + return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::MsgRes>>(AsyncGetMessageRaw(context, request, cq)); + } + std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::MsgRes>> PrepareAsyncGetMessage(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) + { + 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) { return std::unique_ptr<::grpc::ClientReaderWriterInterface<::protobuf::IDMsg, ::protobuf::BoolRes>>(FixMachineRaw(context)); @@ -193,6 +211,10 @@ namespace protobuf virtual void UseSkill(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) = 0; virtual void SendMessage(::grpc::ClientContext* context, const ::protobuf::SendMsg* request, ::protobuf::BoolRes* response, std::function) = 0; virtual void SendMessage(::grpc::ClientContext* context, const ::protobuf::SendMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) = 0; + virtual void HaveMessage(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, std::function) = 0; + 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; @@ -231,6 +253,10 @@ namespace protobuf virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* PrepareAsyncUseSkillRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) = 0; virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* AsyncSendMessageRaw(::grpc::ClientContext* context, const ::protobuf::SendMsg& request, ::grpc::CompletionQueue* cq) = 0; virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* PrepareAsyncSendMessageRaw(::grpc::ClientContext* context, const ::protobuf::SendMsg& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* AsyncHaveMessageRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) = 0; + 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; @@ -309,6 +335,24 @@ namespace protobuf { return std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>>(PrepareAsyncSendMessageRaw(context, request, cq)); } + ::grpc::Status HaveMessage(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::protobuf::BoolRes* response) override; + std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>> AsyncHaveMessage(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) + { + return std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>>(AsyncHaveMessageRaw(context, request, cq)); + } + std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>> PrepareAsyncHaveMessage(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) + { + return std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>>(PrepareAsyncHaveMessageRaw(context, request, cq)); + } + ::grpc::Status GetMessage(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::protobuf::MsgRes* response) override; + std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::MsgRes>> AsyncGetMessage(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) + { + return std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::MsgRes>>(AsyncGetMessageRaw(context, request, cq)); + } + std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::MsgRes>> PrepareAsyncGetMessage(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) + { + 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) { return std::unique_ptr<::grpc::ClientReaderWriter<::protobuf::IDMsg, ::protobuf::BoolRes>>(FixMachineRaw(context)); @@ -393,6 +437,10 @@ namespace protobuf void UseSkill(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) override; void SendMessage(::grpc::ClientContext* context, const ::protobuf::SendMsg* request, ::protobuf::BoolRes* response, std::function) override; void SendMessage(::grpc::ClientContext* context, const ::protobuf::SendMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) override; + void HaveMessage(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, std::function) override; + 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 Attack(::grpc::ClientContext* context, const ::protobuf::AttackMsg* request, ::protobuf::BoolRes* response, std::function) override; @@ -442,6 +490,10 @@ namespace protobuf ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* PrepareAsyncUseSkillRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override; ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AsyncSendMessageRaw(::grpc::ClientContext* context, const ::protobuf::SendMsg& request, ::grpc::CompletionQueue* cq) override; ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* PrepareAsyncSendMessageRaw(::grpc::ClientContext* context, const ::protobuf::SendMsg& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AsyncHaveMessageRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override; + ::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; @@ -464,6 +516,8 @@ namespace protobuf const ::grpc::internal::RpcMethod rpcmethod_UseProp_; const ::grpc::internal::RpcMethod rpcmethod_UseSkill_; 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_SaveHuman_; const ::grpc::internal::RpcMethod rpcmethod_Attack_; @@ -488,6 +542,8 @@ namespace protobuf virtual ::grpc::Status UseProp(::grpc::ServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response); virtual ::grpc::Status UseSkill(::grpc::ServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response); 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); @@ -666,6 +722,62 @@ namespace protobuf } }; template + class WithAsyncMethod_HaveMessage : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithAsyncMethod_HaveMessage() + { + ::grpc::Service::MarkMethodAsync(6); + } + ~WithAsyncMethod_HaveMessage() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status HaveMessage(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestHaveMessage(::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(6, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_GetMessage : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithAsyncMethod_GetMessage() + { + ::grpc::Service::MarkMethodAsync(7); + } + ~WithAsyncMethod_GetMessage() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status GetMessage(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::MsgRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestGetMessage(::grpc::ServerContext* context, ::protobuf::IDMsg* request, ::grpc::ServerAsyncResponseWriter<::protobuf::MsgRes>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag) + { + ::grpc::Service::RequestAsyncUnary(7, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template class WithAsyncMethod_FixMachine : public BaseClass { private: @@ -676,7 +788,7 @@ namespace protobuf public: WithAsyncMethod_FixMachine() { - ::grpc::Service::MarkMethodAsync(6); + ::grpc::Service::MarkMethodAsync(8); } ~WithAsyncMethod_FixMachine() override { @@ -690,7 +802,7 @@ namespace protobuf } void RequestFixMachine(::grpc::ServerContext* context, ::grpc::ServerAsyncReaderWriter<::protobuf::BoolRes, ::protobuf::IDMsg>* stream, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag) { - ::grpc::Service::RequestAsyncBidiStreaming(6, context, stream, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncBidiStreaming(8, context, stream, new_call_cq, notification_cq, tag); } }; template @@ -704,7 +816,7 @@ namespace protobuf public: WithAsyncMethod_SaveHuman() { - ::grpc::Service::MarkMethodAsync(7); + ::grpc::Service::MarkMethodAsync(9); } ~WithAsyncMethod_SaveHuman() override { @@ -718,7 +830,7 @@ namespace protobuf } void RequestSaveHuman(::grpc::ServerContext* context, ::grpc::ServerAsyncReaderWriter<::protobuf::BoolRes, ::protobuf::IDMsg>* stream, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag) { - ::grpc::Service::RequestAsyncBidiStreaming(7, context, stream, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncBidiStreaming(9, context, stream, new_call_cq, notification_cq, tag); } }; template @@ -732,7 +844,7 @@ namespace protobuf public: WithAsyncMethod_Attack() { - ::grpc::Service::MarkMethodAsync(8); + ::grpc::Service::MarkMethodAsync(10); } ~WithAsyncMethod_Attack() override { @@ -746,7 +858,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(8, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(10, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -760,7 +872,7 @@ namespace protobuf public: WithAsyncMethod_CarryHuman() { - ::grpc::Service::MarkMethodAsync(9); + ::grpc::Service::MarkMethodAsync(11); } ~WithAsyncMethod_CarryHuman() override { @@ -774,7 +886,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(9, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(11, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -788,7 +900,7 @@ namespace protobuf public: WithAsyncMethod_ReleaseHuman() { - ::grpc::Service::MarkMethodAsync(10); + ::grpc::Service::MarkMethodAsync(12); } ~WithAsyncMethod_ReleaseHuman() override { @@ -802,7 +914,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(10, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(12, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -816,7 +928,7 @@ namespace protobuf public: WithAsyncMethod_HangHuman() { - ::grpc::Service::MarkMethodAsync(11); + ::grpc::Service::MarkMethodAsync(13); } ~WithAsyncMethod_HangHuman() override { @@ -830,7 +942,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(11, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(13, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -844,7 +956,7 @@ namespace protobuf public: WithAsyncMethod_Escape() { - ::grpc::Service::MarkMethodAsync(12); + ::grpc::Service::MarkMethodAsync(14); } ~WithAsyncMethod_Escape() override { @@ -858,10 +970,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(12, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(14, context, request, response, new_call_cq, notification_cq, tag); } }; - typedef WithAsyncMethod_AddPlayer>>>>>>>>>>>> AsyncService; + typedef WithAsyncMethod_AddPlayer>>>>>>>>>>>>>> AsyncService; template class WithCallbackMethod_AddPlayer : public BaseClass { @@ -1089,6 +1201,84 @@ namespace protobuf } }; template + class WithCallbackMethod_HaveMessage : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithCallbackMethod_HaveMessage() + { + ::grpc::Service::MarkMethodCallback(6, new ::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response) + { return this->HaveMessage(context, request, response); })); + } + void SetMessageAllocatorFor_HaveMessage( + ::grpc::MessageAllocator<::protobuf::IDMsg, ::protobuf::BoolRes>* allocator + ) + { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(6); + static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_HaveMessage() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status HaveMessage(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* HaveMessage( + ::grpc::CallbackServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/ + ) + { + return nullptr; + } + }; + template + class WithCallbackMethod_GetMessage : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithCallbackMethod_GetMessage() + { + ::grpc::Service::MarkMethodCallback(7, new ::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::MsgRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::MsgRes* response) + { return this->GetMessage(context, request, response); })); + } + void SetMessageAllocatorFor_GetMessage( + ::grpc::MessageAllocator<::protobuf::IDMsg, ::protobuf::MsgRes>* allocator + ) + { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(7); + static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::MsgRes>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_GetMessage() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status GetMessage(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::MsgRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* GetMessage( + ::grpc::CallbackServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::MsgRes* /*response*/ + ) + { + return nullptr; + } + }; + template class WithCallbackMethod_FixMachine : public BaseClass { private: @@ -1099,7 +1289,7 @@ namespace protobuf public: WithCallbackMethod_FixMachine() { - ::grpc::Service::MarkMethodCallback(6, new ::grpc::internal::CallbackBidiHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context) + ::grpc::Service::MarkMethodCallback(8, new ::grpc::internal::CallbackBidiHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context) { return this->FixMachine(context); })); } ~WithCallbackMethod_FixMachine() override @@ -1130,7 +1320,7 @@ namespace protobuf public: WithCallbackMethod_SaveHuman() { - ::grpc::Service::MarkMethodCallback(7, new ::grpc::internal::CallbackBidiHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context) + ::grpc::Service::MarkMethodCallback(9, new ::grpc::internal::CallbackBidiHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context) { return this->SaveHuman(context); })); } ~WithCallbackMethod_SaveHuman() override @@ -1161,14 +1351,14 @@ namespace protobuf public: WithCallbackMethod_Attack() { - ::grpc::Service::MarkMethodCallback(8, 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); })); + ::grpc::Service::MarkMethodCallback(10, 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(8); + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(10); static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::AttackMsg, ::protobuf::BoolRes>*>(handler) ->SetMessageAllocator(allocator); } @@ -1200,14 +1390,14 @@ namespace protobuf public: WithCallbackMethod_CarryHuman() { - ::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->CarryHuman(context, request, response); })); + ::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->CarryHuman(context, request, response); })); } void SetMessageAllocatorFor_CarryHuman( ::grpc::MessageAllocator<::protobuf::IDMsg, ::protobuf::BoolRes>* allocator ) { - ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(9); + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(11); static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>*>(handler) ->SetMessageAllocator(allocator); } @@ -1239,14 +1429,14 @@ namespace protobuf public: WithCallbackMethod_ReleaseHuman() { - ::grpc::Service::MarkMethodCallback(10, new ::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response) + ::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->ReleaseHuman(context, request, response); })); } void SetMessageAllocatorFor_ReleaseHuman( ::grpc::MessageAllocator<::protobuf::IDMsg, ::protobuf::BoolRes>* allocator ) { - ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(10); + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(12); static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>*>(handler) ->SetMessageAllocator(allocator); } @@ -1278,14 +1468,14 @@ namespace protobuf public: WithCallbackMethod_HangHuman() { - ::grpc::Service::MarkMethodCallback(11, new ::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response) + ::grpc::Service::MarkMethodCallback(13, 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(11); + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(13); static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>*>(handler) ->SetMessageAllocator(allocator); } @@ -1317,14 +1507,14 @@ namespace protobuf public: WithCallbackMethod_Escape() { - ::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->Escape(context, request, response); })); } void SetMessageAllocatorFor_Escape( ::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); } @@ -1345,7 +1535,7 @@ namespace protobuf return nullptr; } }; - typedef WithCallbackMethod_AddPlayer>>>>>>>>>>>> CallbackService; + typedef WithCallbackMethod_AddPlayer>>>>>>>>>>>>>> CallbackService; typedef CallbackService ExperimentalCallbackService; template class WithGenericMethod_AddPlayer : public BaseClass @@ -1492,6 +1682,54 @@ namespace protobuf } }; template + class WithGenericMethod_HaveMessage : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithGenericMethod_HaveMessage() + { + ::grpc::Service::MarkMethodGeneric(6); + } + ~WithGenericMethod_HaveMessage() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status HaveMessage(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_GetMessage : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithGenericMethod_GetMessage() + { + ::grpc::Service::MarkMethodGeneric(7); + } + ~WithGenericMethod_GetMessage() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status GetMessage(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::MsgRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template class WithGenericMethod_FixMachine : public BaseClass { private: @@ -1502,7 +1740,7 @@ namespace protobuf public: WithGenericMethod_FixMachine() { - ::grpc::Service::MarkMethodGeneric(6); + ::grpc::Service::MarkMethodGeneric(8); } ~WithGenericMethod_FixMachine() override { @@ -1526,7 +1764,7 @@ namespace protobuf public: WithGenericMethod_SaveHuman() { - ::grpc::Service::MarkMethodGeneric(7); + ::grpc::Service::MarkMethodGeneric(9); } ~WithGenericMethod_SaveHuman() override { @@ -1550,7 +1788,7 @@ namespace protobuf public: WithGenericMethod_Attack() { - ::grpc::Service::MarkMethodGeneric(8); + ::grpc::Service::MarkMethodGeneric(10); } ~WithGenericMethod_Attack() override { @@ -1574,7 +1812,7 @@ namespace protobuf public: WithGenericMethod_CarryHuman() { - ::grpc::Service::MarkMethodGeneric(9); + ::grpc::Service::MarkMethodGeneric(11); } ~WithGenericMethod_CarryHuman() override { @@ -1598,7 +1836,7 @@ namespace protobuf public: WithGenericMethod_ReleaseHuman() { - ::grpc::Service::MarkMethodGeneric(10); + ::grpc::Service::MarkMethodGeneric(12); } ~WithGenericMethod_ReleaseHuman() override { @@ -1622,7 +1860,7 @@ namespace protobuf public: WithGenericMethod_HangHuman() { - ::grpc::Service::MarkMethodGeneric(11); + ::grpc::Service::MarkMethodGeneric(13); } ~WithGenericMethod_HangHuman() override { @@ -1646,7 +1884,7 @@ namespace protobuf public: WithGenericMethod_Escape() { - ::grpc::Service::MarkMethodGeneric(12); + ::grpc::Service::MarkMethodGeneric(14); } ~WithGenericMethod_Escape() override { @@ -1828,6 +2066,62 @@ namespace protobuf } }; template + class WithRawMethod_HaveMessage : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithRawMethod_HaveMessage() + { + ::grpc::Service::MarkMethodRaw(6); + } + ~WithRawMethod_HaveMessage() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status HaveMessage(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestHaveMessage(::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(6, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawMethod_GetMessage : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithRawMethod_GetMessage() + { + ::grpc::Service::MarkMethodRaw(7); + } + ~WithRawMethod_GetMessage() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status GetMessage(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::MsgRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestGetMessage(::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(7, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template class WithRawMethod_FixMachine : public BaseClass { private: @@ -1838,7 +2132,7 @@ namespace protobuf public: WithRawMethod_FixMachine() { - ::grpc::Service::MarkMethodRaw(6); + ::grpc::Service::MarkMethodRaw(8); } ~WithRawMethod_FixMachine() override { @@ -1852,7 +2146,7 @@ namespace protobuf } void RequestFixMachine(::grpc::ServerContext* context, ::grpc::ServerAsyncReaderWriter<::grpc::ByteBuffer, ::grpc::ByteBuffer>* stream, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag) { - ::grpc::Service::RequestAsyncBidiStreaming(6, context, stream, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncBidiStreaming(8, context, stream, new_call_cq, notification_cq, tag); } }; template @@ -1866,7 +2160,7 @@ namespace protobuf public: WithRawMethod_SaveHuman() { - ::grpc::Service::MarkMethodRaw(7); + ::grpc::Service::MarkMethodRaw(9); } ~WithRawMethod_SaveHuman() override { @@ -1880,7 +2174,7 @@ namespace protobuf } void RequestSaveHuman(::grpc::ServerContext* context, ::grpc::ServerAsyncReaderWriter<::grpc::ByteBuffer, ::grpc::ByteBuffer>* stream, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag) { - ::grpc::Service::RequestAsyncBidiStreaming(7, context, stream, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncBidiStreaming(9, context, stream, new_call_cq, notification_cq, tag); } }; template @@ -1894,7 +2188,7 @@ namespace protobuf public: WithRawMethod_Attack() { - ::grpc::Service::MarkMethodRaw(8); + ::grpc::Service::MarkMethodRaw(10); } ~WithRawMethod_Attack() override { @@ -1908,7 +2202,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(8, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(10, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -1922,7 +2216,7 @@ namespace protobuf public: WithRawMethod_CarryHuman() { - ::grpc::Service::MarkMethodRaw(9); + ::grpc::Service::MarkMethodRaw(11); } ~WithRawMethod_CarryHuman() override { @@ -1936,7 +2230,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(9, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(11, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -1950,7 +2244,7 @@ namespace protobuf public: WithRawMethod_ReleaseHuman() { - ::grpc::Service::MarkMethodRaw(10); + ::grpc::Service::MarkMethodRaw(12); } ~WithRawMethod_ReleaseHuman() override { @@ -1964,7 +2258,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(10, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(12, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -1978,7 +2272,7 @@ namespace protobuf public: WithRawMethod_HangHuman() { - ::grpc::Service::MarkMethodRaw(11); + ::grpc::Service::MarkMethodRaw(13); } ~WithRawMethod_HangHuman() override { @@ -1992,7 +2286,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(11, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(13, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -2006,7 +2300,7 @@ namespace protobuf public: WithRawMethod_Escape() { - ::grpc::Service::MarkMethodRaw(12); + ::grpc::Service::MarkMethodRaw(14); } ~WithRawMethod_Escape() override { @@ -2020,7 +2314,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(12, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(14, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -2210,6 +2504,68 @@ namespace protobuf } }; template + class WithRawCallbackMethod_HaveMessage : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithRawCallbackMethod_HaveMessage() + { + ::grpc::Service::MarkMethodRawCallback(6, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) + { return this->HaveMessage(context, request, response); })); + } + ~WithRawCallbackMethod_HaveMessage() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status HaveMessage(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* HaveMessage( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/ + ) + { + return nullptr; + } + }; + template + class WithRawCallbackMethod_GetMessage : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithRawCallbackMethod_GetMessage() + { + ::grpc::Service::MarkMethodRawCallback(7, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) + { return this->GetMessage(context, request, response); })); + } + ~WithRawCallbackMethod_GetMessage() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status GetMessage(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::MsgRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* GetMessage( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/ + ) + { + return nullptr; + } + }; + template class WithRawCallbackMethod_FixMachine : public BaseClass { private: @@ -2220,7 +2576,7 @@ namespace protobuf public: WithRawCallbackMethod_FixMachine() { - ::grpc::Service::MarkMethodRawCallback(6, new ::grpc::internal::CallbackBidiHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context) + ::grpc::Service::MarkMethodRawCallback(8, new ::grpc::internal::CallbackBidiHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context) { return this->FixMachine(context); })); } ~WithRawCallbackMethod_FixMachine() override @@ -2251,7 +2607,7 @@ namespace protobuf public: WithRawCallbackMethod_SaveHuman() { - ::grpc::Service::MarkMethodRawCallback(7, new ::grpc::internal::CallbackBidiHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context) + ::grpc::Service::MarkMethodRawCallback(9, new ::grpc::internal::CallbackBidiHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context) { return this->SaveHuman(context); })); } ~WithRawCallbackMethod_SaveHuman() override @@ -2282,8 +2638,8 @@ namespace protobuf public: WithRawCallbackMethod_Attack() { - ::grpc::Service::MarkMethodRawCallback(8, 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); })); + ::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->Attack(context, request, response); })); } ~WithRawCallbackMethod_Attack() override { @@ -2313,8 +2669,8 @@ namespace protobuf public: WithRawCallbackMethod_CarryHuman() { - ::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->CarryHuman(context, request, response); })); + ::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->CarryHuman(context, request, response); })); } ~WithRawCallbackMethod_CarryHuman() override { @@ -2344,7 +2700,7 @@ namespace protobuf public: WithRawCallbackMethod_ReleaseHuman() { - ::grpc::Service::MarkMethodRawCallback(10, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) + ::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->ReleaseHuman(context, request, response); })); } ~WithRawCallbackMethod_ReleaseHuman() override @@ -2375,7 +2731,7 @@ namespace protobuf public: WithRawCallbackMethod_HangHuman() { - ::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->HangHuman(context, request, response); })); } ~WithRawCallbackMethod_HangHuman() override @@ -2406,7 +2762,7 @@ namespace protobuf public: WithRawCallbackMethod_Escape() { - ::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->Escape(context, request, response); })); } ~WithRawCallbackMethod_Escape() override @@ -2562,6 +2918,60 @@ namespace protobuf virtual ::grpc::Status StreamedSendMessage(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::SendMsg, ::protobuf::BoolRes>* server_unary_streamer) = 0; }; template + class WithStreamedUnaryMethod_HaveMessage : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithStreamedUnaryMethod_HaveMessage() + { + ::grpc::Service::MarkMethodStreamed(6, new ::grpc::internal::StreamedUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* streamer) + { return this->StreamedHaveMessage(context, streamer); })); + } + ~WithStreamedUnaryMethod_HaveMessage() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status HaveMessage(::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 StreamedHaveMessage(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* server_unary_streamer) = 0; + }; + template + class WithStreamedUnaryMethod_GetMessage : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithStreamedUnaryMethod_GetMessage() + { + ::grpc::Service::MarkMethodStreamed(7, new ::grpc::internal::StreamedUnaryHandler<::protobuf::IDMsg, ::protobuf::MsgRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::MsgRes>* streamer) + { return this->StreamedGetMessage(context, streamer); })); + } + ~WithStreamedUnaryMethod_GetMessage() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status GetMessage(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::MsgRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedGetMessage(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::MsgRes>* server_unary_streamer) = 0; + }; + template class WithStreamedUnaryMethod_Attack : public BaseClass { private: @@ -2572,8 +2982,8 @@ namespace protobuf public: WithStreamedUnaryMethod_Attack() { - ::grpc::Service::MarkMethodStreamed(8, new ::grpc::internal::StreamedUnaryHandler<::protobuf::AttackMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::AttackMsg, ::protobuf::BoolRes>* streamer) - { return this->StreamedAttack(context, streamer); })); + ::grpc::Service::MarkMethodStreamed(10, 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 { @@ -2599,8 +3009,8 @@ namespace protobuf public: WithStreamedUnaryMethod_CarryHuman() { - ::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->StreamedCarryHuman(context, streamer); })); + ::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->StreamedCarryHuman(context, streamer); })); } ~WithStreamedUnaryMethod_CarryHuman() override { @@ -2626,7 +3036,7 @@ namespace protobuf public: WithStreamedUnaryMethod_ReleaseHuman() { - ::grpc::Service::MarkMethodStreamed(10, new ::grpc::internal::StreamedUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* streamer) + ::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->StreamedReleaseHuman(context, streamer); })); } ~WithStreamedUnaryMethod_ReleaseHuman() override @@ -2653,7 +3063,7 @@ namespace protobuf public: WithStreamedUnaryMethod_HangHuman() { - ::grpc::Service::MarkMethodStreamed(11, new ::grpc::internal::StreamedUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* streamer) + ::grpc::Service::MarkMethodStreamed(13, 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 @@ -2680,7 +3090,7 @@ namespace protobuf public: WithStreamedUnaryMethod_Escape() { - ::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->StreamedEscape(context, streamer); })); } ~WithStreamedUnaryMethod_Escape() override @@ -2696,7 +3106,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_Move>>>>>>>>> StreamedUnaryService; + typedef WithStreamedUnaryMethod_Move>>>>>>>>>>> StreamedUnaryService; template class WithSplitStreamingMethod_AddPlayer : public BaseClass { @@ -2725,7 +3135,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 WithSplitStreamingMethod_AddPlayer>>>>>>>>>> StreamedService; + typedef WithSplitStreamingMethod_AddPlayer>>>>>>>>>>>> StreamedService; }; } // namespace protobuf diff --git a/CAPI/proto/Message2Clients.pb.cc b/CAPI/proto/Message2Clients.pb.cc index ff9754d..812953d 100644 --- a/CAPI/proto/Message2Clients.pb.cc +++ b/CAPI/proto/Message2Clients.pb.cc @@ -269,8 +269,31 @@ namespace protobuf }; }; PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT BoolResDefaultTypeInternal _BoolRes_default_instance_; + constexpr MsgRes::MsgRes( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized + ) : + message_received_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string), + from_player_id_(int64_t{0}), + have_message_(false) + { + } + struct MsgResDefaultTypeInternal + { + constexpr MsgResDefaultTypeInternal() : + _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) + { + } + ~MsgResDefaultTypeInternal() + { + } + union + { + MsgRes _instance; + }; + }; + PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT MsgResDefaultTypeInternal _MsgRes_default_instance_; } // namespace protobuf -static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_Message2Clients_2eproto[9]; +static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_Message2Clients_2eproto[10]; static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_Message2Clients_2eproto = nullptr; static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_Message2Clients_2eproto = nullptr; @@ -379,6 +402,15 @@ const uint32_t TableStruct_Message2Clients_2eproto::offsets[] PROTOBUF_SECTION_V ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ PROTOBUF_FIELD_OFFSET(::protobuf::BoolRes, act_success_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::protobuf::MsgRes, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::protobuf::MsgRes, have_message_), + PROTOBUF_FIELD_OFFSET(::protobuf::MsgRes, from_player_id_), + PROTOBUF_FIELD_OFFSET(::protobuf::MsgRes, message_received_), }; static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { {0, -1, -1, sizeof(::protobuf::MessageOfHuman)}, @@ -390,6 +422,7 @@ static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOB {79, -1, -1, sizeof(::protobuf::MessageToClient)}, {89, -1, -1, sizeof(::protobuf::MoveRes)}, {97, -1, -1, sizeof(::protobuf::BoolRes)}, + {104, -1, -1, sizeof(::protobuf::MsgRes)}, }; static ::PROTOBUF_NAMESPACE_ID::Message const* const file_default_instances[] = { @@ -402,6 +435,7 @@ static ::PROTOBUF_NAMESPACE_ID::Message const* const file_default_instances[] = reinterpret_cast(&::protobuf::_MessageToClient_default_instance_), reinterpret_cast(&::protobuf::_MoveRes_default_instance_), reinterpret_cast(&::protobuf::_BoolRes_default_instance_), + reinterpret_cast(&::protobuf::_MsgRes_default_instance_), }; const char descriptor_table_protodef_Message2Clients_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = @@ -442,24 +476,29 @@ const char descriptor_table_protodef_Message2Clients_2eproto[] PROTOBUF_SECTION_ "+\n\013map_massage\030\004 \001(\0132\026.protobuf.MessageO" "fMap\"5\n\007MoveRes\022\024\n\014actual_speed\030\001 \001(\003\022\024\n" "\014actual_angle\030\002 \001(\001\"\036\n\007BoolRes\022\023\n\013act_su" - "ccess\030\001 \001(\0102\247\005\n\020AvailableService\022=\n\tAddP" - "layer\022\023.protobuf.PlayerMsg\032\031.protobuf.Me" - "ssageToClient0\001\022,\n\004Move\022\021.protobuf.MoveM" - "sg\032\021.protobuf.MoveRes\0220\n\010PickProp\022\021.prot" - "obuf.PickMsg\032\021.protobuf.BoolRes\022-\n\007UsePr" - "op\022\017.protobuf.IDMsg\032\021.protobuf.BoolRes\022." - "\n\010UseSkill\022\017.protobuf.IDMsg\032\021.protobuf.B" - "oolRes\0223\n\013SendMessage\022\021.protobuf.SendMsg" - "\032\021.protobuf.BoolRes\0224\n\nFixMachine\022\017.prot" - "obuf.IDMsg\032\021.protobuf.BoolRes(\0010\001\0223\n\tSav" - "eHuman\022\017.protobuf.IDMsg\032\021.protobuf.BoolR" - "es(\0010\001\0220\n\006Attack\022\023.protobuf.AttackMsg\032\021." - "protobuf.BoolRes\0220\n\nCarryHuman\022\017.protobu" - "f.IDMsg\032\021.protobuf.BoolRes\0222\n\014ReleaseHum" - "an\022\017.protobuf.IDMsg\032\021.protobuf.BoolRes\022/" - "\n\tHangHuman\022\017.protobuf.IDMsg\032\021.protobuf." - "BoolRes\022,\n\006Escape\022\017.protobuf.IDMsg\032\021.pro" - "tobuf.BoolResb\006proto3"; + "ccess\030\001 \001(\010\"P\n\006MsgRes\022\024\n\014have_message\030\001 " + "\001(\010\022\026\n\016from_player_id\030\002 \001(\003\022\030\n\020message_r" + "eceived\030\003 \001(\t2\213\006\n\020AvailableService\022=\n\tAd" + "dPlayer\022\023.protobuf.PlayerMsg\032\031.protobuf." + "MessageToClient0\001\022,\n\004Move\022\021.protobuf.Mov" + "eMsg\032\021.protobuf.MoveRes\0220\n\010PickProp\022\021.pr" + "otobuf.PickMsg\032\021.protobuf.BoolRes\022-\n\007Use" + "Prop\022\017.protobuf.IDMsg\032\021.protobuf.BoolRes" + "\022.\n\010UseSkill\022\017.protobuf.IDMsg\032\021.protobuf" + ".BoolRes\0223\n\013SendMessage\022\021.protobuf.SendM" + "sg\032\021.protobuf.BoolRes\0221\n\013HaveMessage\022\017.p" + "rotobuf.IDMsg\032\021.protobuf.BoolRes\022/\n\nGetM" + "essage\022\017.protobuf.IDMsg\032\020.protobuf.MsgRe" + "s\0224\n\nFixMachine\022\017.protobuf.IDMsg\032\021.proto" + "buf.BoolRes(\0010\001\0223\n\tSaveHuman\022\017.protobuf." + "IDMsg\032\021.protobuf.BoolRes(\0010\001\0220\n\006Attack\022\023" + ".protobuf.AttackMsg\032\021.protobuf.BoolRes\0220" + "\n\nCarryHuman\022\017.protobuf.IDMsg\032\021.protobuf" + ".BoolRes\0222\n\014ReleaseHuman\022\017.protobuf.IDMs" + "g\032\021.protobuf.BoolRes\022/\n\tHangHuman\022\017.prot" + "obuf.IDMsg\032\021.protobuf.BoolRes\022,\n\006Escape\022" + "\017.protobuf.IDMsg\032\021.protobuf.BoolResb\006pro" + "to3"; static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable* const descriptor_table_Message2Clients_2eproto_deps[2] = { &::descriptor_table_Message2Server_2eproto, &::descriptor_table_MessageType_2eproto, @@ -468,13 +507,13 @@ static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_Message2Cli const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_Message2Clients_2eproto = { false, false, - 2181, + 2363, descriptor_table_protodef_Message2Clients_2eproto, "Message2Clients.proto", &descriptor_table_Message2Clients_2eproto_once, descriptor_table_Message2Clients_2eproto_deps, 2, - 9, + 10, schemas, file_default_instances, TableStruct_Message2Clients_2eproto::offsets, @@ -3831,6 +3870,311 @@ namespace protobuf ); } + // =================================================================== + + class MsgRes::_Internal + { + public: + }; + + MsgRes::MsgRes(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned) : + ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) + { + SharedCtor(); + if (!is_message_owned) + { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:protobuf.MsgRes) + } + MsgRes::MsgRes(const MsgRes& from) : + ::PROTOBUF_NAMESPACE_ID::Message() + { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + message_received_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + message_received_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (!from._internal_message_received().empty()) + { + message_received_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_message_received(), GetArenaForAllocation()); + } + ::memcpy(&from_player_id_, &from.from_player_id_, static_cast(reinterpret_cast(&have_message_) - reinterpret_cast(&from_player_id_)) + sizeof(have_message_)); + // @@protoc_insertion_point(copy_constructor:protobuf.MsgRes) + } + + inline void MsgRes::SharedCtor() + { + message_received_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + message_received_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + ::memset(reinterpret_cast(this) + static_cast(reinterpret_cast(&from_player_id_) - reinterpret_cast(this)), 0, static_cast(reinterpret_cast(&have_message_) - reinterpret_cast(&from_player_id_)) + sizeof(have_message_)); + } + + MsgRes::~MsgRes() + { + // @@protoc_insertion_point(destructor:protobuf.MsgRes) + if (GetArenaForAllocation() != nullptr) + return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + inline void MsgRes::SharedDtor() + { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + message_received_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + } + + void MsgRes::ArenaDtor(void* object) + { + MsgRes* _this = reinterpret_cast(object); + (void)_this; + } + void MsgRes::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) + { + } + void MsgRes::SetCachedSize(int size) const + { + _cached_size_.Set(size); + } + + void MsgRes::Clear() + { + // @@protoc_insertion_point(message_clear_start:protobuf.MsgRes) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; + + message_received_.ClearToEmpty(); + ::memset(&from_player_id_, 0, static_cast(reinterpret_cast(&have_message_) - reinterpret_cast(&from_player_id_)) + sizeof(have_message_)); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + const char* MsgRes::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) + { +#define CHK_(x) \ + if (PROTOBUF_PREDICT_FALSE(!(x))) \ + goto failure + while (!ctx->Done(&ptr)) + { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) + { + // bool have_message = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) + { + have_message_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } + else + goto handle_unusual; + continue; + // int64 from_player_id = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) + { + from_player_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } + else + goto handle_unusual; + continue; + // string message_received = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 26)) + { + auto str = _internal_mutable_message_received(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "protobuf.MsgRes.message_received")); + CHK_(ptr); + } + else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) + { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, + ctx + ); + CHK_(ptr != nullptr); + } // while + message_done: + return ptr; + failure: + ptr = nullptr; + goto message_done; +#undef CHK_ + } + + uint8_t* MsgRes::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream + ) const + { + // @@protoc_insertion_point(serialize_to_array_start:protobuf.MsgRes) + uint32_t cached_has_bits = 0; + (void)cached_has_bits; + + // bool have_message = 1; + if (this->_internal_have_message() != 0) + { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(1, this->_internal_have_message(), target); + } + + // int64 from_player_id = 2; + if (this->_internal_from_player_id() != 0) + { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(2, this->_internal_from_player_id(), target); + } + + // string message_received = 3; + if (!this->_internal_message_received().empty()) + { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_message_received().data(), static_cast(this->_internal_message_received().length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, "protobuf.MsgRes.message_received" + ); + target = stream->WriteStringMaybeAliased( + 3, this->_internal_message_received(), target + ); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) + { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream + ); + } + // @@protoc_insertion_point(serialize_to_array_end:protobuf.MsgRes) + return target; + } + + size_t MsgRes::ByteSizeLong() const + { + // @@protoc_insertion_point(message_byte_size_start:protobuf.MsgRes) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; + + // string message_received = 3; + if (!this->_internal_message_received().empty()) + { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_message_received() + ); + } + + // int64 from_player_id = 2; + if (this->_internal_from_player_id() != 0) + { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_from_player_id()); + } + + // bool have_message = 1; + if (this->_internal_have_message() != 0) + { + total_size += 1 + 1; + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); + } + + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData MsgRes::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + MsgRes::MergeImpl}; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData* MsgRes::GetClassData() const + { + return &_class_data_; + } + + void MsgRes::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from) + { + static_cast(to)->MergeFrom( + static_cast(from) + ); + } + + void MsgRes::MergeFrom(const MsgRes& from) + { + // @@protoc_insertion_point(class_specific_merge_from_start:protobuf.MsgRes) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void)cached_has_bits; + + if (!from._internal_message_received().empty()) + { + _internal_set_message_received(from._internal_message_received()); + } + if (from._internal_from_player_id() != 0) + { + _internal_set_from_player_id(from._internal_from_player_id()); + } + if (from._internal_have_message() != 0) + { + _internal_set_have_message(from._internal_have_message()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + } + + void MsgRes::CopyFrom(const MsgRes& from) + { + // @@protoc_insertion_point(class_specific_copy_from_start:protobuf.MsgRes) + if (&from == this) + return; + Clear(); + MergeFrom(from); + } + + bool MsgRes::IsInitialized() const + { + return true; + } + + void MsgRes::InternalSwap(MsgRes* other) + { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &message_received_, + lhs_arena, + &other->message_received_, + rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(MsgRes, have_message_) + sizeof(MsgRes::have_message_) - PROTOBUF_FIELD_OFFSET(MsgRes, from_player_id_)>( + reinterpret_cast(&from_player_id_), + reinterpret_cast(&other->from_player_id_) + ); + } + + ::PROTOBUF_NAMESPACE_ID::Metadata MsgRes::GetMetadata() const + { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_Message2Clients_2eproto_getter, &descriptor_table_Message2Clients_2eproto_once, file_level_metadata_Message2Clients_2eproto[9] + ); + } + // @@protoc_insertion_point(namespace_scope) } // namespace protobuf PROTOBUF_NAMESPACE_OPEN @@ -3879,6 +4223,11 @@ PROTOBUF_NOINLINE ::protobuf::BoolRes* Arena::CreateMaybeMessage<::protobuf::Boo { return Arena::CreateMessageInternal<::protobuf::BoolRes>(arena); } +template<> +PROTOBUF_NOINLINE ::protobuf::MsgRes* Arena::CreateMaybeMessage<::protobuf::MsgRes>(Arena* arena) +{ + return Arena::CreateMessageInternal<::protobuf::MsgRes>(arena); +} PROTOBUF_NAMESPACE_CLOSE // @@protoc_insertion_point(global_scope) diff --git a/CAPI/proto/Message2Clients.pb.h b/CAPI/proto/Message2Clients.pb.h index 82549e9..1538456 100644 --- a/CAPI/proto/Message2Clients.pb.h +++ b/CAPI/proto/Message2Clients.pb.h @@ -48,7 +48,7 @@ struct TableStruct_Message2Clients_2eproto { static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTableField entries[] PROTOBUF_SECTION_VARIABLE(protodesc_cold); static const ::PROTOBUF_NAMESPACE_ID::internal::AuxiliaryParseTableField aux[] PROTOBUF_SECTION_VARIABLE(protodesc_cold); - static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[9] PROTOBUF_SECTION_VARIABLE(protodesc_cold); + static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[10] PROTOBUF_SECTION_VARIABLE(protodesc_cold); static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[]; static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[]; static const uint32_t offsets[]; @@ -83,6 +83,9 @@ namespace protobuf class MoveRes; struct MoveResDefaultTypeInternal; extern MoveResDefaultTypeInternal _MoveRes_default_instance_; + class MsgRes; + struct MsgResDefaultTypeInternal; + extern MsgResDefaultTypeInternal _MsgRes_default_instance_; } // namespace protobuf PROTOBUF_NAMESPACE_OPEN template<> @@ -103,6 +106,8 @@ template<> ::protobuf::MessageToClient* Arena::CreateMaybeMessage<::protobuf::MessageToClient>(Arena*); template<> ::protobuf::MoveRes* Arena::CreateMaybeMessage<::protobuf::MoveRes>(Arena*); +template<> +::protobuf::MsgRes* Arena::CreateMaybeMessage<::protobuf::MsgRes>(Arena*); PROTOBUF_NAMESPACE_CLOSE namespace protobuf { @@ -2372,6 +2377,221 @@ namespace protobuf mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; friend struct ::TableStruct_Message2Clients_2eproto; }; + // ------------------------------------------------------------------- + + class MsgRes final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:protobuf.MsgRes) */ + { + public: + inline MsgRes() : + MsgRes(nullptr) + { + } + ~MsgRes() override; + explicit constexpr MsgRes(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + MsgRes(const MsgRes& from); + MsgRes(MsgRes&& from) noexcept + : + MsgRes() + { + *this = ::std::move(from); + } + + inline MsgRes& operator=(const MsgRes& from) + { + CopyFrom(from); + return *this; + } + inline MsgRes& operator=(MsgRes&& from) noexcept + { + if (this == &from) + return *this; + if (GetOwningArena() == from.GetOwningArena() +#ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr +#endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) + { + InternalSwap(&from); + } + else + { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() + { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() + { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() + { + return default_instance().GetMetadata().reflection; + } + static const MsgRes& default_instance() + { + return *internal_default_instance(); + } + static inline const MsgRes* internal_default_instance() + { + return reinterpret_cast( + &_MsgRes_default_instance_ + ); + } + static constexpr int kIndexInFileMessages = + 9; + + friend void swap(MsgRes& a, MsgRes& b) + { + a.Swap(&b); + } + inline void Swap(MsgRes* other) + { + if (other == this) + return; +#ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) + { +#else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) + { +#endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } + else + { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(MsgRes* other) + { + if (other == this) + return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + MsgRes* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final + { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const MsgRes& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const MsgRes& from); + + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream + ) const final; + int GetCachedSize() const final + { + return _cached_size_.Get(); + } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(MsgRes* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() + { + return "protobuf.MsgRes"; + } + + protected: + explicit MsgRes(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned = false); + + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + + public: + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData* GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int + { + kMessageReceivedFieldNumber = 3, + kFromPlayerIdFieldNumber = 2, + kHaveMessageFieldNumber = 1, + }; + // string message_received = 3; + void clear_message_received(); + const std::string& message_received() const; + template + void set_message_received(ArgT0&& arg0, ArgT... args); + std::string* mutable_message_received(); + PROTOBUF_NODISCARD std::string* release_message_received(); + void set_allocated_message_received(std::string* message_received); + + private: + const std::string& _internal_message_received() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_message_received(const std::string& value); + std::string* _internal_mutable_message_received(); + + public: + // int64 from_player_id = 2; + void clear_from_player_id(); + int64_t from_player_id() const; + void set_from_player_id(int64_t value); + + private: + int64_t _internal_from_player_id() const; + void _internal_set_from_player_id(int64_t value); + + public: + // bool have_message = 1; + void clear_have_message(); + bool have_message() const; + void set_have_message(bool value); + + private: + bool _internal_have_message() const; + void _internal_set_have_message(bool value); + + public: + // @@protoc_insertion_point(class_scope:protobuf.MsgRes) + + private: + class _Internal; + + template + friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr message_received_; + int64_t from_player_id_; + bool have_message_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_Message2Clients_2eproto; + }; // =================================================================== // =================================================================== @@ -3895,6 +4115,115 @@ namespace protobuf // @@protoc_insertion_point(field_set:protobuf.BoolRes.act_success) } + // ------------------------------------------------------------------- + + // MsgRes + + // bool have_message = 1; + inline void MsgRes::clear_have_message() + { + have_message_ = false; + } + inline bool MsgRes::_internal_have_message() const + { + return have_message_; + } + inline bool MsgRes::have_message() const + { + // @@protoc_insertion_point(field_get:protobuf.MsgRes.have_message) + return _internal_have_message(); + } + inline void MsgRes::_internal_set_have_message(bool value) + { + have_message_ = value; + } + inline void MsgRes::set_have_message(bool value) + { + _internal_set_have_message(value); + // @@protoc_insertion_point(field_set:protobuf.MsgRes.have_message) + } + + // int64 from_player_id = 2; + inline void MsgRes::clear_from_player_id() + { + from_player_id_ = int64_t{0}; + } + inline int64_t MsgRes::_internal_from_player_id() const + { + return from_player_id_; + } + inline int64_t MsgRes::from_player_id() const + { + // @@protoc_insertion_point(field_get:protobuf.MsgRes.from_player_id) + return _internal_from_player_id(); + } + inline void MsgRes::_internal_set_from_player_id(int64_t value) + { + from_player_id_ = value; + } + inline void MsgRes::set_from_player_id(int64_t value) + { + _internal_set_from_player_id(value); + // @@protoc_insertion_point(field_set:protobuf.MsgRes.from_player_id) + } + + // string message_received = 3; + inline void MsgRes::clear_message_received() + { + message_received_.ClearToEmpty(); + } + inline const std::string& MsgRes::message_received() const + { + // @@protoc_insertion_point(field_get:protobuf.MsgRes.message_received) + return _internal_message_received(); + } + template + inline PROTOBUF_ALWAYS_INLINE void MsgRes::set_message_received(ArgT0&& arg0, ArgT... args) + { + message_received_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:protobuf.MsgRes.message_received) + } + inline std::string* MsgRes::mutable_message_received() + { + std::string* _s = _internal_mutable_message_received(); + // @@protoc_insertion_point(field_mutable:protobuf.MsgRes.message_received) + return _s; + } + inline const std::string& MsgRes::_internal_message_received() const + { + return message_received_.Get(); + } + inline void MsgRes::_internal_set_message_received(const std::string& value) + { + message_received_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); + } + inline std::string* MsgRes::_internal_mutable_message_received() + { + return message_received_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); + } + inline std::string* MsgRes::release_message_received() + { + // @@protoc_insertion_point(field_release:protobuf.MsgRes.message_received) + return message_received_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + } + inline void MsgRes::set_allocated_message_received(std::string* message_received) + { + if (message_received != nullptr) + { + } + else + { + } + message_received_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), message_received, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (message_received_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) + { + message_received_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:protobuf.MsgRes.message_received) + } + #ifdef __GNUC__ #pragma GCC diagnostic pop #endif // __GNUC__ @@ -3914,6 +4243,8 @@ namespace protobuf // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + // @@protoc_insertion_point(namespace_scope) } // namespace protobuf diff --git a/dependency/proto/Message2Clients.proto b/dependency/proto/Message2Clients.proto index 0017aa3..ec6beea 100755 --- a/dependency/proto/Message2Clients.proto +++ b/dependency/proto/Message2Clients.proto @@ -90,6 +90,13 @@ message BoolRes // 用于只需要判断执行操作是否成功的行为,如 bool act_success = 1; } +message MsgRes // 用于获取队友发来的消息 +{ + bool have_message = 1; // 是否有待接收的消息 + int64 from_player_id = 2; + string message_received = 3; +} + service AvailableService { // 游戏开局调用一次的服务 @@ -101,6 +108,8 @@ service AvailableService 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); @@ -108,5 +117,5 @@ service AvailableService rpc ReleaseHuman (IDMsg) returns (BoolRes); rpc HangHuman (IDMsg) returns (BoolRes); rpc Escape (IDMsg) returns (BoolRes); - + } \ No newline at end of file From 250af1de52291c1b1170ff190dc9f9d4d5d4b5c3 Mon Sep 17 00:00:00 2001 From: shangfengh <3495281661@qq.com> Date: Sat, 15 Oct 2022 15:18:54 +0800 Subject: [PATCH 05/15] fix: logic/Preparation/.../Imoveable.cs reuse IgnoreCollide --- logic/Preparation/Interface/IMoveable.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/logic/Preparation/Interface/IMoveable.cs b/logic/Preparation/Interface/IMoveable.cs index 000a534..bc16f5b 100644 --- a/logic/Preparation/Interface/IMoveable.cs +++ b/logic/Preparation/Interface/IMoveable.cs @@ -8,7 +8,7 @@ namespace Preparation.Interface object MoveLock { get; } public int MoveSpeed { get; } public long Move(Vector moveVec); - // protected bool IgnoreCollide(IGameObj targetObj); // 忽略碰撞,在具体类中实现 + protected bool IgnoreCollide(IGameObj targetObj); // 忽略碰撞,在具体类中实现 public bool WillCollideWith(IGameObj? targetObj, XYPosition nextPos) // 检查下一位置是否会和目标物碰撞 { if (targetObj == null) @@ -16,7 +16,8 @@ namespace Preparation.Interface // 会移动的只有子弹和人物,都是Circle if (!targetObj.IsRigid || targetObj.ID == ID) return false; - // if (IgnoreCollide(targetObj)) return false; + if (IgnoreCollide(targetObj)) + return false; if (targetObj.Shape == ShapeType.Circle) { return XYPosition.Distance(nextPos, targetObj.Position) < targetObj.Radius + Radius; From 64892b68903d471f767fc3f45ebace25801d4a34 Mon Sep 17 00:00:00 2001 From: DragonAura Date: Sat, 15 Oct 2022 15:59:08 +0800 Subject: [PATCH 06/15] chore: add temp CMakeLists --- CAPI/CMakeLists.txt | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 CAPI/CMakeLists.txt diff --git a/CAPI/CMakeLists.txt b/CAPI/CMakeLists.txt new file mode 100644 index 0000000..6741c18 --- /dev/null +++ b/CAPI/CMakeLists.txt @@ -0,0 +1,26 @@ +# 临时CMakeLists,仅供本地调试用 +cmake_minimum_required(VERSION 3.5) + +project(THUAI6_CAPI VERSION 1.0) + +set(CMAKE_CXX_STANDARD 17) + +aux_source_directory(./API/src CPP_LIST) +aux_source_directory(./proto PROTO_CPP_LIST) + +find_package(Protobuf CONFIG REQUIRED) +find_package(gRPC CONFIG REQUIRED) + +message(STATUS "Using protobuf ${Protobuf_VERSION}") +message(STATUS "Using gRPC ${gRPC_VERSION}") + +add_executable(capi ${CPP_LIST} ${PROTO_CPP_LIST}) + +target_include_directories(capi PUBLIC ${PROJECT_SOURCE_DIR}/proto ${PROJECT_SOURCE_DIR}/API/include) + +target_link_libraries(capi +protobuf::libprotobuf +gRPC::grpc +gRPC::grpc++_reflection +gRPC::grpc++ +) \ No newline at end of file From a8b9e253f44de35837a5c1593873145e2c61ebbc Mon Sep 17 00:00:00 2001 From: DragonAura Date: Sat, 15 Oct 2022 16:10:37 +0800 Subject: [PATCH 07/15] chore: edit .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index d497d0a..490019b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ # .vs, .vscode must be ignored .vs/ .vscode/ +CAPI/build From 84fc6ec4c58afbd9a9a4a195bf6d2c5f1339aae2 Mon Sep 17 00:00:00 2001 From: DragonAura Date: Sat, 15 Oct 2022 19:38:11 +0800 Subject: [PATCH 08/15] chore: add structures.h and API.h(unfinished) --- CAPI/API/include/API.h | 154 ++++++++++++++++++++++++ CAPI/API/include/structures.h | 151 +++++++++++++++++++++++ CAPI/proto/Message2Clients.pb.cc | 158 +++++++++++++++++-------- CAPI/proto/Message2Clients.pb.h | 72 +++++++++++ dependency/proto/Message2Clients.proto | 2 + 5 files changed, 487 insertions(+), 50 deletions(-) create mode 100644 CAPI/API/include/API.h create mode 100644 CAPI/API/include/structures.h diff --git a/CAPI/API/include/API.h b/CAPI/API/include/API.h new file mode 100644 index 0000000..9a2c9e1 --- /dev/null +++ b/CAPI/API/include/API.h @@ -0,0 +1,154 @@ +#pragma once +#ifndef API_H +#define API_H + +#ifdef _MSC_VER +#pragma warning(disable : 4996) +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "structures.h" + +const constexpr int num_of_grid_per_cell = 1000; + +class ILogic +{ + // API中依赖Logic的部分 + +public: + // 获取服务器发来的所有消息,要注意线程安全问题 + virtual protobuf::MessageToClient GetFullMessage() = 0; + + // 供IAPI使用的操作相关的部分 + virtual bool Move(protobuf::MoveMsg) = 0; + virtual bool PickProp(protobuf::PickMsg) = 0; + virtual bool UseProp(protobuf::IDMsg) = 0; + virtual bool UseSkill(protobuf::IDMsg) = 0; + virtual void SendMessage(protobuf::SendMsg) = 0; + virtual bool HaveMessage(protobuf::IDMsg) = 0; + virtual protobuf::MsgRes GetMessage(protobuf::IDMsg) = 0; + + virtual bool Escape(protobuf::IDMsg) = 0; + + // 说明:双向stream由三个函数共同实现,两个记录开始和结束,结果由Logic里的私有的成员变量记录,获得返回值则另调函数 + virtual bool StartFixMachine(protobuf::IDMsg) = 0; + virtual bool EndFixMachine(protobuf::IDMsg) = 0; + virtual bool GetFixStatus() = 0; + + virtual bool StartSaveHuman(protobuf::IDMsg) = 0; + virtual bool EndSaveHuman(protobuf::IDMsg) = 0; + virtual bool GetSaveStatus() = 0; + + virtual bool Attack(protobuf::AttackMsg) = 0; + virtual bool CarryHuman(protobuf::IDMsg) = 0; + virtual bool ReleaseHuman(protobuf::IDMsg) = 0; + virtual bool HangHuman(protobuf::IDMsg) = 0; + + virtual bool WaitThread() = 0; + + virtual int GetCounter() = 0; +}; + +class IAPI +{ +public: + // 选手可执行的操作,应当保证所有函数的返回值都应当为std::future,例如下面的移动函数: + // 指挥本角色进行移动,`timeInMilliseconds` 为移动时间,单位为毫秒;`angleInRadian` 表示移动的方向,单位是弧度,使用极坐标——竖直向下方向为 x 轴,水平向右方向为 y 轴 + virtual std::future Move(uint32_t timeInMilliseconds, double angleInRadian) = 0; + + // 向特定方向移动 + virtual std::future MoveRight(uint32_t timeInMilliseconds) = 0; + virtual std::future MoveUp(uint32_t timeInMilliseconds) = 0; + virtual std::future MoveLeft(uint32_t timeInMilliseconds) = 0; + virtual std::future MoveDown(uint32_t timeInMilliseconds) = 0; + + // 捡道具、使用技能 + virtual std::future PickProp() = 0; + virtual std::future UseProp() = 0; + virtual std::future UseSkill() = 0; + + // 发送信息、接受信息 + virtual std::future SendMessage(int, std::string) = 0; + [[nodiscard]] virtual std::future HaveMessage() = 0; + [[nodiscard]] virtual std::future> GetMessage() = 0; + + // 等待下一帧 + virtual std::future Wait() = 0; + + // 获取视野内可见的人类/屠夫的信息 + [[nodiscard]] virtual std::vector> GetHuman() const = 0; + [[nodiscard]] virtual std::vector> GetButcher() const = 0; + + // 获取视野内可见的道具信息 + [[nodiscard]] virtual std::vector> GetProps() const = 0; + + // 获取地图信息,视野外的地图统一为Land + [[nodiscard]] virtual std::array, 50> GetFullMap() const = 0; + [[nodiscard]] virtual THUAI6::PlaceType GetPlaceType(int32_t CellX, int32_t CellY) const = 0; + + // 获取所有玩家的GUID + [[nodiscard]] virtual const std::vector GetPlayerGUIDs() const = 0; + + // 获取游戏目前所进行的帧数 + [[nodiscard]] virtual int GetFrameCount() const = 0; + + /*****选手可能用的辅助函数*****/ + + // 获取指定格子中心的坐标 + [[nodiscard]] static inline int CellToGrid(int cell) noexcept + { + return cell * num_of_grid_per_cell + num_of_grid_per_cell / 2; + } + + // 获取指定坐标点所位于的格子的 X 序号 + [[nodiscard]] static inline int GridToCell(int grid) noexcept + { + return grid / num_of_grid_per_cell; + } + + IAPI(ILogic& logic) : + logic(logic) + { + } + + virtual ~IAPI() + { + } + +protected: + ILogic& logic; +}; + +class IHumanAPI : public IAPI +{ +public: + virtual std::future StartFixMachine() = 0; + virtual std::future EndFixMachine() = 0; + virtual std::future GetFixStatus() = 0; + virtual std::future StartSaveHuman() = 0; + virtual std::future EndSaveHuman() = 0; + virtual std::future GetSaveStatus() = 0; + virtual std::future Escape() = 0; + [[nodiscard]] virtual std::shared_ptr GetSelfInfo() const = 0; +}; + +class IButcherAPI : public IAPI +{ +public: + virtual std::future Attack(double angleInRadian) = 0; + virtual std::future CarryHuman() = 0; + virtual std::future ReleaseHuman() = 0; + virtual std::future HangHuman() = 0; + [[nodiscard]] virtual std::shared_ptr GetSelfInfo() const = 0; +}; + +#endif \ No newline at end of file diff --git a/CAPI/API/include/structures.h b/CAPI/API/include/structures.h new file mode 100644 index 0000000..06dd24c --- /dev/null +++ b/CAPI/API/include/structures.h @@ -0,0 +1,151 @@ +#pragma once +#ifndef STRUCTURES_H +#define STRUCTURES_H + +#include +#include +#include + +namespace THUAI6 +{ + // 所有NullXXXType均为错误类型,其余为可能出现的正常类型 + + // 位置标志 + enum class PlaceType : unsigned char + { + NullPlaceType = 0, + Land = 1, + Wall = 2, + Grass = 3, + Machine = 4, + Gate = 5, + HiddenGate = 6, + }; + + // 形状标志 + enum class ShapeType : unsigned char + { + NullShapeType = 0, + Circle = 1, + Square = 2, + }; + + // 道具类型 + enum class PropType : unsigned char + { + NullPropType = 0, + PropType1 = 1, + PropType2 = 2, + PropType3 = 3, + PropType4 = 4, + }; + + // 玩家类型 + enum class PlayerType : unsigned char + { + NullPlayerType = 0, + HumanPlayer = 1, + ButcherType = 2, + }; + + // 人类类型 + enum class HumanType : unsigned char + { + NullHumanType = 0, + HumanType1 = 1, + HumanType2 = 2, + HumanType3 = 3, + HumanType4 = 4, + }; + + // 屠夫类型 + enum class ButcherType : unsigned char + { + NullButcherType = 0, + ButcherType1 = 1, + ButcherType2 = 2, + ButcherType3 = 3, + ButcherType4 = 4, + }; + + // 人类Buff类型 + enum class HumanBuffType : unsigned char + { + NullHumanBuffType = 0, + HumanBuffType1 = 1, + HumanBuffType2 = 2, + HumanBuffType3 = 3, + HumanBuffType4 = 4, + }; + + // 玩家类 + struct Player + { + int32_t x; // x坐标 + int32_t y; // y坐标 + uint32_t speed; // 移动速度 + uint32_t viewRange; // 视野范围 + uint64_t playerID; // 玩家ID + uint64_t guid; // 全局唯一ID + uint16_t radius; // 圆形物体的半径或正方形物体的内切圆半径 + + double timeUntilSkillAvailable; // 技能冷却时间 + + PlayerType playerType; // 玩家类型 + PropType prop; // 手上的道具类型 + PlaceType place; // 所处格子的类型 + }; + + struct Human : public Player + { + bool onChair; // 是否被挂 + bool onGround; // 是否倒地 + uint32_t life; // 剩余生命(本次倒地之前还能承受的伤害) + uint32_t hangedTime; // 被挂的次数 + + HumanType humanType; // 人类类型 + std::vector buff; // buff + }; + + struct Butcher : public Player + { + uint32_t damage; // 攻击伤害 + bool movable; // 是否处在攻击后摇中 + + ButcherType butcherType; // 屠夫类型 + std::vector buff; // buff + }; + + struct Prop + { + int32_t x; + int32_t y; + uint32_t size; + uint64_t guid; + PropType type; + PlaceType place; + double facingDirection; // 朝向 + bool isMoving; + }; + + // 仅供DEBUG使用,名称可改动 + // 还没写完,后面待续 + + inline std::map placeDict{ + {PlaceType::NullPlaceType, "NullPlaceType"}, + {PlaceType::Land, "Land"}, + {PlaceType::Wall, "Wall"}, + {PlaceType::Grass, "Grass"}, + {PlaceType::Machine, "Machine"}, + {PlaceType::Gate, "Gate"}, + {PlaceType::HiddenGate, "HiddenGate"}, + }; + + inline std::map propDict{ + {PropType::NullPropType, "NullPropType"}, + + }; + +} // namespace THUAI6 + +#endif diff --git a/CAPI/proto/Message2Clients.pb.cc b/CAPI/proto/Message2Clients.pb.cc index 812953d..cfb7103 100644 --- a/CAPI/proto/Message2Clients.pb.cc +++ b/CAPI/proto/Message2Clients.pb.cc @@ -114,7 +114,9 @@ namespace protobuf place_(0) , - guid_(int64_t{0}) + guid_(int64_t{0}), + size_(0), + is_moving_(false) { } struct MessageOfPropDefaultTypeInternal @@ -352,6 +354,8 @@ const uint32_t TableStruct_Message2Clients_2eproto::offsets[] PROTOBUF_SECTION_V PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfProp, facing_direction_), PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfProp, guid_), PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfProp, place_), + PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfProp, size_), + PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfProp, is_moving_), ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfPickedProp, _internal_metadata_), ~0u, // no _extensions_ @@ -416,13 +420,13 @@ static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOB {0, -1, -1, sizeof(::protobuf::MessageOfHuman)}, {23, -1, -1, sizeof(::protobuf::MessageOfButcher)}, {42, -1, -1, sizeof(::protobuf::MessageOfProp)}, - {54, -1, -1, sizeof(::protobuf::MessageOfPickedProp)}, - {65, -1, -1, sizeof(::protobuf::MessageOfMap_Row)}, - {72, -1, -1, sizeof(::protobuf::MessageOfMap)}, - {79, -1, -1, sizeof(::protobuf::MessageToClient)}, - {89, -1, -1, sizeof(::protobuf::MoveRes)}, - {97, -1, -1, sizeof(::protobuf::BoolRes)}, - {104, -1, -1, sizeof(::protobuf::MsgRes)}, + {56, -1, -1, sizeof(::protobuf::MessageOfPickedProp)}, + {67, -1, -1, sizeof(::protobuf::MessageOfMap_Row)}, + {74, -1, -1, sizeof(::protobuf::MessageOfMap)}, + {81, -1, -1, sizeof(::protobuf::MessageToClient)}, + {91, -1, -1, sizeof(::protobuf::MoveRes)}, + {99, -1, -1, sizeof(::protobuf::BoolRes)}, + {106, -1, -1, sizeof(::protobuf::MsgRes)}, }; static ::PROTOBUF_NAMESPACE_ID::Message const* const file_default_instances[] = { @@ -459,46 +463,46 @@ const char descriptor_table_protodef_Message2Clients_2eproto[] PROTOBUF_SECTION_ " \001(\0162\025.protobuf.ButcherType\022\014\n\004guid\030\t \001(" "\003\022\017\n\007movable\030\n \001(\010\022\020\n\010playerID\030\013 \001(\003\022\022\n\n" "view_range\030\014 \001(\005\022\'\n\004buff\030\r \003(\0162\031.protobu" - "f.ButcherBuffType\"\223\001\n\rMessageOfProp\022 \n\004t" + "f.ButcherBuffType\"\264\001\n\rMessageOfProp\022 \n\004t" "ype\030\001 \001(\0162\022.protobuf.PropType\022\t\n\001x\030\002 \001(\005" "\022\t\n\001y\030\003 \001(\005\022\030\n\020facing_direction\030\004 \001(\001\022\014\n" "\004guid\030\005 \001(\003\022\"\n\005place\030\006 \001(\0162\023.protobuf.Pl" - "aceType\"{\n\023MessageOfPickedProp\022 \n\004type\030\001" - " \001(\0162\022.protobuf.PropType\022\t\n\001x\030\002 \001(\005\022\t\n\001y" - "\030\003 \001(\005\022\030\n\020facing_direction\030\004 \001(\001\022\022\n\nmapp" - "ing_id\030\005 \001(\003\"`\n\014MessageOfMap\022\'\n\003row\030\002 \003(" - "\0132\032.protobuf.MessageOfMap.Row\032\'\n\003Row\022 \n\003" - "col\030\001 \003(\0162\023.protobuf.PlaceType\"\323\001\n\017Messa" - "geToClient\022/\n\rhuman_message\030\001 \003(\0132\030.prot" - "obuf.MessageOfHuman\0223\n\017butcher_message\030\002" - " \003(\0132\032.protobuf.MessageOfButcher\022-\n\014prop" - "_message\030\003 \003(\0132\027.protobuf.MessageOfProp\022" - "+\n\013map_massage\030\004 \001(\0132\026.protobuf.MessageO" - "fMap\"5\n\007MoveRes\022\024\n\014actual_speed\030\001 \001(\003\022\024\n" - "\014actual_angle\030\002 \001(\001\"\036\n\007BoolRes\022\023\n\013act_su" - "ccess\030\001 \001(\010\"P\n\006MsgRes\022\024\n\014have_message\030\001 " - "\001(\010\022\026\n\016from_player_id\030\002 \001(\003\022\030\n\020message_r" - "eceived\030\003 \001(\t2\213\006\n\020AvailableService\022=\n\tAd" - "dPlayer\022\023.protobuf.PlayerMsg\032\031.protobuf." - "MessageToClient0\001\022,\n\004Move\022\021.protobuf.Mov" - "eMsg\032\021.protobuf.MoveRes\0220\n\010PickProp\022\021.pr" - "otobuf.PickMsg\032\021.protobuf.BoolRes\022-\n\007Use" - "Prop\022\017.protobuf.IDMsg\032\021.protobuf.BoolRes" - "\022.\n\010UseSkill\022\017.protobuf.IDMsg\032\021.protobuf" - ".BoolRes\0223\n\013SendMessage\022\021.protobuf.SendM" - "sg\032\021.protobuf.BoolRes\0221\n\013HaveMessage\022\017.p" - "rotobuf.IDMsg\032\021.protobuf.BoolRes\022/\n\nGetM" - "essage\022\017.protobuf.IDMsg\032\020.protobuf.MsgRe" - "s\0224\n\nFixMachine\022\017.protobuf.IDMsg\032\021.proto" - "buf.BoolRes(\0010\001\0223\n\tSaveHuman\022\017.protobuf." - "IDMsg\032\021.protobuf.BoolRes(\0010\001\0220\n\006Attack\022\023" - ".protobuf.AttackMsg\032\021.protobuf.BoolRes\0220" - "\n\nCarryHuman\022\017.protobuf.IDMsg\032\021.protobuf" - ".BoolRes\0222\n\014ReleaseHuman\022\017.protobuf.IDMs" - "g\032\021.protobuf.BoolRes\022/\n\tHangHuman\022\017.prot" - "obuf.IDMsg\032\021.protobuf.BoolRes\022,\n\006Escape\022" - "\017.protobuf.IDMsg\032\021.protobuf.BoolResb\006pro" - "to3"; + "aceType\022\014\n\004size\030\007 \001(\005\022\021\n\tis_moving\030\010 \001(\010" + "\"{\n\023MessageOfPickedProp\022 \n\004type\030\001 \001(\0162\022." + "protobuf.PropType\022\t\n\001x\030\002 \001(\005\022\t\n\001y\030\003 \001(\005\022" + "\030\n\020facing_direction\030\004 \001(\001\022\022\n\nmapping_id\030" + "\005 \001(\003\"`\n\014MessageOfMap\022\'\n\003row\030\002 \003(\0132\032.pro" + "tobuf.MessageOfMap.Row\032\'\n\003Row\022 \n\003col\030\001 \003" + "(\0162\023.protobuf.PlaceType\"\323\001\n\017MessageToCli" + "ent\022/\n\rhuman_message\030\001 \003(\0132\030.protobuf.Me" + "ssageOfHuman\0223\n\017butcher_message\030\002 \003(\0132\032." + "protobuf.MessageOfButcher\022-\n\014prop_messag" + "e\030\003 \003(\0132\027.protobuf.MessageOfProp\022+\n\013map_" + "massage\030\004 \001(\0132\026.protobuf.MessageOfMap\"5\n" + "\007MoveRes\022\024\n\014actual_speed\030\001 \001(\003\022\024\n\014actual" + "_angle\030\002 \001(\001\"\036\n\007BoolRes\022\023\n\013act_success\030\001" + " \001(\010\"P\n\006MsgRes\022\024\n\014have_message\030\001 \001(\010\022\026\n\016" + "from_player_id\030\002 \001(\003\022\030\n\020message_received" + "\030\003 \001(\t2\213\006\n\020AvailableService\022=\n\tAddPlayer" + "\022\023.protobuf.PlayerMsg\032\031.protobuf.Message" + "ToClient0\001\022,\n\004Move\022\021.protobuf.MoveMsg\032\021." + "protobuf.MoveRes\0220\n\010PickProp\022\021.protobuf." + "PickMsg\032\021.protobuf.BoolRes\022-\n\007UseProp\022\017." + "protobuf.IDMsg\032\021.protobuf.BoolRes\022.\n\010Use" + "Skill\022\017.protobuf.IDMsg\032\021.protobuf.BoolRe" + "s\0223\n\013SendMessage\022\021.protobuf.SendMsg\032\021.pr" + "otobuf.BoolRes\0221\n\013HaveMessage\022\017.protobuf" + ".IDMsg\032\021.protobuf.BoolRes\022/\n\nGetMessage\022" + "\017.protobuf.IDMsg\032\020.protobuf.MsgRes\0224\n\nFi" + "xMachine\022\017.protobuf.IDMsg\032\021.protobuf.Boo" + "lRes(\0010\001\0223\n\tSaveHuman\022\017.protobuf.IDMsg\032\021" + ".protobuf.BoolRes(\0010\001\0220\n\006Attack\022\023.protob" + "uf.AttackMsg\032\021.protobuf.BoolRes\0220\n\nCarry" + "Human\022\017.protobuf.IDMsg\032\021.protobuf.BoolRe" + "s\0222\n\014ReleaseHuman\022\017.protobuf.IDMsg\032\021.pro" + "tobuf.BoolRes\022/\n\tHangHuman\022\017.protobuf.ID" + "Msg\032\021.protobuf.BoolRes\022,\n\006Escape\022\017.proto" + "buf.IDMsg\032\021.protobuf.BoolResb\006proto3"; static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable* const descriptor_table_Message2Clients_2eproto_deps[2] = { &::descriptor_table_Message2Server_2eproto, &::descriptor_table_MessageType_2eproto, @@ -507,7 +511,7 @@ static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_Message2Cli const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_Message2Clients_2eproto = { false, false, - 2363, + 2396, descriptor_table_protodef_Message2Clients_2eproto, "Message2Clients.proto", &descriptor_table_Message2Clients_2eproto_once, @@ -1875,13 +1879,13 @@ namespace protobuf ::PROTOBUF_NAMESPACE_ID::Message() { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); - ::memcpy(&type_, &from.type_, static_cast(reinterpret_cast(&guid_) - reinterpret_cast(&type_)) + sizeof(guid_)); + ::memcpy(&type_, &from.type_, static_cast(reinterpret_cast(&is_moving_) - reinterpret_cast(&type_)) + sizeof(is_moving_)); // @@protoc_insertion_point(copy_constructor:protobuf.MessageOfProp) } inline void MessageOfProp::SharedCtor() { - ::memset(reinterpret_cast(this) + static_cast(reinterpret_cast(&type_) - reinterpret_cast(this)), 0, static_cast(reinterpret_cast(&guid_) - reinterpret_cast(&type_)) + sizeof(guid_)); + ::memset(reinterpret_cast(this) + static_cast(reinterpret_cast(&type_) - reinterpret_cast(this)), 0, static_cast(reinterpret_cast(&is_moving_) - reinterpret_cast(&type_)) + sizeof(is_moving_)); } MessageOfProp::~MessageOfProp() @@ -1918,7 +1922,7 @@ namespace protobuf // Prevent compiler warnings about cached_has_bits being unused (void)cached_has_bits; - ::memset(&type_, 0, static_cast(reinterpret_cast(&guid_) - reinterpret_cast(&type_)) + sizeof(guid_)); + ::memset(&type_, 0, static_cast(reinterpret_cast(&is_moving_) - reinterpret_cast(&type_)) + sizeof(is_moving_)); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } @@ -1995,6 +1999,26 @@ namespace protobuf else goto handle_unusual; continue; + // int32 size = 7; + case 7: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 56)) + { + size_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } + else + goto handle_unusual; + continue; + // bool is_moving = 8; + case 8: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 64)) + { + is_moving_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } + else + goto handle_unusual; + continue; default: goto handle_unusual; } // switch @@ -2079,6 +2103,20 @@ namespace protobuf ); } + // int32 size = 7; + if (this->_internal_size() != 0) + { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(7, this->_internal_size(), target); + } + + // bool is_moving = 8; + if (this->_internal_is_moving() != 0) + { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(8, this->_internal_is_moving(), target); + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( @@ -2140,6 +2178,18 @@ namespace protobuf total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_guid()); } + // int32 size = 7; + if (this->_internal_size() != 0) + { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_size()); + } + + // bool is_moving = 8; + if (this->_internal_is_moving() != 0) + { + total_size += 1 + 1; + } + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } @@ -2193,6 +2243,14 @@ namespace protobuf { _internal_set_guid(from._internal_guid()); } + if (from._internal_size() != 0) + { + _internal_set_size(from._internal_size()); + } + if (from._internal_is_moving() != 0) + { + _internal_set_is_moving(from._internal_is_moving()); + } _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } @@ -2215,7 +2273,7 @@ namespace protobuf using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); ::PROTOBUF_NAMESPACE_ID::internal::memswap< - PROTOBUF_FIELD_OFFSET(MessageOfProp, guid_) + sizeof(MessageOfProp::guid_) - PROTOBUF_FIELD_OFFSET(MessageOfProp, type_)>( + PROTOBUF_FIELD_OFFSET(MessageOfProp, is_moving_) + sizeof(MessageOfProp::is_moving_) - PROTOBUF_FIELD_OFFSET(MessageOfProp, type_)>( reinterpret_cast(&type_), reinterpret_cast(&other->type_) ); diff --git a/CAPI/proto/Message2Clients.pb.h b/CAPI/proto/Message2Clients.pb.h index 1538456..d7e690b 100644 --- a/CAPI/proto/Message2Clients.pb.h +++ b/CAPI/proto/Message2Clients.pb.h @@ -1011,6 +1011,8 @@ namespace protobuf kYFieldNumber = 3, kPlaceFieldNumber = 6, kGuidFieldNumber = 5, + kSizeFieldNumber = 7, + kIsMovingFieldNumber = 8, }; // .protobuf.PropType type = 1; void clear_type(); @@ -1071,6 +1073,26 @@ namespace protobuf int64_t _internal_guid() const; void _internal_set_guid(int64_t value); + public: + // int32 size = 7; + void clear_size(); + int32_t size() const; + void set_size(int32_t value); + + private: + int32_t _internal_size() const; + void _internal_set_size(int32_t value); + + public: + // bool is_moving = 8; + void clear_is_moving(); + bool is_moving() const; + void set_is_moving(bool value); + + private: + bool _internal_is_moving() const; + void _internal_set_is_moving(bool value); + public: // @@protoc_insertion_point(class_scope:protobuf.MessageOfProp) @@ -1087,6 +1109,8 @@ namespace protobuf int32_t y_; int place_; int64_t guid_; + int32_t size_; + bool is_moving_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; friend struct ::TableStruct_Message2Clients_2eproto; }; @@ -3534,6 +3558,54 @@ namespace protobuf // @@protoc_insertion_point(field_set:protobuf.MessageOfProp.place) } + // int32 size = 7; + inline void MessageOfProp::clear_size() + { + size_ = 0; + } + inline int32_t MessageOfProp::_internal_size() const + { + return size_; + } + inline int32_t MessageOfProp::size() const + { + // @@protoc_insertion_point(field_get:protobuf.MessageOfProp.size) + return _internal_size(); + } + inline void MessageOfProp::_internal_set_size(int32_t value) + { + size_ = value; + } + inline void MessageOfProp::set_size(int32_t value) + { + _internal_set_size(value); + // @@protoc_insertion_point(field_set:protobuf.MessageOfProp.size) + } + + // bool is_moving = 8; + inline void MessageOfProp::clear_is_moving() + { + is_moving_ = false; + } + inline bool MessageOfProp::_internal_is_moving() const + { + return is_moving_; + } + inline bool MessageOfProp::is_moving() const + { + // @@protoc_insertion_point(field_get:protobuf.MessageOfProp.is_moving) + return _internal_is_moving(); + } + inline void MessageOfProp::_internal_set_is_moving(bool value) + { + is_moving_ = value; + } + inline void MessageOfProp::set_is_moving(bool value) + { + _internal_set_is_moving(value); + // @@protoc_insertion_point(field_set:protobuf.MessageOfProp.is_moving) + } + // ------------------------------------------------------------------- // MessageOfPickedProp diff --git a/dependency/proto/Message2Clients.proto b/dependency/proto/Message2Clients.proto index ec6beea..b03fdb8 100755 --- a/dependency/proto/Message2Clients.proto +++ b/dependency/proto/Message2Clients.proto @@ -51,6 +51,8 @@ message MessageOfProp // 可拾取道具的信息 double facing_direction = 4; int64 guid = 5; PlaceType place = 6; + int32 size = 7; + bool is_moving = 8; } message MessageOfPickedProp //for Unity,直接继承自THUAI5 From e567d89f3eb0e64193b50b5be206a2cd6513110a Mon Sep 17 00:00:00 2001 From: DragonAura Date: Sat, 15 Oct 2022 23:16:51 +0800 Subject: [PATCH 09/15] feat: improve oop design MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 仿照THUAI5的API设计模式 --- CAPI/API/include/API.h | 59 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 2 deletions(-) diff --git a/CAPI/API/include/API.h b/CAPI/API/include/API.h index 9a2c9e1..3aabda2 100644 --- a/CAPI/API/include/API.h +++ b/CAPI/API/include/API.h @@ -128,9 +128,24 @@ protected: ILogic& logic; }; -class IHumanAPI : public IAPI +// 给Logic使用的IAPI接口,为了保证面向对象的设计模式 +class IAPIForLogic : public IAPI +{ + IAPIForLogic(ILogic& logic) : + IAPI(logic) + { + } + virtual void StartTimer() = 0; + virtual void EndTimer() = 0; +}; + +class IHumanAPI : public IAPIForLogic { public: + HumanAPI(ILogic& logic) : + IAPIForLogic(logic) + { + } virtual std::future StartFixMachine() = 0; virtual std::future EndFixMachine() = 0; virtual std::future GetFixStatus() = 0; @@ -141,9 +156,13 @@ public: [[nodiscard]] virtual std::shared_ptr GetSelfInfo() const = 0; }; -class IButcherAPI : public IAPI +class IButcherAPI : public IAPIForLogic { public: + ButcherAPI(Logic& logic) : + IAPIForLogic(logic) + { + } virtual std::future Attack(double angleInRadian) = 0; virtual std::future CarryHuman() = 0; virtual std::future ReleaseHuman() = 0; @@ -151,4 +170,40 @@ public: [[nodiscard]] virtual std::shared_ptr GetSelfInfo() const = 0; }; +class HumanAPI : public IHumanAPI +{ +public: + HumanAPI(Logic& logic) : + logic(logic) + { + } +}; + +class DebugHumanAPI : public IHumanAPI +{ +public: + DebugHumanAPI(Logic& logic) : + logic(logic) + { + } +}; + +class ButhcerAPI : public IButcherAPI +{ +public: + ButhcerAPI(Logic& logic) : + logic(logic) + { + } +}; + +class DebugButcherAPI : public IButcherAPI +{ +public: + DebugButcherAPI(Logic& logic) : + logic(logic) + { + } +}; + #endif \ No newline at end of file From 424d48a06032115a91ebe9512b14f3c350fc2657 Mon Sep 17 00:00:00 2001 From: DragonAura Date: Sat, 22 Oct 2022 19:47:56 +0800 Subject: [PATCH 10/15] feat: :sparkles: build basic code structure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 基本完成了logic.h、state.h --- CAPI/API/include/AI.h | 13 ++++ CAPI/API/include/constants.h | 8 +++ CAPI/API/include/logic.h | 112 +++++++++++++++++++++++++++++++++++ CAPI/API/include/state.h | 27 +++++++++ CAPI/API/src/AI.cpp | 11 ++++ CAPI/API/src/logic.cpp | 7 +++ CAPI/CMakeLists.txt | 2 + 7 files changed, 180 insertions(+) create mode 100644 CAPI/API/include/AI.h create mode 100644 CAPI/API/include/constants.h create mode 100644 CAPI/API/include/logic.h create mode 100644 CAPI/API/include/state.h create mode 100644 CAPI/API/src/AI.cpp create mode 100644 CAPI/API/src/logic.cpp diff --git a/CAPI/API/include/AI.h b/CAPI/API/include/AI.h new file mode 100644 index 0000000..4fba3ad --- /dev/null +++ b/CAPI/API/include/AI.h @@ -0,0 +1,13 @@ +#pragma once +#ifndef AI_H +#define AI_H + +#include "API.h" + +class IAI +{ +public: + virtual void play(IAPI& appi) = 0; +}; + +#endif \ No newline at end of file diff --git a/CAPI/API/include/constants.h b/CAPI/API/include/constants.h new file mode 100644 index 0000000..735bd03 --- /dev/null +++ b/CAPI/API/include/constants.h @@ -0,0 +1,8 @@ +#pragma once +#ifndef CONSTANTS_H +#define CONSTANTS_H + +namespace Constants +{ +} +#endif \ No newline at end of file diff --git a/CAPI/API/include/logic.h b/CAPI/API/include/logic.h new file mode 100644 index 0000000..6851596 --- /dev/null +++ b/CAPI/API/include/logic.h @@ -0,0 +1,112 @@ +#pragma once + +#ifndef LOGIC_H +#define LOGIC_H + +#ifdef _MSC_VER +#pragma warning(disable : 4996) +#endif + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include "API.h" +#include "AI.h" + +// 封装了通信组件和对AI对象进行操作 +class Logic : public ILogic +{ +private: + // gRPC客户端的stub,所有与服务端之间的通信操作都需要基于stub完成。 + std::unique_ptr THUAI6Stub; + // ID、阵营记录 + int playerID; + THUAI6::PlayerType playerType; + + // 类型记录 + THUAI6::HumanType humanType; + THUAI6::ButcherType butcherType; + + // GUID信息 + std::vector playerGUIDs; + + // THUAI5中的通信组件可以完全被我们的stub取代,故无须再写 + + std::unique_ptr pAI; + + std::shared_ptr pAPI; + + std::thread tAI; + + mutable std::mutex mtxAI; + mutable std::mutex mtxState; + mutable std::mutex mtxBuffer; + + std::condition_variable cvBuffer; + std::condition_variable cvAI; + + // 信息队列目前可能会不用?具体待定 + + // 存储状态,分别是现在的状态和缓冲区的状态。 + State state[2]; + State* currentState; + State* bufferState; + + // 是否应该执行player() + std::atomic_bool AILoop = true; + + // buffer是否更新完毕 + bool bufferUpdated = true; + + // 是否可以启用当前状态 + bool currentStateAccessed = false; + + // 是否应当启动AI + bool AIStart = false; + + // 控制内容更新的变量 + std::atomic_bool freshed = false; + + // 所有API中声明的函数都需要在此处重写,先暂时略过,等到之后具体实现时再考虑 + + // 执行AI线程 + void PlayerWrapper(std::function player); + + // THUAI5中的一系列用于处理信息的函数可能也不会再用 + + // 将信息加载到buffer + void LoadBuffer(std::shared_ptr); + + // 解锁状态更新线程 + void UnBlockBuffer(); + + // 解锁AI线程 + void UnBlockAI(); + + // 更新状态 + void Update() noexcept; + + // 等待 + void Wait() noexcept; + +public: + // 构造函数还需要传更多参数,有待补充 + Logic(std::shared_ptr channel); + + ~Logic() = default; + + // Main函数同上 + void Main(); +}; + +#endif \ No newline at end of file diff --git a/CAPI/API/include/state.h b/CAPI/API/include/state.h new file mode 100644 index 0000000..f699d24 --- /dev/null +++ b/CAPI/API/include/state.h @@ -0,0 +1,27 @@ +#pragma once +#ifndef STATE_H +#define STATE_H + +#include + +#include "structures.h" + +// 存储场上的状态 +struct State +{ + uint32_t teamScore; + + // 自身信息,根据playerType的不同,可以调用的值也不同。 + std::shared_ptr humanSelf; + std::shared_ptr butcherSelf; + + std::vector> humans; + std::vector> butchers; + std::vector> props; + + THUAI6::PlaceType gamemap[51][51]; + + std::vector guids; +}; + +#endif \ No newline at end of file diff --git a/CAPI/API/src/AI.cpp b/CAPI/API/src/AI.cpp new file mode 100644 index 0000000..acaccd2 --- /dev/null +++ b/CAPI/API/src/AI.cpp @@ -0,0 +1,11 @@ +#include +#include +#include "AI.h" + +// 选手!!必须!!定义该变量来选择自己的阵营 +const THUAI6::PlayerType playerType = THUAI6::PlayerType::HumanPlayer; + +// 选手只需要定义两者中自己选中的那个即可,定义两个也不会有影响。 +const THUAI6::ButcherType butcherType = THUAI6::ButcherType::ButcherType1; + +const THUAI6::HumanType humanType = THUAI6::HumanType::HumanType1; diff --git a/CAPI/API/src/logic.cpp b/CAPI/API/src/logic.cpp new file mode 100644 index 0000000..9ef32c9 --- /dev/null +++ b/CAPI/API/src/logic.cpp @@ -0,0 +1,7 @@ +#pragma once +#include "logic.h" + +Logic::Logic(std::shared_ptr channel) : + THUAI6Stub(Protobuf::AvailableService::NewStub(channel)) +{ +} \ No newline at end of file diff --git a/CAPI/CMakeLists.txt b/CAPI/CMakeLists.txt index 6741c18..6b11ff0 100644 --- a/CAPI/CMakeLists.txt +++ b/CAPI/CMakeLists.txt @@ -5,6 +5,8 @@ project(THUAI6_CAPI VERSION 1.0) set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -pthread") + aux_source_directory(./API/src CPP_LIST) aux_source_directory(./proto PROTO_CPP_LIST) From 97ddbf89d16e13caa62b1b7d25f2fc1daa7c8f22 Mon Sep 17 00:00:00 2001 From: DragonAura Date: Sat, 22 Oct 2022 22:10:28 +0800 Subject: [PATCH 11/15] fix: :bug: fix some bugs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修了几个错误的构造函数及一些错误的拼写 --- CAPI/API/include/AI.h | 2 +- CAPI/API/include/API.h | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CAPI/API/include/AI.h b/CAPI/API/include/AI.h index 4fba3ad..c80728e 100644 --- a/CAPI/API/include/AI.h +++ b/CAPI/API/include/AI.h @@ -7,7 +7,7 @@ class IAI { public: - virtual void play(IAPI& appi) = 0; + virtual void play(IAPI& api) = 0; }; #endif \ No newline at end of file diff --git a/CAPI/API/include/API.h b/CAPI/API/include/API.h index 3aabda2..7d76642 100644 --- a/CAPI/API/include/API.h +++ b/CAPI/API/include/API.h @@ -142,7 +142,7 @@ class IAPIForLogic : public IAPI class IHumanAPI : public IAPIForLogic { public: - HumanAPI(ILogic& logic) : + IHumanAPI(ILogic& logic) : IAPIForLogic(logic) { } @@ -159,7 +159,7 @@ public: class IButcherAPI : public IAPIForLogic { public: - ButcherAPI(Logic& logic) : + IButcherAPI(Logic& logic) : IAPIForLogic(logic) { } @@ -174,7 +174,7 @@ class HumanAPI : public IHumanAPI { public: HumanAPI(Logic& logic) : - logic(logic) + IHumanAPI(logic) { } }; @@ -183,7 +183,7 @@ class DebugHumanAPI : public IHumanAPI { public: DebugHumanAPI(Logic& logic) : - logic(logic) + IHumanAPI(logic) { } }; @@ -192,7 +192,7 @@ class ButhcerAPI : public IButcherAPI { public: ButhcerAPI(Logic& logic) : - logic(logic) + IButcherAPI(logic) { } }; @@ -201,7 +201,7 @@ class DebugButcherAPI : public IButcherAPI { public: DebugButcherAPI(Logic& logic) : - logic(logic) + IButcherAPI(logic) { } }; From 91331c7589b2bba00cd841462165fa8473443473 Mon Sep 17 00:00:00 2001 From: DragonAura Date: Fri, 28 Oct 2022 00:23:59 +0800 Subject: [PATCH 12/15] refactor: :art: change api structure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 为了保证代码的复用性、放弃了API部分人类和屠夫分开使用两种接口,转而所有函数都声明在IAPI类里,不希望被调用的函数直接定义为空。 --- CAPI/API/include/AI.h | 14 ++++ CAPI/API/include/API.h | 142 ++++++++++++++++++++++++++--------------- CAPI/API/src/AI.cpp | 6 +- 3 files changed, 109 insertions(+), 53 deletions(-) diff --git a/CAPI/API/include/AI.h b/CAPI/API/include/AI.h index c80728e..d274d3d 100644 --- a/CAPI/API/include/AI.h +++ b/CAPI/API/include/AI.h @@ -4,10 +4,24 @@ #include "API.h" +// 暂定版本:Human和Butcher全部继承AI类, class IAI { public: + IAI() + { + } virtual void play(IAPI& api) = 0; }; +class AI : public IAI +{ +public: + AI() : + IAI() + { + } + void play(IAPI& api) override; +}; + #endif \ No newline at end of file diff --git a/CAPI/API/include/API.h b/CAPI/API/include/API.h index 7d76642..c510e10 100644 --- a/CAPI/API/include/API.h +++ b/CAPI/API/include/API.h @@ -101,6 +101,25 @@ public: // 获取游戏目前所进行的帧数 [[nodiscard]] virtual int GetFrameCount() const = 0; + /*****人类阵营的特定函数*****/ + + virtual std::future StartFixMachine() = 0; + virtual std::future EndFixMachine() = 0; + virtual std::future GetFixStatus() = 0; + virtual std::future StartSaveHuman() = 0; + virtual std::future EndSaveHuman() = 0; + virtual std::future GetSaveStatus() = 0; + virtual std::future Escape() = 0; + [[nodiscard]] virtual std::shared_ptr HumanGetSelfInfo() const = 0; + + /*****屠夫阵营的特定函数*****/ + + virtual std::future Attack(double angleInRadian) = 0; + virtual std::future CarryHuman() = 0; + virtual std::future ReleaseHuman() = 0; + virtual std::future HangHuman() = 0; + [[nodiscard]] virtual std::shared_ptr GetSelfInfo() const = 0; + /*****选手可能用的辅助函数*****/ // 获取指定格子中心的坐标 @@ -131,6 +150,7 @@ protected: // 给Logic使用的IAPI接口,为了保证面向对象的设计模式 class IAPIForLogic : public IAPI { +public: IAPIForLogic(ILogic& logic) : IAPI(logic) { @@ -139,71 +159,89 @@ class IAPIForLogic : public IAPI virtual void EndTimer() = 0; }; -class IHumanAPI : public IAPIForLogic +class HumanAPI : public IAPIForLogic { public: - IHumanAPI(ILogic& logic) : + HumanAPI(ILogic& logic) : IAPIForLogic(logic) { } - virtual std::future StartFixMachine() = 0; - virtual std::future EndFixMachine() = 0; - virtual std::future GetFixStatus() = 0; - virtual std::future StartSaveHuman() = 0; - virtual std::future EndSaveHuman() = 0; - virtual std::future GetSaveStatus() = 0; - virtual std::future Escape() = 0; - [[nodiscard]] virtual std::shared_ptr GetSelfInfo() const = 0; }; -class IButcherAPI : public IAPIForLogic +class ButcherAPI : public IAPIForLogic { public: - IButcherAPI(Logic& logic) : + ButcherAPI(ILogic& logic) : IAPIForLogic(logic) { } - virtual std::future Attack(double angleInRadian) = 0; - virtual std::future CarryHuman() = 0; - virtual std::future ReleaseHuman() = 0; - virtual std::future HangHuman() = 0; - [[nodiscard]] virtual std::shared_ptr GetSelfInfo() const = 0; -}; - -class HumanAPI : public IHumanAPI -{ -public: - HumanAPI(Logic& logic) : - IHumanAPI(logic) - { - } -}; - -class DebugHumanAPI : public IHumanAPI -{ -public: - DebugHumanAPI(Logic& logic) : - IHumanAPI(logic) - { - } }; -class ButhcerAPI : public IButcherAPI -{ -public: - ButhcerAPI(Logic& logic) : - IButcherAPI(logic) - { - } -}; - -class DebugButcherAPI : public IButcherAPI -{ -public: - DebugButcherAPI(Logic& logic) : - IButcherAPI(logic) - { - } -}; +// class IHumanAPI : public IAPIForLogic +// { +// public: +// IHumanAPI(ILogic& logic) : +// IAPIForLogic(logic) +// { +// } +// virtual std::future StartFixMachine() = 0; +// virtual std::future EndFixMachine() = 0; +// virtual std::future GetFixStatus() = 0; +// virtual std::future StartSaveHuman() = 0; +// virtual std::future EndSaveHuman() = 0; +// virtual std::future GetSaveStatus() = 0; +// virtual std::future Escape() = 0; +// [[nodiscard]] virtual std::shared_ptr GetSelfInfo() const = 0; +// }; + +// class IButcherAPI : public IAPIForLogic +// { +// public: +// IButcherAPI(Logic& logic) : +// IAPIForLogic(logic) +// { +// } +// virtual std::future Attack(double angleInRadian) = 0; +// virtual std::future CarryHuman() = 0; +// virtual std::future ReleaseHuman() = 0; +// virtual std::future HangHuman() = 0; +// [[nodiscard]] virtual std::shared_ptr GetSelfInfo() const = 0; +// }; + +// class HumanAPI : public IHumanAPI +// { +// public: +// HumanAPI(Logic& logic) : +// IHumanAPI(logic) +// { +// } +// }; + +// class DebugHumanAPI : public IHumanAPI +// { +// public: +// DebugHumanAPI(Logic& logic) : +// IHumanAPI(logic) +// { +// } +// }; + +// class ButhcerAPI : public IButcherAPI +// { +// public: +// ButhcerAPI(Logic& logic) : +// IButcherAPI(logic) +// { +// } +// }; + +// class DebugButcherAPI : public IButcherAPI +// { +// public: +// DebugButcherAPI(Logic& logic) : +// IButcherAPI(logic) +// { +// } +// }; #endif \ No newline at end of file diff --git a/CAPI/API/src/AI.cpp b/CAPI/API/src/AI.cpp index acaccd2..6953fd5 100644 --- a/CAPI/API/src/AI.cpp +++ b/CAPI/API/src/AI.cpp @@ -2,10 +2,14 @@ #include #include "AI.h" -// 选手!!必须!!定义该变量来选择自己的阵营 +// 选手必须定义该变量来选择自己的阵营 const THUAI6::PlayerType playerType = THUAI6::PlayerType::HumanPlayer; // 选手只需要定义两者中自己选中的那个即可,定义两个也不会有影响。 const THUAI6::ButcherType butcherType = THUAI6::ButcherType::ButcherType1; const THUAI6::HumanType humanType = THUAI6::HumanType::HumanType1; + +void AI::play(IAPI& api) +{ +} \ No newline at end of file From b0ca514799763661d1904a3d7bd162c58844ccd4 Mon Sep 17 00:00:00 2001 From: DragonAura Date: Fri, 28 Oct 2022 00:25:16 +0800 Subject: [PATCH 13/15] fix: :bug: fix wrong spelling --- CAPI/API/include/API.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CAPI/API/include/API.h b/CAPI/API/include/API.h index c510e10..076bff2 100644 --- a/CAPI/API/include/API.h +++ b/CAPI/API/include/API.h @@ -118,7 +118,7 @@ public: virtual std::future CarryHuman() = 0; virtual std::future ReleaseHuman() = 0; virtual std::future HangHuman() = 0; - [[nodiscard]] virtual std::shared_ptr GetSelfInfo() const = 0; + [[nodiscard]] virtual std::shared_ptr ButcherGetSelfInfo() const = 0; /*****选手可能用的辅助函数*****/ From 46b457e83047e8d9dea13ee46c26300c185f9723 Mon Sep 17 00:00:00 2001 From: Timothy Liu Date: Sat, 29 Oct 2022 01:41:53 +0800 Subject: [PATCH 14/15] chore: :iphone: add CAPI UML design --- resource/capi_uml.png | Bin 0 -> 10953 bytes resource/capi_uml.vsdx | Bin 0 -> 25797 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 resource/capi_uml.png create mode 100644 resource/capi_uml.vsdx diff --git a/resource/capi_uml.png b/resource/capi_uml.png new file mode 100644 index 0000000000000000000000000000000000000000..937233930dad6f9911953c7164e9ddf6c76ecc53 GIT binary patch literal 10953 zcmeHtc|6qJ`}d&a&X$@=Niy6qN|Yq)geGLm5Fx2-MM(CFQA8#(Lqv9sY@zIH-od0&V0_f&ULPHuJ`r6u5*IV=xK0o z-n|(HgK=wVp2WaltcSqg?;Nb)7oW)iZSW6^D@H>NmeaK7J7{dMQ`J?4!Cr=OE??RR z+P_`bGtdZwKB*gW~_LN6<=?0J4lE$hzzoBdzxNDC0wq2T;egi?tTjH7mYrS-_U0h5^?ab z!@)jL74wHJOKzmx@~o`#%th~>w#k;WBzMi88(>Iwldi$}otB{9Ukm<_O}Xk4p04tB9XlWW$XLkSL_)r?XHCYVn zt3?qJT8M?g(3y`@+UNK2jq>U^`2^1*e#VFY~!-D>&DR=m8Ks)87sM9=` ztaUl?baPVICMS<)?za?0OXu~AUYJYCDI;(Eb}iS|r}{YoK6tYB{VO>XYPt9Ek-F)f z4-+cBJB>H$8BacUEK3c2pPjMovqqsr?2UfuEb6|xRKc8j-jS$)<*!!eK3LnjT-n%Z zIm*N9g)Ub+a<^yKHz2*Xrw3|kp#7bM3Szwc^`1$iyEZ8}<*x`nJ60YRHS4pZ=@u!z zY4XesgY4^Ll^L#~vjTsHEj+r?b94US_K- zE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_{~3EGqF+nlJ7~L%VogJ=1l}lYQtsq8tfBQI-sM6*&CO7oz z?;LiXV>{0FPa2pr4Vf((FVIZ&0ocN5E`E(BjuY9m~WVc1GeCY2sDouCV%3IQ%;c z$7JxtVRc68^&@isNi*{(({8HJlU=sNQ^YF+z&@brr2wvth0!+q(BdCU3L0tMZOo8ce*))M#tf_A z%ZVN+KBpYPBjC*IkK`2SWE<@Ii-6iUb=~eKAm;(2Aq80=SCC+Xw!>%>1m% zf{-&o;s#ty%)b`gvtOS`98}~a!XW>OyaQ)(*I1MFrzZc>L73OXJe>`4Q6qM+`nX1m z|2&B>`fs$#DLV6W#KwUtK-(IelW^;6JL9>oa=POBB&<+6u8}Uj-c|y&hx#%9mK~X) zYg!BQin)IN=Y{`^PFa#hRmq+^sMt5}@F|t9?>D)clnY5oQYe-FzTg74EKI%$sY6ie zg05Hv_<4|OEICEe-}m~^E0)6>a&NXz$|EtldbojI9_6jzolzY*;2XF=?>mp{=HmKf z{Y<=*ONaTih_D06Dsd07M^z}+}0s|pL|hK zyj1!$(Fliu-Uoq_@@8;Ov_2;y21+9gtwAwtV3}&-siysivQfi_jfKr#gvw% z?=}yKBmMe2^AH0=(E9|&Q|Wut;PQc5K|pZrU&?DeFa-GfLZPZwv_i8_zZzv%MQ37w zbq&?Tuza@F-u|6M$xTrCH4l$}H9qKXVyJzDmIY2iSsR_P;fQ)py;RY)p)^g(k1?|E zR(W(~Wyh=PHkZPZXSJ28V(T#MGtla- zQ}<==vxF4}c>@C;IDvOOe(^VuyZMF1)NnUP`#2v}D7$Qqvqnx0nfJlOY0;IF{oE?J z-ECYtgqGj7A~Qj;c)Yd2`9cE@FB1sgs6Qq;nV_DYAhRr{y4lsQuCVy&re}mXuXp;Y8UVRFEp05xBvhE literal 0 HcmV?d00001 diff --git a/resource/capi_uml.vsdx b/resource/capi_uml.vsdx new file mode 100644 index 0000000000000000000000000000000000000000..52276aaa41eb7f62014f342407b606088bcb2e7e GIT binary patch literal 25797 zcmeE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v8Bs#*N+_p7&C1 z0P06m0tW=opVdLBuFEn~YmjPrb>Fd!Hb?G>SRx)0IXZ}4lkP=jje6YCId3m7lekxw z5zBa2c)aS90+T}T5jDEPn-+zO=VkLtElE1dXU``>+910P%BtddcU(VC)5?QZ;~2;k zQhzP}^aWyy+G5J; zblkJZFbxcqWa?smi2fr1*I<_dYvO7TiDjSpjgQ=BC4&w3g?$csV@<;++-I?n78@x- zba;w-HT+e9Zc!)Kk*r^jdPF2vg#T9E|K^hXYW+*Ce z4Wi)DZ^W+?@ed8|ZPaZI>J4g*?lzvNc8F}LLvHy9xMZ_LfL``4b_PU5&hkO==B z@#}Q|#NDKH-0slrT!=e)=CpByZmU literal 0 HcmV?d00001 From 2f1761f81a16ea055163bde8ea3e55f516e66854 Mon Sep 17 00:00:00 2001 From: DragonAura Date: Sat, 29 Oct 2022 02:22:23 +0800 Subject: [PATCH 15/15] feat: :zap: add test connection service MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加了一个测试服务器是否在线的功能 --- CAPI/proto/Message2Clients.grpc.pb.cc | 110 ++++-- CAPI/proto/Message2Clients.grpc.pb.h | 477 ++++++++++++++++++------- CAPI/proto/Message2Clients.pb.cc | 44 +-- CAPI/proto/Message2Server.pb.cc | 38 +- CAPI/proto/Message2Server.pb.h | 42 +-- dependency/proto/Message2Clients.proto | 2 + dependency/proto/Message2Server.proto | 2 +- 7 files changed, 488 insertions(+), 227 deletions(-) diff --git a/CAPI/proto/Message2Clients.grpc.pb.cc b/CAPI/proto/Message2Clients.grpc.pb.cc index 85ea789..ee30772 100644 --- a/CAPI/proto/Message2Clients.grpc.pb.cc +++ b/CAPI/proto/Message2Clients.grpc.pb.cc @@ -23,6 +23,7 @@ namespace protobuf { static const char* AvailableService_method_names[] = { + "/protobuf.AvailableService/TryConnection", "/protobuf.AvailableService/AddPlayer", "/protobuf.AvailableService/Move", "/protobuf.AvailableService/PickProp", @@ -49,24 +50,53 @@ namespace protobuf AvailableService::Stub::Stub(const std::shared_ptr<::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) : channel_(channel), - rpcmethod_AddPlayer_(AvailableService_method_names[0], options.suffix_for_stats(), ::grpc::internal::RpcMethod::SERVER_STREAMING, channel), - rpcmethod_Move_(AvailableService_method_names[1], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), - rpcmethod_PickProp_(AvailableService_method_names[2], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), - rpcmethod_UseProp_(AvailableService_method_names[3], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), - rpcmethod_UseSkill_(AvailableService_method_names[4], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), - rpcmethod_SendMessage_(AvailableService_method_names[5], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), - rpcmethod_HaveMessage_(AvailableService_method_names[6], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), - rpcmethod_GetMessage_(AvailableService_method_names[7], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), - rpcmethod_FixMachine_(AvailableService_method_names[8], options.suffix_for_stats(), ::grpc::internal::RpcMethod::BIDI_STREAMING, channel), - rpcmethod_SaveHuman_(AvailableService_method_names[9], options.suffix_for_stats(), ::grpc::internal::RpcMethod::BIDI_STREAMING, channel), - rpcmethod_Attack_(AvailableService_method_names[10], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), - rpcmethod_CarryHuman_(AvailableService_method_names[11], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), - rpcmethod_ReleaseHuman_(AvailableService_method_names[12], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), - rpcmethod_HangHuman_(AvailableService_method_names[13], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), - rpcmethod_Escape_(AvailableService_method_names[14], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel) + rpcmethod_TryConnection_(AvailableService_method_names[0], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), + rpcmethod_AddPlayer_(AvailableService_method_names[1], options.suffix_for_stats(), ::grpc::internal::RpcMethod::SERVER_STREAMING, channel), + rpcmethod_Move_(AvailableService_method_names[2], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), + rpcmethod_PickProp_(AvailableService_method_names[3], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), + rpcmethod_UseProp_(AvailableService_method_names[4], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), + rpcmethod_UseSkill_(AvailableService_method_names[5], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), + 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) { } + ::grpc::Status AvailableService::Stub::TryConnection(::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_TryConnection_, context, request, response); + } + + void AvailableService::Stub::async::TryConnection(::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_TryConnection_, context, request, response, std::move(f)); + } + + void AvailableService::Stub::async::TryConnection(::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_TryConnection_, context, request, response, reactor); + } + + ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AvailableService::Stub::PrepareAsyncTryConnectionRaw(::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_TryConnection_, context, request); + } + + ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AvailableService::Stub::AsyncTryConnectionRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) + { + auto* result = + this->PrepareAsyncTryConnectionRaw(context, request, cq); + result->StartCall(); + return result; + } + ::grpc::ClientReader<::protobuf::MessageToClient>* AvailableService::Stub::AddPlayerRaw(::grpc::ClientContext* context, const ::protobuf::PlayerMsg& request) { return ::grpc::internal::ClientReaderFactory<::protobuf::MessageToClient>::Create(channel_.get(), rpcmethod_AddPlayer_, context, request); @@ -467,6 +497,20 @@ namespace protobuf { AddMethod(new ::grpc::internal::RpcServiceMethod( AvailableService_method_names[0], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler( + [](AvailableService::Service* service, + ::grpc::ServerContext* ctx, + const ::protobuf::IDMsg* req, + ::protobuf::BoolRes* resp) + { + return service->TryConnection(ctx, req, resp); + }, + this + ) + )); + AddMethod(new ::grpc::internal::RpcServiceMethod( + AvailableService_method_names[1], ::grpc::internal::RpcMethod::SERVER_STREAMING, new ::grpc::internal::ServerStreamingHandler( [](AvailableService::Service* service, @@ -480,7 +524,7 @@ namespace protobuf ) )); AddMethod(new ::grpc::internal::RpcServiceMethod( - AvailableService_method_names[1], + AvailableService_method_names[2], ::grpc::internal::RpcMethod::NORMAL_RPC, new ::grpc::internal::RpcMethodHandler( [](AvailableService::Service* service, @@ -494,7 +538,7 @@ namespace protobuf ) )); AddMethod(new ::grpc::internal::RpcServiceMethod( - AvailableService_method_names[2], + AvailableService_method_names[3], ::grpc::internal::RpcMethod::NORMAL_RPC, new ::grpc::internal::RpcMethodHandler( [](AvailableService::Service* service, @@ -508,7 +552,7 @@ namespace protobuf ) )); AddMethod(new ::grpc::internal::RpcServiceMethod( - AvailableService_method_names[3], + AvailableService_method_names[4], ::grpc::internal::RpcMethod::NORMAL_RPC, new ::grpc::internal::RpcMethodHandler( [](AvailableService::Service* service, @@ -522,7 +566,7 @@ namespace protobuf ) )); AddMethod(new ::grpc::internal::RpcServiceMethod( - AvailableService_method_names[4], + AvailableService_method_names[5], ::grpc::internal::RpcMethod::NORMAL_RPC, new ::grpc::internal::RpcMethodHandler( [](AvailableService::Service* service, @@ -536,7 +580,7 @@ namespace protobuf ) )); AddMethod(new ::grpc::internal::RpcServiceMethod( - AvailableService_method_names[5], + AvailableService_method_names[6], ::grpc::internal::RpcMethod::NORMAL_RPC, new ::grpc::internal::RpcMethodHandler( [](AvailableService::Service* service, @@ -550,7 +594,7 @@ namespace protobuf ) )); AddMethod(new ::grpc::internal::RpcServiceMethod( - AvailableService_method_names[6], + AvailableService_method_names[7], ::grpc::internal::RpcMethod::NORMAL_RPC, new ::grpc::internal::RpcMethodHandler( [](AvailableService::Service* service, @@ -564,7 +608,7 @@ namespace protobuf ) )); AddMethod(new ::grpc::internal::RpcServiceMethod( - AvailableService_method_names[7], + AvailableService_method_names[8], ::grpc::internal::RpcMethod::NORMAL_RPC, new ::grpc::internal::RpcMethodHandler( [](AvailableService::Service* service, @@ -578,7 +622,7 @@ namespace protobuf ) )); AddMethod(new ::grpc::internal::RpcServiceMethod( - AvailableService_method_names[8], + AvailableService_method_names[9], ::grpc::internal::RpcMethod::BIDI_STREAMING, new ::grpc::internal::BidiStreamingHandler( [](AvailableService::Service* service, @@ -591,7 +635,7 @@ namespace protobuf ) )); AddMethod(new ::grpc::internal::RpcServiceMethod( - AvailableService_method_names[9], + AvailableService_method_names[10], ::grpc::internal::RpcMethod::BIDI_STREAMING, new ::grpc::internal::BidiStreamingHandler( [](AvailableService::Service* service, @@ -604,7 +648,7 @@ namespace protobuf ) )); AddMethod(new ::grpc::internal::RpcServiceMethod( - AvailableService_method_names[10], + AvailableService_method_names[11], ::grpc::internal::RpcMethod::NORMAL_RPC, new ::grpc::internal::RpcMethodHandler( [](AvailableService::Service* service, @@ -618,7 +662,7 @@ namespace protobuf ) )); AddMethod(new ::grpc::internal::RpcServiceMethod( - AvailableService_method_names[11], + AvailableService_method_names[12], ::grpc::internal::RpcMethod::NORMAL_RPC, new ::grpc::internal::RpcMethodHandler( [](AvailableService::Service* service, @@ -632,7 +676,7 @@ namespace protobuf ) )); AddMethod(new ::grpc::internal::RpcServiceMethod( - AvailableService_method_names[12], + AvailableService_method_names[13], ::grpc::internal::RpcMethod::NORMAL_RPC, new ::grpc::internal::RpcMethodHandler( [](AvailableService::Service* service, @@ -646,7 +690,7 @@ namespace protobuf ) )); AddMethod(new ::grpc::internal::RpcServiceMethod( - AvailableService_method_names[13], + AvailableService_method_names[14], ::grpc::internal::RpcMethod::NORMAL_RPC, new ::grpc::internal::RpcMethodHandler( [](AvailableService::Service* service, @@ -660,7 +704,7 @@ namespace protobuf ) )); AddMethod(new ::grpc::internal::RpcServiceMethod( - AvailableService_method_names[14], + AvailableService_method_names[15], ::grpc::internal::RpcMethod::NORMAL_RPC, new ::grpc::internal::RpcMethodHandler( [](AvailableService::Service* service, @@ -679,6 +723,14 @@ namespace protobuf { } + ::grpc::Status AvailableService::Service::TryConnection(::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::AddPlayer(::grpc::ServerContext* context, const ::protobuf::PlayerMsg* request, ::grpc::ServerWriter<::protobuf::MessageToClient>* writer) { (void)context; diff --git a/CAPI/proto/Message2Clients.grpc.pb.h b/CAPI/proto/Message2Clients.grpc.pb.h index 60af0ca..7481d7e 100644 --- a/CAPI/proto/Message2Clients.grpc.pb.h +++ b/CAPI/proto/Message2Clients.grpc.pb.h @@ -43,6 +43,15 @@ namespace protobuf virtual ~StubInterface() { } + virtual ::grpc::Status TryConnection(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::protobuf::BoolRes* response) = 0; + std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>> AsyncTryConnection(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) + { + return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>>(AsyncTryConnectionRaw(context, request, cq)); + } + std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>> PrepareAsyncTryConnection(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) + { + return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>>(PrepareAsyncTryConnectionRaw(context, request, cq)); + } // 游戏开局调用一次的服务 std::unique_ptr<::grpc::ClientReaderInterface<::protobuf::MessageToClient>> AddPlayer(::grpc::ClientContext* context, const ::protobuf::PlayerMsg& request) { @@ -197,6 +206,8 @@ namespace protobuf virtual ~async_interface() { } + virtual void TryConnection(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, std::function) = 0; + virtual void TryConnection(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) = 0; // 游戏开局调用一次的服务 virtual void AddPlayer(::grpc::ClientContext* context, const ::protobuf::PlayerMsg* request, ::grpc::ClientReadReactor<::protobuf::MessageToClient>* reactor) = 0; // 连接上后等待游戏开始,server会定时通过该服务向所有client发送消息。 @@ -240,6 +251,8 @@ namespace protobuf } private: + virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* AsyncTryConnectionRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* PrepareAsyncTryConnectionRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) = 0; virtual ::grpc::ClientReaderInterface<::protobuf::MessageToClient>* AddPlayerRaw(::grpc::ClientContext* context, const ::protobuf::PlayerMsg& request) = 0; virtual ::grpc::ClientAsyncReaderInterface<::protobuf::MessageToClient>* AsyncAddPlayerRaw(::grpc::ClientContext* context, const ::protobuf::PlayerMsg& request, ::grpc::CompletionQueue* cq, void* tag) = 0; virtual ::grpc::ClientAsyncReaderInterface<::protobuf::MessageToClient>* PrepareAsyncAddPlayerRaw(::grpc::ClientContext* context, const ::protobuf::PlayerMsg& request, ::grpc::CompletionQueue* cq) = 0; @@ -278,6 +291,15 @@ namespace protobuf { public: Stub(const std::shared_ptr<::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions()); + ::grpc::Status TryConnection(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::protobuf::BoolRes* response) override; + std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>> AsyncTryConnection(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) + { + return std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>>(AsyncTryConnectionRaw(context, request, cq)); + } + std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>> PrepareAsyncTryConnection(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) + { + return std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>>(PrepareAsyncTryConnectionRaw(context, request, cq)); + } std::unique_ptr<::grpc::ClientReader<::protobuf::MessageToClient>> AddPlayer(::grpc::ClientContext* context, const ::protobuf::PlayerMsg& request) { return std::unique_ptr<::grpc::ClientReader<::protobuf::MessageToClient>>(AddPlayerRaw(context, request)); @@ -426,6 +448,8 @@ namespace protobuf public StubInterface::async_interface { public: + void TryConnection(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, std::function) override; + void TryConnection(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) override; void AddPlayer(::grpc::ClientContext* context, const ::protobuf::PlayerMsg* request, ::grpc::ClientReadReactor<::protobuf::MessageToClient>* reactor) override; void Move(::grpc::ClientContext* context, const ::protobuf::MoveMsg* request, ::protobuf::MoveRes* response, std::function) override; void Move(::grpc::ClientContext* context, const ::protobuf::MoveMsg* request, ::protobuf::MoveRes* response, ::grpc::ClientUnaryReactor* reactor) override; @@ -477,6 +501,8 @@ namespace protobuf { this }; + ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AsyncTryConnectionRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* PrepareAsyncTryConnectionRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override; ::grpc::ClientReader<::protobuf::MessageToClient>* AddPlayerRaw(::grpc::ClientContext* context, const ::protobuf::PlayerMsg& request) override; ::grpc::ClientAsyncReader<::protobuf::MessageToClient>* AsyncAddPlayerRaw(::grpc::ClientContext* context, const ::protobuf::PlayerMsg& request, ::grpc::CompletionQueue* cq, void* tag) override; ::grpc::ClientAsyncReader<::protobuf::MessageToClient>* PrepareAsyncAddPlayerRaw(::grpc::ClientContext* context, const ::protobuf::PlayerMsg& request, ::grpc::CompletionQueue* cq) override; @@ -510,6 +536,7 @@ namespace protobuf ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* PrepareAsyncHangHumanRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override; ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AsyncEscapeRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override; ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* PrepareAsyncEscapeRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override; + const ::grpc::internal::RpcMethod rpcmethod_TryConnection_; const ::grpc::internal::RpcMethod rpcmethod_AddPlayer_; const ::grpc::internal::RpcMethod rpcmethod_Move_; const ::grpc::internal::RpcMethod rpcmethod_PickProp_; @@ -533,6 +560,7 @@ namespace protobuf public: Service(); virtual ~Service(); + virtual ::grpc::Status TryConnection(::grpc::ServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response); // 游戏开局调用一次的服务 virtual ::grpc::Status AddPlayer(::grpc::ServerContext* context, const ::protobuf::PlayerMsg* request, ::grpc::ServerWriter<::protobuf::MessageToClient>* writer); // 连接上后等待游戏开始,server会定时通过该服务向所有client发送消息。 @@ -554,6 +582,34 @@ namespace protobuf virtual ::grpc::Status Escape(::grpc::ServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response); }; template + class WithAsyncMethod_TryConnection : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithAsyncMethod_TryConnection() + { + ::grpc::Service::MarkMethodAsync(0); + } + ~WithAsyncMethod_TryConnection() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status TryConnection(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestTryConnection(::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(0, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template class WithAsyncMethod_AddPlayer : public BaseClass { private: @@ -564,7 +620,7 @@ namespace protobuf public: WithAsyncMethod_AddPlayer() { - ::grpc::Service::MarkMethodAsync(0); + ::grpc::Service::MarkMethodAsync(1); } ~WithAsyncMethod_AddPlayer() override { @@ -578,7 +634,7 @@ namespace protobuf } void RequestAddPlayer(::grpc::ServerContext* context, ::protobuf::PlayerMsg* request, ::grpc::ServerAsyncWriter<::protobuf::MessageToClient>* writer, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag) { - ::grpc::Service::RequestAsyncServerStreaming(0, context, request, writer, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncServerStreaming(1, context, request, writer, new_call_cq, notification_cq, tag); } }; template @@ -592,7 +648,7 @@ namespace protobuf public: WithAsyncMethod_Move() { - ::grpc::Service::MarkMethodAsync(1); + ::grpc::Service::MarkMethodAsync(2); } ~WithAsyncMethod_Move() override { @@ -606,7 +662,7 @@ namespace protobuf } void RequestMove(::grpc::ServerContext* context, ::protobuf::MoveMsg* request, ::grpc::ServerAsyncResponseWriter<::protobuf::MoveRes>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag) { - ::grpc::Service::RequestAsyncUnary(1, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(2, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -620,7 +676,7 @@ namespace protobuf public: WithAsyncMethod_PickProp() { - ::grpc::Service::MarkMethodAsync(2); + ::grpc::Service::MarkMethodAsync(3); } ~WithAsyncMethod_PickProp() override { @@ -634,7 +690,7 @@ namespace protobuf } void RequestPickProp(::grpc::ServerContext* context, ::protobuf::PickMsg* request, ::grpc::ServerAsyncResponseWriter<::protobuf::BoolRes>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag) { - ::grpc::Service::RequestAsyncUnary(2, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(3, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -648,7 +704,7 @@ namespace protobuf public: WithAsyncMethod_UseProp() { - ::grpc::Service::MarkMethodAsync(3); + ::grpc::Service::MarkMethodAsync(4); } ~WithAsyncMethod_UseProp() override { @@ -662,7 +718,7 @@ namespace protobuf } void RequestUseProp(::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(3, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(4, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -676,7 +732,7 @@ namespace protobuf public: WithAsyncMethod_UseSkill() { - ::grpc::Service::MarkMethodAsync(4); + ::grpc::Service::MarkMethodAsync(5); } ~WithAsyncMethod_UseSkill() override { @@ -690,7 +746,7 @@ namespace protobuf } void RequestUseSkill(::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(4, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(5, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -704,7 +760,7 @@ namespace protobuf public: WithAsyncMethod_SendMessage() { - ::grpc::Service::MarkMethodAsync(5); + ::grpc::Service::MarkMethodAsync(6); } ~WithAsyncMethod_SendMessage() override { @@ -718,7 +774,7 @@ namespace protobuf } void RequestSendMessage(::grpc::ServerContext* context, ::protobuf::SendMsg* request, ::grpc::ServerAsyncResponseWriter<::protobuf::BoolRes>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag) { - ::grpc::Service::RequestAsyncUnary(5, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(6, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -732,7 +788,7 @@ namespace protobuf public: WithAsyncMethod_HaveMessage() { - ::grpc::Service::MarkMethodAsync(6); + ::grpc::Service::MarkMethodAsync(7); } ~WithAsyncMethod_HaveMessage() override { @@ -746,7 +802,7 @@ namespace protobuf } void RequestHaveMessage(::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(6, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(7, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -760,7 +816,7 @@ namespace protobuf public: WithAsyncMethod_GetMessage() { - ::grpc::Service::MarkMethodAsync(7); + ::grpc::Service::MarkMethodAsync(8); } ~WithAsyncMethod_GetMessage() override { @@ -774,7 +830,7 @@ namespace protobuf } void RequestGetMessage(::grpc::ServerContext* context, ::protobuf::IDMsg* request, ::grpc::ServerAsyncResponseWriter<::protobuf::MsgRes>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag) { - ::grpc::Service::RequestAsyncUnary(7, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(8, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -788,7 +844,7 @@ namespace protobuf public: WithAsyncMethod_FixMachine() { - ::grpc::Service::MarkMethodAsync(8); + ::grpc::Service::MarkMethodAsync(9); } ~WithAsyncMethod_FixMachine() override { @@ -802,7 +858,7 @@ namespace protobuf } void RequestFixMachine(::grpc::ServerContext* context, ::grpc::ServerAsyncReaderWriter<::protobuf::BoolRes, ::protobuf::IDMsg>* stream, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag) { - ::grpc::Service::RequestAsyncBidiStreaming(8, context, stream, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncBidiStreaming(9, context, stream, new_call_cq, notification_cq, tag); } }; template @@ -816,7 +872,7 @@ namespace protobuf public: WithAsyncMethod_SaveHuman() { - ::grpc::Service::MarkMethodAsync(9); + ::grpc::Service::MarkMethodAsync(10); } ~WithAsyncMethod_SaveHuman() override { @@ -830,7 +886,7 @@ namespace protobuf } void RequestSaveHuman(::grpc::ServerContext* context, ::grpc::ServerAsyncReaderWriter<::protobuf::BoolRes, ::protobuf::IDMsg>* stream, ::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::RequestAsyncBidiStreaming(10, context, stream, new_call_cq, notification_cq, tag); } }; template @@ -844,7 +900,7 @@ namespace protobuf public: WithAsyncMethod_Attack() { - ::grpc::Service::MarkMethodAsync(10); + ::grpc::Service::MarkMethodAsync(11); } ~WithAsyncMethod_Attack() override { @@ -858,7 +914,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(10, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(11, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -872,7 +928,7 @@ namespace protobuf public: WithAsyncMethod_CarryHuman() { - ::grpc::Service::MarkMethodAsync(11); + ::grpc::Service::MarkMethodAsync(12); } ~WithAsyncMethod_CarryHuman() override { @@ -886,7 +942,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(11, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(12, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -900,7 +956,7 @@ namespace protobuf public: WithAsyncMethod_ReleaseHuman() { - ::grpc::Service::MarkMethodAsync(12); + ::grpc::Service::MarkMethodAsync(13); } ~WithAsyncMethod_ReleaseHuman() override { @@ -914,7 +970,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(12, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(13, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -928,7 +984,7 @@ namespace protobuf public: WithAsyncMethod_HangHuman() { - ::grpc::Service::MarkMethodAsync(13); + ::grpc::Service::MarkMethodAsync(14); } ~WithAsyncMethod_HangHuman() override { @@ -942,7 +998,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(13, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(14, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -956,7 +1012,7 @@ namespace protobuf public: WithAsyncMethod_Escape() { - ::grpc::Service::MarkMethodAsync(14); + ::grpc::Service::MarkMethodAsync(15); } ~WithAsyncMethod_Escape() override { @@ -970,10 +1026,49 @@ 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(14, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(15, context, request, response, new_call_cq, notification_cq, tag); + } + }; + typedef WithAsyncMethod_TryConnection>>>>>>>>>>>>>>> AsyncService; + template + class WithCallbackMethod_TryConnection : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithCallbackMethod_TryConnection() + { + ::grpc::Service::MarkMethodCallback(0, new ::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response) + { return this->TryConnection(context, request, response); })); + } + void SetMessageAllocatorFor_TryConnection( + ::grpc::MessageAllocator<::protobuf::IDMsg, ::protobuf::BoolRes>* allocator + ) + { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(0); + static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_TryConnection() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status TryConnection(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* TryConnection( + ::grpc::CallbackServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/ + ) + { + return nullptr; } }; - typedef WithAsyncMethod_AddPlayer>>>>>>>>>>>>>> AsyncService; template class WithCallbackMethod_AddPlayer : public BaseClass { @@ -985,7 +1080,7 @@ namespace protobuf public: WithCallbackMethod_AddPlayer() { - ::grpc::Service::MarkMethodCallback(0, new ::grpc::internal::CallbackServerStreamingHandler<::protobuf::PlayerMsg, ::protobuf::MessageToClient>([this](::grpc::CallbackServerContext* context, const ::protobuf::PlayerMsg* request) + ::grpc::Service::MarkMethodCallback(1, new ::grpc::internal::CallbackServerStreamingHandler<::protobuf::PlayerMsg, ::protobuf::MessageToClient>([this](::grpc::CallbackServerContext* context, const ::protobuf::PlayerMsg* request) { return this->AddPlayer(context, request); })); } ~WithCallbackMethod_AddPlayer() override @@ -1016,14 +1111,14 @@ namespace protobuf public: WithCallbackMethod_Move() { - ::grpc::Service::MarkMethodCallback(1, new ::grpc::internal::CallbackUnaryHandler<::protobuf::MoveMsg, ::protobuf::MoveRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::MoveMsg* request, ::protobuf::MoveRes* response) + ::grpc::Service::MarkMethodCallback(2, new ::grpc::internal::CallbackUnaryHandler<::protobuf::MoveMsg, ::protobuf::MoveRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::MoveMsg* request, ::protobuf::MoveRes* response) { return this->Move(context, request, response); })); } void SetMessageAllocatorFor_Move( ::grpc::MessageAllocator<::protobuf::MoveMsg, ::protobuf::MoveRes>* allocator ) { - ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(1); + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(2); static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::MoveMsg, ::protobuf::MoveRes>*>(handler) ->SetMessageAllocator(allocator); } @@ -1055,14 +1150,14 @@ namespace protobuf public: WithCallbackMethod_PickProp() { - ::grpc::Service::MarkMethodCallback(2, new ::grpc::internal::CallbackUnaryHandler<::protobuf::PickMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::PickMsg* request, ::protobuf::BoolRes* response) + ::grpc::Service::MarkMethodCallback(3, new ::grpc::internal::CallbackUnaryHandler<::protobuf::PickMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::PickMsg* request, ::protobuf::BoolRes* response) { return this->PickProp(context, request, response); })); } void SetMessageAllocatorFor_PickProp( ::grpc::MessageAllocator<::protobuf::PickMsg, ::protobuf::BoolRes>* allocator ) { - ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(2); + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(3); static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::PickMsg, ::protobuf::BoolRes>*>(handler) ->SetMessageAllocator(allocator); } @@ -1094,14 +1189,14 @@ namespace protobuf public: WithCallbackMethod_UseProp() { - ::grpc::Service::MarkMethodCallback(3, new ::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response) + ::grpc::Service::MarkMethodCallback(4, new ::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response) { return this->UseProp(context, request, response); })); } void SetMessageAllocatorFor_UseProp( ::grpc::MessageAllocator<::protobuf::IDMsg, ::protobuf::BoolRes>* allocator ) { - ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(3); + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(4); static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>*>(handler) ->SetMessageAllocator(allocator); } @@ -1133,14 +1228,14 @@ namespace protobuf public: WithCallbackMethod_UseSkill() { - ::grpc::Service::MarkMethodCallback(4, new ::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response) + ::grpc::Service::MarkMethodCallback(5, new ::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response) { return this->UseSkill(context, request, response); })); } void SetMessageAllocatorFor_UseSkill( ::grpc::MessageAllocator<::protobuf::IDMsg, ::protobuf::BoolRes>* allocator ) { - ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(4); + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(5); static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>*>(handler) ->SetMessageAllocator(allocator); } @@ -1172,14 +1267,14 @@ namespace protobuf public: WithCallbackMethod_SendMessage() { - ::grpc::Service::MarkMethodCallback(5, new ::grpc::internal::CallbackUnaryHandler<::protobuf::SendMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::SendMsg* request, ::protobuf::BoolRes* response) + ::grpc::Service::MarkMethodCallback(6, new ::grpc::internal::CallbackUnaryHandler<::protobuf::SendMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::SendMsg* request, ::protobuf::BoolRes* response) { return this->SendMessage(context, request, response); })); } void SetMessageAllocatorFor_SendMessage( ::grpc::MessageAllocator<::protobuf::SendMsg, ::protobuf::BoolRes>* allocator ) { - ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(5); + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(6); static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::SendMsg, ::protobuf::BoolRes>*>(handler) ->SetMessageAllocator(allocator); } @@ -1211,14 +1306,14 @@ namespace protobuf public: WithCallbackMethod_HaveMessage() { - ::grpc::Service::MarkMethodCallback(6, new ::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response) + ::grpc::Service::MarkMethodCallback(7, new ::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response) { return this->HaveMessage(context, request, response); })); } void SetMessageAllocatorFor_HaveMessage( ::grpc::MessageAllocator<::protobuf::IDMsg, ::protobuf::BoolRes>* allocator ) { - ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(6); + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(7); static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>*>(handler) ->SetMessageAllocator(allocator); } @@ -1250,14 +1345,14 @@ namespace protobuf public: WithCallbackMethod_GetMessage() { - ::grpc::Service::MarkMethodCallback(7, new ::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::MsgRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::MsgRes* response) + ::grpc::Service::MarkMethodCallback(8, new ::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::MsgRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::MsgRes* response) { return this->GetMessage(context, request, response); })); } void SetMessageAllocatorFor_GetMessage( ::grpc::MessageAllocator<::protobuf::IDMsg, ::protobuf::MsgRes>* allocator ) { - ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(7); + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(8); static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::MsgRes>*>(handler) ->SetMessageAllocator(allocator); } @@ -1289,7 +1384,7 @@ namespace protobuf public: WithCallbackMethod_FixMachine() { - ::grpc::Service::MarkMethodCallback(8, new ::grpc::internal::CallbackBidiHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context) + ::grpc::Service::MarkMethodCallback(9, new ::grpc::internal::CallbackBidiHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context) { return this->FixMachine(context); })); } ~WithCallbackMethod_FixMachine() override @@ -1320,8 +1415,8 @@ namespace protobuf public: WithCallbackMethod_SaveHuman() { - ::grpc::Service::MarkMethodCallback(9, new ::grpc::internal::CallbackBidiHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context) - { return this->SaveHuman(context); })); + ::grpc::Service::MarkMethodCallback(10, new ::grpc::internal::CallbackBidiHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context) + { return this->SaveHuman(context); })); } ~WithCallbackMethod_SaveHuman() override { @@ -1351,14 +1446,14 @@ namespace protobuf public: WithCallbackMethod_Attack() { - ::grpc::Service::MarkMethodCallback(10, new ::grpc::internal::CallbackUnaryHandler<::protobuf::AttackMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::AttackMsg* request, ::protobuf::BoolRes* response) + ::grpc::Service::MarkMethodCallback(11, 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(10); + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(11); static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::AttackMsg, ::protobuf::BoolRes>*>(handler) ->SetMessageAllocator(allocator); } @@ -1390,14 +1485,14 @@ namespace protobuf public: WithCallbackMethod_CarryHuman() { - ::grpc::Service::MarkMethodCallback(11, new ::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response) + ::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->CarryHuman(context, request, response); })); } void SetMessageAllocatorFor_CarryHuman( ::grpc::MessageAllocator<::protobuf::IDMsg, ::protobuf::BoolRes>* allocator ) { - ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(11); + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(12); static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>*>(handler) ->SetMessageAllocator(allocator); } @@ -1429,14 +1524,14 @@ namespace protobuf public: WithCallbackMethod_ReleaseHuman() { - ::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(13, 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(12); + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(13); static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>*>(handler) ->SetMessageAllocator(allocator); } @@ -1468,14 +1563,14 @@ namespace protobuf public: WithCallbackMethod_HangHuman() { - ::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(14, 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(13); + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(14); static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>*>(handler) ->SetMessageAllocator(allocator); } @@ -1507,14 +1602,14 @@ namespace protobuf public: WithCallbackMethod_Escape() { - ::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(15, 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(14); + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(15); static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>*>(handler) ->SetMessageAllocator(allocator); } @@ -1535,9 +1630,33 @@ namespace protobuf return nullptr; } }; - typedef WithCallbackMethod_AddPlayer>>>>>>>>>>>>>> CallbackService; + typedef WithCallbackMethod_TryConnection>>>>>>>>>>>>>>> CallbackService; typedef CallbackService ExperimentalCallbackService; template + class WithGenericMethod_TryConnection : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithGenericMethod_TryConnection() + { + ::grpc::Service::MarkMethodGeneric(0); + } + ~WithGenericMethod_TryConnection() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status TryConnection(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template class WithGenericMethod_AddPlayer : public BaseClass { private: @@ -1548,7 +1667,7 @@ namespace protobuf public: WithGenericMethod_AddPlayer() { - ::grpc::Service::MarkMethodGeneric(0); + ::grpc::Service::MarkMethodGeneric(1); } ~WithGenericMethod_AddPlayer() override { @@ -1572,7 +1691,7 @@ namespace protobuf public: WithGenericMethod_Move() { - ::grpc::Service::MarkMethodGeneric(1); + ::grpc::Service::MarkMethodGeneric(2); } ~WithGenericMethod_Move() override { @@ -1596,7 +1715,7 @@ namespace protobuf public: WithGenericMethod_PickProp() { - ::grpc::Service::MarkMethodGeneric(2); + ::grpc::Service::MarkMethodGeneric(3); } ~WithGenericMethod_PickProp() override { @@ -1620,7 +1739,7 @@ namespace protobuf public: WithGenericMethod_UseProp() { - ::grpc::Service::MarkMethodGeneric(3); + ::grpc::Service::MarkMethodGeneric(4); } ~WithGenericMethod_UseProp() override { @@ -1644,7 +1763,7 @@ namespace protobuf public: WithGenericMethod_UseSkill() { - ::grpc::Service::MarkMethodGeneric(4); + ::grpc::Service::MarkMethodGeneric(5); } ~WithGenericMethod_UseSkill() override { @@ -1668,7 +1787,7 @@ namespace protobuf public: WithGenericMethod_SendMessage() { - ::grpc::Service::MarkMethodGeneric(5); + ::grpc::Service::MarkMethodGeneric(6); } ~WithGenericMethod_SendMessage() override { @@ -1692,7 +1811,7 @@ namespace protobuf public: WithGenericMethod_HaveMessage() { - ::grpc::Service::MarkMethodGeneric(6); + ::grpc::Service::MarkMethodGeneric(7); } ~WithGenericMethod_HaveMessage() override { @@ -1716,7 +1835,7 @@ namespace protobuf public: WithGenericMethod_GetMessage() { - ::grpc::Service::MarkMethodGeneric(7); + ::grpc::Service::MarkMethodGeneric(8); } ~WithGenericMethod_GetMessage() override { @@ -1740,7 +1859,7 @@ namespace protobuf public: WithGenericMethod_FixMachine() { - ::grpc::Service::MarkMethodGeneric(8); + ::grpc::Service::MarkMethodGeneric(9); } ~WithGenericMethod_FixMachine() override { @@ -1764,7 +1883,7 @@ namespace protobuf public: WithGenericMethod_SaveHuman() { - ::grpc::Service::MarkMethodGeneric(9); + ::grpc::Service::MarkMethodGeneric(10); } ~WithGenericMethod_SaveHuman() override { @@ -1788,7 +1907,7 @@ namespace protobuf public: WithGenericMethod_Attack() { - ::grpc::Service::MarkMethodGeneric(10); + ::grpc::Service::MarkMethodGeneric(11); } ~WithGenericMethod_Attack() override { @@ -1812,7 +1931,7 @@ namespace protobuf public: WithGenericMethod_CarryHuman() { - ::grpc::Service::MarkMethodGeneric(11); + ::grpc::Service::MarkMethodGeneric(12); } ~WithGenericMethod_CarryHuman() override { @@ -1836,7 +1955,7 @@ namespace protobuf public: WithGenericMethod_ReleaseHuman() { - ::grpc::Service::MarkMethodGeneric(12); + ::grpc::Service::MarkMethodGeneric(13); } ~WithGenericMethod_ReleaseHuman() override { @@ -1860,7 +1979,7 @@ namespace protobuf public: WithGenericMethod_HangHuman() { - ::grpc::Service::MarkMethodGeneric(13); + ::grpc::Service::MarkMethodGeneric(14); } ~WithGenericMethod_HangHuman() override { @@ -1884,7 +2003,7 @@ namespace protobuf public: WithGenericMethod_Escape() { - ::grpc::Service::MarkMethodGeneric(14); + ::grpc::Service::MarkMethodGeneric(15); } ~WithGenericMethod_Escape() override { @@ -1898,6 +2017,34 @@ namespace protobuf } }; template + class WithRawMethod_TryConnection : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithRawMethod_TryConnection() + { + ::grpc::Service::MarkMethodRaw(0); + } + ~WithRawMethod_TryConnection() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status TryConnection(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestTryConnection(::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(0, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template class WithRawMethod_AddPlayer : public BaseClass { private: @@ -1908,7 +2055,7 @@ namespace protobuf public: WithRawMethod_AddPlayer() { - ::grpc::Service::MarkMethodRaw(0); + ::grpc::Service::MarkMethodRaw(1); } ~WithRawMethod_AddPlayer() override { @@ -1922,7 +2069,7 @@ namespace protobuf } void RequestAddPlayer(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncWriter<::grpc::ByteBuffer>* writer, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag) { - ::grpc::Service::RequestAsyncServerStreaming(0, context, request, writer, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncServerStreaming(1, context, request, writer, new_call_cq, notification_cq, tag); } }; template @@ -1936,7 +2083,7 @@ namespace protobuf public: WithRawMethod_Move() { - ::grpc::Service::MarkMethodRaw(1); + ::grpc::Service::MarkMethodRaw(2); } ~WithRawMethod_Move() override { @@ -1950,7 +2097,7 @@ namespace protobuf } void RequestMove(::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(1, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(2, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -1964,7 +2111,7 @@ namespace protobuf public: WithRawMethod_PickProp() { - ::grpc::Service::MarkMethodRaw(2); + ::grpc::Service::MarkMethodRaw(3); } ~WithRawMethod_PickProp() override { @@ -1978,7 +2125,7 @@ namespace protobuf } void RequestPickProp(::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(2, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(3, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -1992,7 +2139,7 @@ namespace protobuf public: WithRawMethod_UseProp() { - ::grpc::Service::MarkMethodRaw(3); + ::grpc::Service::MarkMethodRaw(4); } ~WithRawMethod_UseProp() override { @@ -2006,7 +2153,7 @@ namespace protobuf } void RequestUseProp(::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(3, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(4, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -2020,7 +2167,7 @@ namespace protobuf public: WithRawMethod_UseSkill() { - ::grpc::Service::MarkMethodRaw(4); + ::grpc::Service::MarkMethodRaw(5); } ~WithRawMethod_UseSkill() override { @@ -2034,7 +2181,7 @@ namespace protobuf } void RequestUseSkill(::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(4, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(5, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -2048,7 +2195,7 @@ namespace protobuf public: WithRawMethod_SendMessage() { - ::grpc::Service::MarkMethodRaw(5); + ::grpc::Service::MarkMethodRaw(6); } ~WithRawMethod_SendMessage() override { @@ -2062,7 +2209,7 @@ namespace protobuf } void RequestSendMessage(::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(5, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(6, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -2076,7 +2223,7 @@ namespace protobuf public: WithRawMethod_HaveMessage() { - ::grpc::Service::MarkMethodRaw(6); + ::grpc::Service::MarkMethodRaw(7); } ~WithRawMethod_HaveMessage() override { @@ -2090,7 +2237,7 @@ namespace protobuf } void RequestHaveMessage(::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(6, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(7, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -2104,7 +2251,7 @@ namespace protobuf public: WithRawMethod_GetMessage() { - ::grpc::Service::MarkMethodRaw(7); + ::grpc::Service::MarkMethodRaw(8); } ~WithRawMethod_GetMessage() override { @@ -2118,7 +2265,7 @@ namespace protobuf } void RequestGetMessage(::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(7, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(8, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -2132,7 +2279,7 @@ namespace protobuf public: WithRawMethod_FixMachine() { - ::grpc::Service::MarkMethodRaw(8); + ::grpc::Service::MarkMethodRaw(9); } ~WithRawMethod_FixMachine() override { @@ -2146,7 +2293,7 @@ namespace protobuf } void RequestFixMachine(::grpc::ServerContext* context, ::grpc::ServerAsyncReaderWriter<::grpc::ByteBuffer, ::grpc::ByteBuffer>* stream, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag) { - ::grpc::Service::RequestAsyncBidiStreaming(8, context, stream, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncBidiStreaming(9, context, stream, new_call_cq, notification_cq, tag); } }; template @@ -2160,7 +2307,7 @@ namespace protobuf public: WithRawMethod_SaveHuman() { - ::grpc::Service::MarkMethodRaw(9); + ::grpc::Service::MarkMethodRaw(10); } ~WithRawMethod_SaveHuman() override { @@ -2174,7 +2321,7 @@ namespace protobuf } void RequestSaveHuman(::grpc::ServerContext* context, ::grpc::ServerAsyncReaderWriter<::grpc::ByteBuffer, ::grpc::ByteBuffer>* stream, ::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::RequestAsyncBidiStreaming(10, context, stream, new_call_cq, notification_cq, tag); } }; template @@ -2188,7 +2335,7 @@ namespace protobuf public: WithRawMethod_Attack() { - ::grpc::Service::MarkMethodRaw(10); + ::grpc::Service::MarkMethodRaw(11); } ~WithRawMethod_Attack() override { @@ -2202,7 +2349,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(10, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(11, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -2216,7 +2363,7 @@ namespace protobuf public: WithRawMethod_CarryHuman() { - ::grpc::Service::MarkMethodRaw(11); + ::grpc::Service::MarkMethodRaw(12); } ~WithRawMethod_CarryHuman() override { @@ -2230,7 +2377,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(11, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(12, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -2244,7 +2391,7 @@ namespace protobuf public: WithRawMethod_ReleaseHuman() { - ::grpc::Service::MarkMethodRaw(12); + ::grpc::Service::MarkMethodRaw(13); } ~WithRawMethod_ReleaseHuman() override { @@ -2258,7 +2405,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(12, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(13, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -2272,7 +2419,7 @@ namespace protobuf public: WithRawMethod_HangHuman() { - ::grpc::Service::MarkMethodRaw(13); + ::grpc::Service::MarkMethodRaw(14); } ~WithRawMethod_HangHuman() override { @@ -2286,7 +2433,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(13, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(14, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -2300,7 +2447,7 @@ namespace protobuf public: WithRawMethod_Escape() { - ::grpc::Service::MarkMethodRaw(14); + ::grpc::Service::MarkMethodRaw(15); } ~WithRawMethod_Escape() override { @@ -2314,7 +2461,38 @@ 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(14, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(15, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawCallbackMethod_TryConnection : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithRawCallbackMethod_TryConnection() + { + ::grpc::Service::MarkMethodRawCallback(0, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) + { return this->TryConnection(context, request, response); })); + } + ~WithRawCallbackMethod_TryConnection() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status TryConnection(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* TryConnection( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/ + ) + { + return nullptr; } }; template @@ -2328,7 +2506,7 @@ namespace protobuf public: WithRawCallbackMethod_AddPlayer() { - ::grpc::Service::MarkMethodRawCallback(0, new ::grpc::internal::CallbackServerStreamingHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request) + ::grpc::Service::MarkMethodRawCallback(1, new ::grpc::internal::CallbackServerStreamingHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request) { return this->AddPlayer(context, request); })); } ~WithRawCallbackMethod_AddPlayer() override @@ -2359,7 +2537,7 @@ namespace protobuf public: WithRawCallbackMethod_Move() { - ::grpc::Service::MarkMethodRawCallback(1, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) + ::grpc::Service::MarkMethodRawCallback(2, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->Move(context, request, response); })); } ~WithRawCallbackMethod_Move() override @@ -2390,7 +2568,7 @@ namespace protobuf public: WithRawCallbackMethod_PickProp() { - ::grpc::Service::MarkMethodRawCallback(2, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) + ::grpc::Service::MarkMethodRawCallback(3, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->PickProp(context, request, response); })); } ~WithRawCallbackMethod_PickProp() override @@ -2421,7 +2599,7 @@ namespace protobuf public: WithRawCallbackMethod_UseProp() { - ::grpc::Service::MarkMethodRawCallback(3, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) + ::grpc::Service::MarkMethodRawCallback(4, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->UseProp(context, request, response); })); } ~WithRawCallbackMethod_UseProp() override @@ -2452,7 +2630,7 @@ namespace protobuf public: WithRawCallbackMethod_UseSkill() { - ::grpc::Service::MarkMethodRawCallback(4, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) + ::grpc::Service::MarkMethodRawCallback(5, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->UseSkill(context, request, response); })); } ~WithRawCallbackMethod_UseSkill() override @@ -2483,7 +2661,7 @@ namespace protobuf public: WithRawCallbackMethod_SendMessage() { - ::grpc::Service::MarkMethodRawCallback(5, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) + ::grpc::Service::MarkMethodRawCallback(6, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->SendMessage(context, request, response); })); } ~WithRawCallbackMethod_SendMessage() override @@ -2514,7 +2692,7 @@ namespace protobuf public: WithRawCallbackMethod_HaveMessage() { - ::grpc::Service::MarkMethodRawCallback(6, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) + ::grpc::Service::MarkMethodRawCallback(7, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->HaveMessage(context, request, response); })); } ~WithRawCallbackMethod_HaveMessage() override @@ -2545,7 +2723,7 @@ namespace protobuf public: WithRawCallbackMethod_GetMessage() { - ::grpc::Service::MarkMethodRawCallback(7, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) + ::grpc::Service::MarkMethodRawCallback(8, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->GetMessage(context, request, response); })); } ~WithRawCallbackMethod_GetMessage() override @@ -2576,7 +2754,7 @@ namespace protobuf public: WithRawCallbackMethod_FixMachine() { - ::grpc::Service::MarkMethodRawCallback(8, new ::grpc::internal::CallbackBidiHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context) + ::grpc::Service::MarkMethodRawCallback(9, new ::grpc::internal::CallbackBidiHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context) { return this->FixMachine(context); })); } ~WithRawCallbackMethod_FixMachine() override @@ -2607,8 +2785,8 @@ namespace protobuf public: WithRawCallbackMethod_SaveHuman() { - ::grpc::Service::MarkMethodRawCallback(9, new ::grpc::internal::CallbackBidiHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context) - { return this->SaveHuman(context); })); + ::grpc::Service::MarkMethodRawCallback(10, new ::grpc::internal::CallbackBidiHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context) + { return this->SaveHuman(context); })); } ~WithRawCallbackMethod_SaveHuman() override { @@ -2638,7 +2816,7 @@ namespace protobuf public: WithRawCallbackMethod_Attack() { - ::grpc::Service::MarkMethodRawCallback(10, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) + ::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->Attack(context, request, response); })); } ~WithRawCallbackMethod_Attack() override @@ -2669,7 +2847,7 @@ namespace protobuf public: WithRawCallbackMethod_CarryHuman() { - ::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(12, 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 @@ -2700,7 +2878,7 @@ namespace protobuf public: WithRawCallbackMethod_ReleaseHuman() { - ::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(13, 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 @@ -2731,7 +2909,7 @@ namespace protobuf public: WithRawCallbackMethod_HangHuman() { - ::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(14, 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 @@ -2762,7 +2940,7 @@ namespace protobuf public: WithRawCallbackMethod_Escape() { - ::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(15, 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 @@ -2783,6 +2961,33 @@ namespace protobuf } }; template + class WithStreamedUnaryMethod_TryConnection : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithStreamedUnaryMethod_TryConnection() + { + ::grpc::Service::MarkMethodStreamed(0, new ::grpc::internal::StreamedUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* streamer) + { return this->StreamedTryConnection(context, streamer); })); + } + ~WithStreamedUnaryMethod_TryConnection() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status TryConnection(::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 StreamedTryConnection(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* server_unary_streamer) = 0; + }; + template class WithStreamedUnaryMethod_Move : public BaseClass { private: @@ -2793,7 +2998,7 @@ namespace protobuf public: WithStreamedUnaryMethod_Move() { - ::grpc::Service::MarkMethodStreamed(1, new ::grpc::internal::StreamedUnaryHandler<::protobuf::MoveMsg, ::protobuf::MoveRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::MoveMsg, ::protobuf::MoveRes>* streamer) + ::grpc::Service::MarkMethodStreamed(2, new ::grpc::internal::StreamedUnaryHandler<::protobuf::MoveMsg, ::protobuf::MoveRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::MoveMsg, ::protobuf::MoveRes>* streamer) { return this->StreamedMove(context, streamer); })); } ~WithStreamedUnaryMethod_Move() override @@ -2820,7 +3025,7 @@ namespace protobuf public: WithStreamedUnaryMethod_PickProp() { - ::grpc::Service::MarkMethodStreamed(2, new ::grpc::internal::StreamedUnaryHandler<::protobuf::PickMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::PickMsg, ::protobuf::BoolRes>* streamer) + ::grpc::Service::MarkMethodStreamed(3, new ::grpc::internal::StreamedUnaryHandler<::protobuf::PickMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::PickMsg, ::protobuf::BoolRes>* streamer) { return this->StreamedPickProp(context, streamer); })); } ~WithStreamedUnaryMethod_PickProp() override @@ -2847,7 +3052,7 @@ namespace protobuf public: WithStreamedUnaryMethod_UseProp() { - ::grpc::Service::MarkMethodStreamed(3, new ::grpc::internal::StreamedUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* streamer) + ::grpc::Service::MarkMethodStreamed(4, new ::grpc::internal::StreamedUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* streamer) { return this->StreamedUseProp(context, streamer); })); } ~WithStreamedUnaryMethod_UseProp() override @@ -2874,7 +3079,7 @@ namespace protobuf public: WithStreamedUnaryMethod_UseSkill() { - ::grpc::Service::MarkMethodStreamed(4, new ::grpc::internal::StreamedUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* streamer) + ::grpc::Service::MarkMethodStreamed(5, new ::grpc::internal::StreamedUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* streamer) { return this->StreamedUseSkill(context, streamer); })); } ~WithStreamedUnaryMethod_UseSkill() override @@ -2901,7 +3106,7 @@ namespace protobuf public: WithStreamedUnaryMethod_SendMessage() { - ::grpc::Service::MarkMethodStreamed(5, new ::grpc::internal::StreamedUnaryHandler<::protobuf::SendMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::SendMsg, ::protobuf::BoolRes>* streamer) + ::grpc::Service::MarkMethodStreamed(6, new ::grpc::internal::StreamedUnaryHandler<::protobuf::SendMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::SendMsg, ::protobuf::BoolRes>* streamer) { return this->StreamedSendMessage(context, streamer); })); } ~WithStreamedUnaryMethod_SendMessage() override @@ -2928,7 +3133,7 @@ namespace protobuf public: WithStreamedUnaryMethod_HaveMessage() { - ::grpc::Service::MarkMethodStreamed(6, new ::grpc::internal::StreamedUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* streamer) + ::grpc::Service::MarkMethodStreamed(7, new ::grpc::internal::StreamedUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* streamer) { return this->StreamedHaveMessage(context, streamer); })); } ~WithStreamedUnaryMethod_HaveMessage() override @@ -2955,7 +3160,7 @@ namespace protobuf public: WithStreamedUnaryMethod_GetMessage() { - ::grpc::Service::MarkMethodStreamed(7, new ::grpc::internal::StreamedUnaryHandler<::protobuf::IDMsg, ::protobuf::MsgRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::MsgRes>* streamer) + ::grpc::Service::MarkMethodStreamed(8, new ::grpc::internal::StreamedUnaryHandler<::protobuf::IDMsg, ::protobuf::MsgRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::MsgRes>* streamer) { return this->StreamedGetMessage(context, streamer); })); } ~WithStreamedUnaryMethod_GetMessage() override @@ -2982,7 +3187,7 @@ namespace protobuf public: WithStreamedUnaryMethod_Attack() { - ::grpc::Service::MarkMethodStreamed(10, new ::grpc::internal::StreamedUnaryHandler<::protobuf::AttackMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::AttackMsg, ::protobuf::BoolRes>* streamer) + ::grpc::Service::MarkMethodStreamed(11, 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 @@ -3009,7 +3214,7 @@ namespace protobuf public: WithStreamedUnaryMethod_CarryHuman() { - ::grpc::Service::MarkMethodStreamed(11, new ::grpc::internal::StreamedUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* streamer) + ::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->StreamedCarryHuman(context, streamer); })); } ~WithStreamedUnaryMethod_CarryHuman() override @@ -3036,7 +3241,7 @@ namespace protobuf public: WithStreamedUnaryMethod_ReleaseHuman() { - ::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(13, 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 @@ -3063,7 +3268,7 @@ namespace protobuf public: WithStreamedUnaryMethod_HangHuman() { - ::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(14, 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 @@ -3090,7 +3295,7 @@ namespace protobuf public: WithStreamedUnaryMethod_Escape() { - ::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(15, 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 @@ -3106,7 +3311,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_Move>>>>>>>>>>> StreamedUnaryService; + typedef WithStreamedUnaryMethod_TryConnection>>>>>>>>>>>> StreamedUnaryService; template class WithSplitStreamingMethod_AddPlayer : public BaseClass { @@ -3118,7 +3323,7 @@ namespace protobuf public: WithSplitStreamingMethod_AddPlayer() { - ::grpc::Service::MarkMethodStreamed(0, new ::grpc::internal::SplitServerStreamingHandler<::protobuf::PlayerMsg, ::protobuf::MessageToClient>([this](::grpc::ServerContext* context, ::grpc::ServerSplitStreamer<::protobuf::PlayerMsg, ::protobuf::MessageToClient>* streamer) + ::grpc::Service::MarkMethodStreamed(1, new ::grpc::internal::SplitServerStreamingHandler<::protobuf::PlayerMsg, ::protobuf::MessageToClient>([this](::grpc::ServerContext* context, ::grpc::ServerSplitStreamer<::protobuf::PlayerMsg, ::protobuf::MessageToClient>* streamer) { return this->StreamedAddPlayer(context, streamer); })); } ~WithSplitStreamingMethod_AddPlayer() override @@ -3135,7 +3340,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 WithSplitStreamingMethod_AddPlayer>>>>>>>>>>>> StreamedService; + typedef WithStreamedUnaryMethod_TryConnection>>>>>>>>>>>>> StreamedService; }; } // namespace protobuf diff --git a/CAPI/proto/Message2Clients.pb.cc b/CAPI/proto/Message2Clients.pb.cc index cfb7103..b101df8 100644 --- a/CAPI/proto/Message2Clients.pb.cc +++ b/CAPI/proto/Message2Clients.pb.cc @@ -483,26 +483,28 @@ const char descriptor_table_protodef_Message2Clients_2eproto[] PROTOBUF_SECTION_ "_angle\030\002 \001(\001\"\036\n\007BoolRes\022\023\n\013act_success\030\001" " \001(\010\"P\n\006MsgRes\022\024\n\014have_message\030\001 \001(\010\022\026\n\016" "from_player_id\030\002 \001(\003\022\030\n\020message_received" - "\030\003 \001(\t2\213\006\n\020AvailableService\022=\n\tAddPlayer" - "\022\023.protobuf.PlayerMsg\032\031.protobuf.Message" - "ToClient0\001\022,\n\004Move\022\021.protobuf.MoveMsg\032\021." - "protobuf.MoveRes\0220\n\010PickProp\022\021.protobuf." - "PickMsg\032\021.protobuf.BoolRes\022-\n\007UseProp\022\017." - "protobuf.IDMsg\032\021.protobuf.BoolRes\022.\n\010Use" - "Skill\022\017.protobuf.IDMsg\032\021.protobuf.BoolRe" - "s\0223\n\013SendMessage\022\021.protobuf.SendMsg\032\021.pr" - "otobuf.BoolRes\0221\n\013HaveMessage\022\017.protobuf" - ".IDMsg\032\021.protobuf.BoolRes\022/\n\nGetMessage\022" - "\017.protobuf.IDMsg\032\020.protobuf.MsgRes\0224\n\nFi" - "xMachine\022\017.protobuf.IDMsg\032\021.protobuf.Boo" - "lRes(\0010\001\0223\n\tSaveHuman\022\017.protobuf.IDMsg\032\021" - ".protobuf.BoolRes(\0010\001\0220\n\006Attack\022\023.protob" - "uf.AttackMsg\032\021.protobuf.BoolRes\0220\n\nCarry" - "Human\022\017.protobuf.IDMsg\032\021.protobuf.BoolRe" - "s\0222\n\014ReleaseHuman\022\017.protobuf.IDMsg\032\021.pro" - "tobuf.BoolRes\022/\n\tHangHuman\022\017.protobuf.ID" - "Msg\032\021.protobuf.BoolRes\022,\n\006Escape\022\017.proto" - "buf.IDMsg\032\021.protobuf.BoolResb\006proto3"; + "\030\003 \001(\t2\300\006\n\020AvailableService\0223\n\rTryConnec" + "tion\022\017.protobuf.IDMsg\032\021.protobuf.BoolRes" + "\022=\n\tAddPlayer\022\023.protobuf.PlayerMsg\032\031.pro" + "tobuf.MessageToClient0\001\022,\n\004Move\022\021.protob" + "uf.MoveMsg\032\021.protobuf.MoveRes\0220\n\010PickPro" + "p\022\021.protobuf.PickMsg\032\021.protobuf.BoolRes\022" + "-\n\007UseProp\022\017.protobuf.IDMsg\032\021.protobuf.B" + "oolRes\022.\n\010UseSkill\022\017.protobuf.IDMsg\032\021.pr" + "otobuf.BoolRes\0223\n\013SendMessage\022\021.protobuf" + ".SendMsg\032\021.protobuf.BoolRes\0221\n\013HaveMessa" + "ge\022\017.protobuf.IDMsg\032\021.protobuf.BoolRes\022/" + "\n\nGetMessage\022\017.protobuf.IDMsg\032\020.protobuf" + ".MsgRes\0224\n\nFixMachine\022\017.protobuf.IDMsg\032\021" + ".protobuf.BoolRes(\0010\001\0223\n\tSaveHuman\022\017.pro" + "tobuf.IDMsg\032\021.protobuf.BoolRes(\0010\001\0220\n\006At" + "tack\022\023.protobuf.AttackMsg\032\021.protobuf.Boo" + "lRes\0220\n\nCarryHuman\022\017.protobuf.IDMsg\032\021.pr" + "otobuf.BoolRes\0222\n\014ReleaseHuman\022\017.protobu" + "f.IDMsg\032\021.protobuf.BoolRes\022/\n\tHangHuman\022" + "\017.protobuf.IDMsg\032\021.protobuf.BoolRes\022,\n\006E" + "scape\022\017.protobuf.IDMsg\032\021.protobuf.BoolRe" + "sb\006proto3"; static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable* const descriptor_table_Message2Clients_2eproto_deps[2] = { &::descriptor_table_Message2Server_2eproto, &::descriptor_table_MessageType_2eproto, @@ -511,7 +513,7 @@ static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_Message2Cli const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_Message2Clients_2eproto = { false, false, - 2396, + 2449, descriptor_table_protodef_Message2Clients_2eproto, "Message2Clients.proto", &descriptor_table_Message2Clients_2eproto_once, diff --git a/CAPI/proto/Message2Server.pb.cc b/CAPI/proto/Message2Server.pb.cc index ecf410c..9777136 100644 --- a/CAPI/proto/Message2Server.pb.cc +++ b/CAPI/proto/Message2Server.pb.cc @@ -136,7 +136,7 @@ namespace protobuf constexpr IDMsg::IDMsg( ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized ) : - playerid_(int64_t{0}) + player_id_(int64_t{0}) { } struct IDMsgDefaultTypeInternal @@ -211,7 +211,7 @@ const uint32_t TableStruct_Message2Server_2eproto::offsets[] PROTOBUF_SECTION_VA ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ - PROTOBUF_FIELD_OFFSET(::protobuf::IDMsg, playerid_), + PROTOBUF_FIELD_OFFSET(::protobuf::IDMsg, player_id_), }; static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { {0, -1, -1, sizeof(::protobuf::PlayerMsg)}, @@ -244,8 +244,8 @@ const char descriptor_table_protodef_Message2Server_2eproto[] PROTOBUF_SECTION_V "obuf.PropType\"C\n\007SendMsg\022\021\n\tplayer_id\030\001 " "\001(\003\022\024\n\014to_player_id\030\002 \001(\003\022\017\n\007message\030\003 \001" "(\t\"-\n\tAttackMsg\022\021\n\tplayer_id\030\001 \001(\003\022\r\n\005an" - "gle\030\002 \001(\001\"\031\n\005IDMsg\022\020\n\010playerID\030\001 \001(\003b\006pr" - "oto3"; + "gle\030\002 \001(\001\"\032\n\005IDMsg\022\021\n\tplayer_id\030\001 \001(\003b\006p" + "roto3"; static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable* const descriptor_table_Message2Server_2eproto_deps[1] = { &::descriptor_table_MessageType_2eproto, }; @@ -253,7 +253,7 @@ static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_Message2Ser const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_Message2Server_2eproto = { false, false, - 524, + 525, descriptor_table_protodef_Message2Server_2eproto, "Message2Server.proto", &descriptor_table_Message2Server_2eproto_once, @@ -1773,13 +1773,13 @@ namespace protobuf ::PROTOBUF_NAMESPACE_ID::Message() { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); - playerid_ = from.playerid_; + player_id_ = from.player_id_; // @@protoc_insertion_point(copy_constructor:protobuf.IDMsg) } inline void IDMsg::SharedCtor() { - playerid_ = int64_t{0}; + player_id_ = int64_t{0}; } IDMsg::~IDMsg() @@ -1816,7 +1816,7 @@ namespace protobuf // Prevent compiler warnings about cached_has_bits being unused (void)cached_has_bits; - playerid_ = int64_t{0}; + player_id_ = int64_t{0}; _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } @@ -1831,11 +1831,11 @@ namespace protobuf ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { - // int64 playerID = 1; + // int64 player_id = 1; case 1: if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { - playerid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + player_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); } else @@ -1875,11 +1875,11 @@ namespace protobuf uint32_t cached_has_bits = 0; (void)cached_has_bits; - // int64 playerID = 1; - if (this->_internal_playerid() != 0) + // int64 player_id = 1; + if (this->_internal_player_id() != 0) { target = stream->EnsureSpace(target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(1, this->_internal_playerid(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(1, this->_internal_player_id(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) @@ -1901,10 +1901,10 @@ namespace protobuf // Prevent compiler warnings about cached_has_bits being unused (void)cached_has_bits; - // int64 playerID = 1; - if (this->_internal_playerid() != 0) + // int64 player_id = 1; + if (this->_internal_player_id() != 0) { - total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_playerid()); + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_player_id()); } return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); @@ -1932,9 +1932,9 @@ namespace protobuf uint32_t cached_has_bits = 0; (void)cached_has_bits; - if (from._internal_playerid() != 0) + if (from._internal_player_id() != 0) { - _internal_set_playerid(from._internal_playerid()); + _internal_set_player_id(from._internal_player_id()); } _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } @@ -1957,7 +1957,7 @@ namespace protobuf { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(playerid_, other->playerid_); + swap(player_id_, other->player_id_); } ::PROTOBUF_NAMESPACE_ID::Metadata IDMsg::GetMetadata() const diff --git a/CAPI/proto/Message2Server.pb.h b/CAPI/proto/Message2Server.pb.h index 2ec2421..33caf27 100644 --- a/CAPI/proto/Message2Server.pb.h +++ b/CAPI/proto/Message2Server.pb.h @@ -1331,16 +1331,16 @@ namespace protobuf enum : int { - kPlayerIDFieldNumber = 1, + kPlayerIdFieldNumber = 1, }; - // int64 playerID = 1; - void clear_playerid(); - int64_t playerid() const; - void set_playerid(int64_t value); + // int64 player_id = 1; + void clear_player_id(); + int64_t player_id() const; + void set_player_id(int64_t value); private: - int64_t _internal_playerid() const; - void _internal_set_playerid(int64_t value); + int64_t _internal_player_id() const; + void _internal_set_player_id(int64_t value); public: // @@protoc_insertion_point(class_scope:protobuf.IDMsg) @@ -1352,7 +1352,7 @@ namespace protobuf friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; - int64_t playerid_; + int64_t player_id_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; friend struct ::TableStruct_Message2Server_2eproto; }; @@ -1817,28 +1817,28 @@ namespace protobuf // IDMsg - // int64 playerID = 1; - inline void IDMsg::clear_playerid() + // int64 player_id = 1; + inline void IDMsg::clear_player_id() { - playerid_ = int64_t{0}; + player_id_ = int64_t{0}; } - inline int64_t IDMsg::_internal_playerid() const + inline int64_t IDMsg::_internal_player_id() const { - return playerid_; + return player_id_; } - inline int64_t IDMsg::playerid() const + inline int64_t IDMsg::player_id() const { - // @@protoc_insertion_point(field_get:protobuf.IDMsg.playerID) - return _internal_playerid(); + // @@protoc_insertion_point(field_get:protobuf.IDMsg.player_id) + return _internal_player_id(); } - inline void IDMsg::_internal_set_playerid(int64_t value) + inline void IDMsg::_internal_set_player_id(int64_t value) { - playerid_ = value; + player_id_ = value; } - inline void IDMsg::set_playerid(int64_t value) + inline void IDMsg::set_player_id(int64_t value) { - _internal_set_playerid(value); - // @@protoc_insertion_point(field_set:protobuf.IDMsg.playerID) + _internal_set_player_id(value); + // @@protoc_insertion_point(field_set:protobuf.IDMsg.player_id) } #ifdef __GNUC__ diff --git a/dependency/proto/Message2Clients.proto b/dependency/proto/Message2Clients.proto index b03fdb8..edae464 100755 --- a/dependency/proto/Message2Clients.proto +++ b/dependency/proto/Message2Clients.proto @@ -101,6 +101,8 @@ message MsgRes // 用于获取队友发来的消息 service AvailableService { + rpc TryConnection(IDMsg) returns(BoolRes); + // 游戏开局调用一次的服务 rpc AddPlayer(PlayerMsg) returns(stream MessageToClient); // 连接上后等待游戏开始,server会定时通过该服务向所有client发送消息。 diff --git a/dependency/proto/Message2Server.proto b/dependency/proto/Message2Server.proto index 939cc4e..b3891b6 100755 --- a/dependency/proto/Message2Server.proto +++ b/dependency/proto/Message2Server.proto @@ -43,7 +43,7 @@ message AttackMsg message IDMsg { - int64 playerID = 1; + int64 player_id = 1; } // 基本继承于THUAI5,为了使发送的信息尽可能不被浪费,暂定不发这类大包。