Browse Source

Merge pull request #146 from DragonAura/dev

feat(CAPI):  update with new rules
tags/0.1.0
Timothy Liu GitHub 2 years ago
parent
commit
efb6bc9fff
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 2284 additions and 3097 deletions
  1. +60
    -18
      CAPI/cpp/API/include/API.h
  2. +2
    -1
      CAPI/cpp/API/include/Communication.h
  3. +15
    -8
      CAPI/cpp/API/include/logic.h
  4. +3
    -1
      CAPI/cpp/API/include/state.h
  5. +12
    -23
      CAPI/cpp/API/include/structures.h
  6. +22
    -69
      CAPI/cpp/API/include/utils.hpp
  7. +52
    -2
      CAPI/cpp/API/src/API.cpp
  8. +44
    -21
      CAPI/cpp/API/src/Communication.cpp
  9. +100
    -26
      CAPI/cpp/API/src/DebugAPI.cpp
  10. +122
    -8
      CAPI/cpp/API/src/logic.cpp
  11. +547
    -986
      CAPI/cpp/proto/Message2Clients.pb.cc
  12. +878
    -1280
      CAPI/cpp/proto/Message2Clients.pb.h
  13. +102
    -338
      CAPI/cpp/proto/Message2Server.pb.cc
  14. +55
    -307
      CAPI/cpp/proto/Message2Server.pb.h
  15. +53
    -1
      CAPI/cpp/proto/Services.grpc.pb.cc
  16. +212
    -4
      CAPI/cpp/proto/Services.grpc.pb.h
  17. +5
    -4
      CAPI/cpp/proto/Services.pb.cc

+ 60
- 18
CAPI/cpp/API/include/API.h View File

@@ -32,14 +32,21 @@ class ILogic


public: public:
// 获取服务器发来的消息 // 获取服务器发来的消息
virtual std::vector<std::shared_ptr<const THUAI6::Tricker>> GetTrickers() const = 0;
virtual std::vector<std::shared_ptr<const THUAI6::Student>> GetStudents() const = 0;
virtual std::vector<std::shared_ptr<const THUAI6::Prop>> GetProps() const = 0;
virtual std::shared_ptr<const THUAI6::Student> StudentGetSelfInfo() const = 0;
virtual std::shared_ptr<const THUAI6::Tricker> TrickerGetSelfInfo() const = 0;
[[nodiscard]] virtual std::vector<std::shared_ptr<const THUAI6::Tricker>> GetTrickers() const = 0;
[[nodiscard]] virtual std::vector<std::shared_ptr<const THUAI6::Student>> GetStudents() const = 0;
[[nodiscard]] virtual std::vector<std::shared_ptr<const THUAI6::Prop>> GetProps() const = 0;
[[nodiscard]] virtual std::shared_ptr<const THUAI6::Student> StudentGetSelfInfo() const = 0;
[[nodiscard]] virtual std::shared_ptr<const THUAI6::Tricker> TrickerGetSelfInfo() const = 0;

[[nodiscard]] virtual std::vector<std::vector<THUAI6::PlaceType>> GetFullMap() const = 0;
[[nodiscard]] virtual THUAI6::PlaceType GetPlaceType(int32_t cellX, int32_t cellY) const = 0;

[[nodiscard]] virtual int32_t GetClassroomProgress(int32_t cellX, int32_t cellY) const = 0;
[[nodiscard]] virtual int32_t GetChestProgress(int32_t cellX, int32_t cellY) const = 0;
[[nodiscard]] virtual int32_t GetGateProgress(int32_t cellX, int32_t cellY) const = 0;
[[nodiscard]] virtual bool IsDoorOpen(int32_t cellX, int32_t cellY) const = 0;


virtual std::vector<std::vector<THUAI6::PlaceType>> GetFullMap() const = 0;
virtual THUAI6::PlaceType GetPlaceType(int32_t cellX, int32_t cellY) const = 0;
[[nodiscard]] virtual std::shared_ptr<const THUAI6::GameInfo> GetGameInfo() const = 0;


// 供IAPI使用的操作相关的部分 // 供IAPI使用的操作相关的部分
virtual bool Move(int64_t time, double angle) = 0; virtual bool Move(int64_t time, double angle) = 0;
@@ -71,7 +78,7 @@ public:
// ITrickerAPI使用的部分 // ITrickerAPI使用的部分
virtual bool Attack(double angle) = 0; virtual bool Attack(double angle) = 0;


virtual const std::vector<int64_t> GetPlayerGUIDs() const = 0;
virtual std::vector<int64_t> GetPlayerGUIDs() const = 0;
}; };


class IAPI class IAPI
@@ -117,10 +124,17 @@ public:


// 获取地图信息,视野外的地图统一为Land // 获取地图信息,视野外的地图统一为Land
[[nodiscard]] virtual std::vector<std::vector<THUAI6::PlaceType>> GetFullMap() const = 0; [[nodiscard]] virtual std::vector<std::vector<THUAI6::PlaceType>> GetFullMap() const = 0;
[[nodiscard]] virtual THUAI6::PlaceType GetPlaceType(int32_t CellX, int32_t CellY) const = 0;
[[nodiscard]] virtual THUAI6::PlaceType GetPlaceType(int32_t cellX, int32_t cellY) const = 0;

[[nodiscard]] virtual bool IsDoorOpen(int32_t cellX, int32_t cellY) const = 0;
[[nodiscard]] virtual int32_t GetChestProgress(int32_t cellX, int32_t cellY) const = 0;
[[nodiscard]] virtual int32_t GetGateProgress(int32_t cellX, int32_t cellY) const = 0;
[[nodiscard]] virtual int32_t GetClassroomProgress(int32_t cellX, int32_t cellY) const = 0;

[[nodiscard]] virtual std::shared_ptr<const THUAI6::GameInfo> GetGameInfo() const = 0;


// 获取所有玩家的GUID // 获取所有玩家的GUID
[[nodiscard]] virtual const std::vector<int64_t> GetPlayerGUIDs() const = 0;
[[nodiscard]] virtual std::vector<int64_t> GetPlayerGUIDs() const = 0;


// 获取游戏目前所进行的帧数 // 获取游戏目前所进行的帧数
[[nodiscard]] virtual int GetFrameCount() const = 0; [[nodiscard]] virtual int GetFrameCount() const = 0;
@@ -225,9 +239,16 @@ public:
[[nodiscard]] std::vector<std::shared_ptr<const THUAI6::Prop>> GetProps() const override; [[nodiscard]] std::vector<std::shared_ptr<const THUAI6::Prop>> GetProps() const override;


[[nodiscard]] std::vector<std::vector<THUAI6::PlaceType>> GetFullMap() const override; [[nodiscard]] std::vector<std::vector<THUAI6::PlaceType>> GetFullMap() const override;
[[nodiscard]] THUAI6::PlaceType GetPlaceType(int32_t CellX, int32_t CellY) const override;
[[nodiscard]] THUAI6::PlaceType GetPlaceType(int32_t cellX, int32_t cellY) const override;


[[nodiscard]] const std::vector<int64_t> GetPlayerGUIDs() const override;
[[nodiscard]] bool IsDoorOpen(int32_t cellX, int32_t cellY) const override;
[[nodiscard]] int32_t GetChestProgress(int32_t cellX, int32_t cellY) const override;
[[nodiscard]] int32_t GetGateProgress(int32_t cellX, int32_t cellY) const override;
[[nodiscard]] int32_t GetClassroomProgress(int32_t cellX, int32_t cellY) const override;

[[nodiscard]] std::shared_ptr<const THUAI6::GameInfo> GetGameInfo() const override;

[[nodiscard]] std::vector<int64_t> GetPlayerGUIDs() const override;


std::future<bool> StartLearning() override; std::future<bool> StartLearning() override;
std::future<bool> StartTreatMate() override; std::future<bool> StartTreatMate() override;
@@ -298,9 +319,16 @@ public:
[[nodiscard]] std::vector<std::shared_ptr<const THUAI6::Prop>> GetProps() const override; [[nodiscard]] std::vector<std::shared_ptr<const THUAI6::Prop>> GetProps() const override;


[[nodiscard]] std::vector<std::vector<THUAI6::PlaceType>> GetFullMap() const override; [[nodiscard]] std::vector<std::vector<THUAI6::PlaceType>> GetFullMap() const override;
[[nodiscard]] THUAI6::PlaceType GetPlaceType(int32_t CellX, int32_t CellY) const override;
[[nodiscard]] THUAI6::PlaceType GetPlaceType(int32_t cellX, int32_t cellY) const override;

[[nodiscard]] bool IsDoorOpen(int32_t cellX, int32_t cellY) const override;
[[nodiscard]] int32_t GetChestProgress(int32_t cellX, int32_t cellY) const override;
[[nodiscard]] int32_t GetGateProgress(int32_t cellX, int32_t cellY) const override;
[[nodiscard]] int32_t GetClassroomProgress(int32_t cellX, int32_t cellY) const override;

[[nodiscard]] std::shared_ptr<const THUAI6::GameInfo> GetGameInfo() const override;


[[nodiscard]] const std::vector<int64_t> GetPlayerGUIDs() const override;
[[nodiscard]] std::vector<int64_t> GetPlayerGUIDs() const override;


std::future<bool> Attack(double angleInRadian) override; std::future<bool> Attack(double angleInRadian) override;
[[nodiscard]] std::shared_ptr<const THUAI6::Tricker> GetSelfInfo() const override; [[nodiscard]] std::shared_ptr<const THUAI6::Tricker> GetSelfInfo() const override;
@@ -363,9 +391,16 @@ public:
[[nodiscard]] std::vector<std::shared_ptr<const THUAI6::Prop>> GetProps() const override; [[nodiscard]] std::vector<std::shared_ptr<const THUAI6::Prop>> GetProps() const override;


[[nodiscard]] std::vector<std::vector<THUAI6::PlaceType>> GetFullMap() const override; [[nodiscard]] std::vector<std::vector<THUAI6::PlaceType>> GetFullMap() const override;
[[nodiscard]] THUAI6::PlaceType GetPlaceType(int32_t CellX, int32_t CellY) const override;
[[nodiscard]] THUAI6::PlaceType GetPlaceType(int32_t cellX, int32_t cellY) const override;


[[nodiscard]] const std::vector<int64_t> GetPlayerGUIDs() const override;
[[nodiscard]] bool IsDoorOpen(int32_t cellX, int32_t cellY) const override;
[[nodiscard]] int32_t GetChestProgress(int32_t cellX, int32_t cellY) const override;
[[nodiscard]] int32_t GetGateProgress(int32_t cellX, int32_t cellY) const override;
[[nodiscard]] int32_t GetClassroomProgress(int32_t cellX, int32_t cellY) const override;

[[nodiscard]] std::shared_ptr<const THUAI6::GameInfo> GetGameInfo() const override;

[[nodiscard]] std::vector<int64_t> GetPlayerGUIDs() const override;


std::future<bool> StartLearning() override; std::future<bool> StartLearning() override;
std::future<bool> StartTreatMate() override; std::future<bool> StartTreatMate() override;
@@ -423,9 +458,16 @@ public:
[[nodiscard]] std::vector<std::shared_ptr<const THUAI6::Prop>> GetProps() const override; [[nodiscard]] std::vector<std::shared_ptr<const THUAI6::Prop>> GetProps() const override;


[[nodiscard]] std::vector<std::vector<THUAI6::PlaceType>> GetFullMap() const override; [[nodiscard]] std::vector<std::vector<THUAI6::PlaceType>> GetFullMap() const override;
[[nodiscard]] THUAI6::PlaceType GetPlaceType(int32_t CellX, int32_t CellY) const override;
[[nodiscard]] THUAI6::PlaceType GetPlaceType(int32_t cellX, int32_t cellY) const override;

[[nodiscard]] bool IsDoorOpen(int32_t cellX, int32_t cellY) const override;
[[nodiscard]] int32_t GetChestProgress(int32_t cellX, int32_t cellY) const override;
[[nodiscard]] int32_t GetGateProgress(int32_t cellX, int32_t cellY) const override;
[[nodiscard]] int32_t GetClassroomProgress(int32_t cellX, int32_t cellY) const override;

[[nodiscard]] std::shared_ptr<const THUAI6::GameInfo> GetGameInfo() const override;


[[nodiscard]] const std::vector<int64_t> GetPlayerGUIDs() const override;
[[nodiscard]] std::vector<int64_t> GetPlayerGUIDs() const override;


std::future<bool> Attack(double angleInRadian) override; std::future<bool> Attack(double angleInRadian) override;
[[nodiscard]] std::shared_ptr<const THUAI6::Tricker> GetSelfInfo() const override; [[nodiscard]] std::shared_ptr<const THUAI6::Tricker> GetSelfInfo() const override;


+ 2
- 1
CAPI/cpp/API/include/Communication.h View File

@@ -50,11 +50,12 @@ public:
protobuf::MessageToClient GetMessage2Client(); protobuf::MessageToClient GetMessage2Client();
void AddPlayer(int64_t playerID, THUAI6::PlayerType playerType, THUAI6::StudentType studentType, THUAI6::TrickerType trickerType); void AddPlayer(int64_t playerID, THUAI6::PlayerType playerType, THUAI6::StudentType studentType, THUAI6::TrickerType trickerType);


[[nodiscard]] std::vector<std::vector<THUAI6::PlaceType>> GetMap(int64_t playerID);

void ReadMessage(int64_t playerID); void ReadMessage(int64_t playerID);


private: private:
std::unique_ptr<protobuf::AvailableService::Stub> THUAI6Stub; std::unique_ptr<protobuf::AvailableService::Stub> THUAI6Stub;
THUAI6::PlayerType playerType;
bool haveNewMessage = false; bool haveNewMessage = false;
protobuf::MessageToClient message2Client; protobuf::MessageToClient message2Client;
ConcurrentQueue<std::pair<int64_t, std::string>> messageQueue; ConcurrentQueue<std::pair<int64_t, std::string>> messageQueue;


+ 15
- 8
CAPI/cpp/API/include/logic.h View File

@@ -90,14 +90,21 @@ private:


// 提供给API使用的函数 // 提供给API使用的函数


std::vector<std::shared_ptr<const THUAI6::Tricker>> GetTrickers() const override;
std::vector<std::shared_ptr<const THUAI6::Student>> GetStudents() const override;
std::vector<std::shared_ptr<const THUAI6::Prop>> GetProps() const override;
std::shared_ptr<const THUAI6::Student> StudentGetSelfInfo() const override;
std::shared_ptr<const THUAI6::Tricker> TrickerGetSelfInfo() const override;
[[nodiscard]] std::vector<std::shared_ptr<const THUAI6::Tricker>> GetTrickers() const override;
[[nodiscard]] std::vector<std::shared_ptr<const THUAI6::Student>> GetStudents() const override;
[[nodiscard]] std::vector<std::shared_ptr<const THUAI6::Prop>> GetProps() const override;
[[nodiscard]] std::shared_ptr<const THUAI6::Student> StudentGetSelfInfo() const override;
[[nodiscard]] std::shared_ptr<const THUAI6::Tricker> TrickerGetSelfInfo() const override;


std::vector<std::vector<THUAI6::PlaceType>> GetFullMap() const override;
THUAI6::PlaceType GetPlaceType(int32_t CellX, int32_t CellY) const override;
[[nodiscard]] std::vector<std::vector<THUAI6::PlaceType>> GetFullMap() const override;
[[nodiscard]] THUAI6::PlaceType GetPlaceType(int32_t cellX, int32_t cellY) const override;

[[nodiscard]] bool IsDoorOpen(int32_t cellX, int32_t cellY) const override;
[[nodiscard]] int32_t GetClassroomProgress(int32_t cellX, int32_t cellY) const override;
[[nodiscard]] int32_t GetChestProgress(int32_t cellX, int32_t cellY) const override;
[[nodiscard]] int32_t GetGateProgress(int32_t cellX, int32_t cellY) const override;

[[nodiscard]] std::shared_ptr<const THUAI6::GameInfo> GetGameInfo() const override;


// 供IAPI使用的操作相关的部分 // 供IAPI使用的操作相关的部分
bool Move(int64_t time, double angle) override; bool Move(int64_t time, double angle) override;
@@ -129,7 +136,7 @@ private:


int GetCounter() const override; int GetCounter() const override;


const std::vector<int64_t> GetPlayerGUIDs() const override;
std::vector<int64_t> GetPlayerGUIDs() const override;


bool TryConnection(); bool TryConnection();




+ 3
- 1
CAPI/cpp/API/include/state.h View File

@@ -25,7 +25,9 @@ struct State


std::vector<std::shared_ptr<THUAI6::BombedBullet>> bombedBullets; std::vector<std::shared_ptr<THUAI6::BombedBullet>> bombedBullets;


std::shared_ptr<THUAI6::GameMap> gameMap;
std::vector<std::vector<THUAI6::PlaceType>> gameMap;

std::shared_ptr<THUAI6::GameMap> mapInfo;


std::shared_ptr<THUAI6::GameInfo> gameInfo; std::shared_ptr<THUAI6::GameInfo> gameInfo;




+ 12
- 23
CAPI/cpp/API/include/structures.h View File

@@ -138,15 +138,10 @@ namespace THUAI6
PropMessage = 3, PropMessage = 3,
BulletMessage = 4, BulletMessage = 4,
BombedBulletMessage = 5, BombedBulletMessage = 5,
};

enum class MessageOfMapObj : unsigned char
{
NullMessageOfMapObj = 0,
ClassroomMessage = 1,
DoorMessage = 2,
GateMessage = 3,
ChestMessage = 4,
ClassroomMessage = 6,
DoorMessage = 7,
GateMessage = 8,
ChestMessage = 9,
}; };


// 玩家类 // 玩家类
@@ -160,8 +155,8 @@ namespace THUAI6
int64_t guid; // 全局唯一ID int64_t guid; // 全局唯一ID
int16_t radius; // 圆形物体的半径或正方形物体的内切圆半径 int16_t radius; // 圆形物体的半径或正方形物体的内切圆半径


int32_t damage; // 攻击伤害
double timeUntilSkillAvailable; // 技能冷却时间
int32_t damage; // 攻击伤害
std::vector<double> timeUntilSkillAvailable; // 技能冷却时间


PlayerType playerType; // 玩家类型 PlayerType playerType; // 玩家类型
std::vector<PropType> props; std::vector<PropType> props;
@@ -174,9 +169,7 @@ namespace THUAI6
{ {
StudentType studentType; StudentType studentType;
int32_t determination; // 剩余毅力(本次Emo之前还能承受的伤害) int32_t determination; // 剩余毅力(本次Emo之前还能承受的伤害)
int32_t failNum; // 挂科数量
double failTime; // 挂科时间
double emoTime; // EMO时间
int32_t addiction;


std::vector<StudentBuffType> buff; // buff std::vector<StudentBuffType> buff; // buff
}; };
@@ -223,7 +216,6 @@ namespace THUAI6


struct GameMap struct GameMap
{ {
std::vector<std::vector<PlaceType>> gameMap;
std::map<std::pair<int32_t, int32_t>, int32_t> classRoomState; std::map<std::pair<int32_t, int32_t>, int32_t> classRoomState;


std::map<std::pair<int32_t, int32_t>, int32_t> gateState; std::map<std::pair<int32_t, int32_t>, int32_t> gateState;
@@ -316,14 +308,11 @@ namespace THUAI6
{MessageOfObj::PropMessage, "PropMessage"}, {MessageOfObj::PropMessage, "PropMessage"},
{MessageOfObj::BulletMessage, "BulletMessage"}, {MessageOfObj::BulletMessage, "BulletMessage"},
{MessageOfObj::BombedBulletMessage, "BombedBulletMessage"}, {MessageOfObj::BombedBulletMessage, "BombedBulletMessage"},
};

inline std::map<MessageOfMapObj, std::string> messageOfMapObjDict{
{MessageOfMapObj::NullMessageOfMapObj, "NullMessageOfMapObj"},
{MessageOfMapObj::ClassroomMessage, "ClassroomMessage"},
{MessageOfMapObj::DoorMessage, "DoorMessage"},
{MessageOfMapObj::GateMessage, "GateMessage"},
{MessageOfMapObj::ChestMessage, "ChestMessage"},
{MessageOfObj::NullMessageOfObj, "NullMessageOfObj"},
{MessageOfObj::ClassroomMessage, "ClassroomMessage"},
{MessageOfObj::DoorMessage, "DoorMessage"},
{MessageOfObj::GateMessage, "GateMessage"},
{MessageOfObj::ChestMessage, "ChestMessage"},
}; };


} // namespace THUAI6 } // namespace THUAI6


+ 22
- 69
CAPI/cpp/API/include/utils.hpp View File

@@ -71,6 +71,7 @@ namespace Proto2THUAI6
{protobuf::PlaceType::HIDDEN_GATE, THUAI6::PlaceType::HiddenGate}, {protobuf::PlaceType::HIDDEN_GATE, THUAI6::PlaceType::HiddenGate},
{protobuf::PlaceType::WINDOW, THUAI6::PlaceType::Window}, {protobuf::PlaceType::WINDOW, THUAI6::PlaceType::Window},
{protobuf::PlaceType::DOOR, THUAI6::PlaceType::Door}, {protobuf::PlaceType::DOOR, THUAI6::PlaceType::Door},
{protobuf::PlaceType::CHEST, THUAI6::PlaceType::Chest},
}; };


inline std::map<protobuf::ShapeType, THUAI6::ShapeType> shapeTypeDict{ inline std::map<protobuf::ShapeType, THUAI6::ShapeType> shapeTypeDict{
@@ -156,19 +157,16 @@ namespace Proto2THUAI6
}; };


inline std::map<protobuf::MessageOfObj::MessageOfObjCase, THUAI6::MessageOfObj> messageOfObjDict{ inline std::map<protobuf::MessageOfObj::MessageOfObjCase, THUAI6::MessageOfObj> messageOfObjDict{
{protobuf::MessageOfObj::kStudentMessage, THUAI6::MessageOfObj::StudentMessage},
{protobuf::MessageOfObj::kTrickerMessage, THUAI6::MessageOfObj::TrickerMessage},
{protobuf::MessageOfObj::kPropMessage, THUAI6::MessageOfObj::PropMessage},
{protobuf::MessageOfObj::kBulletMessage, THUAI6::MessageOfObj::BulletMessage},
{protobuf::MessageOfObj::kBombedBulletMessage, THUAI6::MessageOfObj::BombedBulletMessage},
{protobuf::MessageOfObj::MESSAGE_OF_OBJ_NOT_SET, THUAI6::MessageOfObj::NullMessageOfObj},
};

inline std::map<protobuf::MessageOfMapObj::MessageOfMapObjCase, THUAI6::MessageOfMapObj> messageOfMapObjDict{
{protobuf::MessageOfMapObj::MessageOfMapObjCase::kClassroomMessage, THUAI6::MessageOfMapObj::ClassroomMessage},
{protobuf::MessageOfMapObj::MessageOfMapObjCase::kDoorMessage, THUAI6::MessageOfMapObj::DoorMessage},
{protobuf::MessageOfMapObj::MessageOfMapObjCase::kGateMessage, THUAI6::MessageOfMapObj::GateMessage},
{protobuf::MessageOfMapObj::MessageOfMapObjCase::kChestMessage, THUAI6::MessageOfMapObj::ChestMessage},
{protobuf::MessageOfObj::MessageOfObjCase::kStudentMessage, THUAI6::MessageOfObj::StudentMessage},
{protobuf::MessageOfObj::MessageOfObjCase::kTrickerMessage, THUAI6::MessageOfObj::TrickerMessage},
{protobuf::MessageOfObj::MessageOfObjCase::kPropMessage, THUAI6::MessageOfObj::PropMessage},
{protobuf::MessageOfObj::MessageOfObjCase::kBulletMessage, THUAI6::MessageOfObj::BulletMessage},
{protobuf::MessageOfObj::MessageOfObjCase::kBombedBulletMessage, THUAI6::MessageOfObj::BombedBulletMessage},
{protobuf::MessageOfObj::MessageOfObjCase::kClassroomMessage, THUAI6::MessageOfObj::ClassroomMessage},
{protobuf::MessageOfObj::MessageOfObjCase::kDoorMessage, THUAI6::MessageOfObj::DoorMessage},
{protobuf::MessageOfObj::MessageOfObjCase::kGateMessage, THUAI6::MessageOfObj::GateMessage},
{protobuf::MessageOfObj::MessageOfObjCase::kChestMessage, THUAI6::MessageOfObj::ChestMessage},
{protobuf::MessageOfObj::MessageOfObjCase::MESSAGE_OF_OBJ_NOT_SET, THUAI6::MessageOfObj::NullMessageOfObj},


}; };


@@ -180,13 +178,12 @@ namespace Proto2THUAI6
tricker->y = trickerMsg.y(); tricker->y = trickerMsg.y();
tricker->speed = trickerMsg.speed(); tricker->speed = trickerMsg.speed();
tricker->damage = trickerMsg.damage(); tricker->damage = trickerMsg.damage();
tricker->timeUntilSkillAvailable = trickerMsg.time_until_skill_available();
for (int i = 0; i < trickerMsg.time_until_skill_available().size(); i++)
tricker->timeUntilSkillAvailable.push_back(trickerMsg.time_until_skill_available(i));
tricker->place = placeTypeDict[trickerMsg.place()]; tricker->place = placeTypeDict[trickerMsg.place()];
tricker->playerState = playerStateDict[trickerMsg.player_state()]; tricker->playerState = playerStateDict[trickerMsg.player_state()];
for (int i = 0; i < trickerMsg.prop().size(); i++) for (int i = 0; i < trickerMsg.prop().size(); i++)
{
tricker->props.push_back(propTypeDict[trickerMsg.prop(i)]); tricker->props.push_back(propTypeDict[trickerMsg.prop(i)]);
}
tricker->trickerType = trickerTypeDict[trickerMsg.tricker_type()]; tricker->trickerType = trickerTypeDict[trickerMsg.tricker_type()];
tricker->guid = trickerMsg.guid(); tricker->guid = trickerMsg.guid();
tricker->playerID = trickerMsg.player_id(); tricker->playerID = trickerMsg.player_id();
@@ -194,9 +191,7 @@ namespace Proto2THUAI6
tricker->radius = trickerMsg.radius(); tricker->radius = trickerMsg.radius();
tricker->buff.clear(); tricker->buff.clear();
for (int i = 0; i < trickerMsg.buff().size(); i++) for (int i = 0; i < trickerMsg.buff().size(); i++)
{
tricker->buff.push_back(trickerBuffTypeDict[trickerMsg.buff(i)]); tricker->buff.push_back(trickerBuffTypeDict[trickerMsg.buff(i)]);
}
return tricker; return tricker;
} }


@@ -210,25 +205,20 @@ namespace Proto2THUAI6
student->playerID = studentMsg.player_id(); student->playerID = studentMsg.player_id();
student->guid = studentMsg.guid(); student->guid = studentMsg.guid();
student->radius = studentMsg.radius(); student->radius = studentMsg.radius();
student->timeUntilSkillAvailable = studentMsg.time_until_skill_available();
for (int i = 0; i < studentMsg.time_until_skill_available().size(); i++)
student->timeUntilSkillAvailable.push_back(studentMsg.time_until_skill_available(i));
student->damage = studentMsg.damage(); student->damage = studentMsg.damage();
student->playerType = THUAI6::PlayerType::StudentPlayer; student->playerType = THUAI6::PlayerType::StudentPlayer;
for (int i = 0; i < studentMsg.prop().size(); i++) for (int i = 0; i < studentMsg.prop().size(); i++)
{
student->props.push_back(propTypeDict[studentMsg.prop(i)]); student->props.push_back(propTypeDict[studentMsg.prop(i)]);
}
student->place = placeTypeDict[studentMsg.place()]; student->place = placeTypeDict[studentMsg.place()];
student->playerState = playerStateDict[studentMsg.state()]; student->playerState = playerStateDict[studentMsg.state()];
student->determination = studentMsg.determination(); student->determination = studentMsg.determination();
student->failNum = studentMsg.fail_num();
student->failTime = studentMsg.fail_time();
student->emoTime = studentMsg.emo_time();
student->addiction = studentMsg.addiction();
student->studentType = studentTypeDict[studentMsg.student_type()]; student->studentType = studentTypeDict[studentMsg.student_type()];
student->buff.clear(); student->buff.clear();
for (int i = 0; i < studentMsg.buff_size(); i++) for (int i = 0; i < studentMsg.buff_size(); i++)
{
student->buff.push_back(studentBuffTypeDict[studentMsg.buff(i)]); student->buff.push_back(studentBuffTypeDict[studentMsg.buff(i)]);
}
return student; return student;
} }


@@ -246,36 +236,6 @@ namespace Proto2THUAI6
return prop; return prop;
} }


inline std::shared_ptr<THUAI6::GameMap> Protobuf2THUAI6Map(const protobuf::MessageOfMap& mapMsg)
{
auto map = std::make_shared<THUAI6::GameMap>();
for (int i = 0; i < mapMsg.row_size(); i++)
{
std::vector<THUAI6::PlaceType> row;
for (int j = 0; j < mapMsg.row(i).col_size(); j++)
{
row.push_back(placeTypeDict[mapMsg.row(i).col(j)]);
}
map->gameMap.push_back(row);
}
for (const auto& item : mapMsg.map_obj_message())
switch (messageOfMapObjDict[item.message_of_map_obj_case()])
{
case THUAI6::MessageOfMapObj::ClassroomMessage:
map->classRoomState.emplace(std::make_pair(item.classroom_message().x(), item.classroom_message().y()), item.classroom_message().progress());
break;
case THUAI6::MessageOfMapObj::DoorMessage:
map->doorState.emplace(std::make_pair(item.door_message().x(), item.door_message().y()), item.door_message().is_open());
break;
case THUAI6::MessageOfMapObj::GateMessage:
map->gateState.emplace(std::make_pair(item.gate_message().x(), item.gate_message().y()), item.gate_message().progress());
break;
default:
break;
}
return map;
}

inline std::shared_ptr<THUAI6::GameInfo> Protobuf2THUAI6GameInfo(const protobuf::MessageOfAll& allMsg) inline std::shared_ptr<THUAI6::GameInfo> Protobuf2THUAI6GameInfo(const protobuf::MessageOfAll& allMsg)
{ {
auto gameInfo = std::make_shared<THUAI6::GameInfo>(); auto gameInfo = std::make_shared<THUAI6::GameInfo>();
@@ -403,59 +363,52 @@ namespace THUAI62Proto
return playerMsg; return playerMsg;
} }


inline protobuf::IDMsg THUAI62ProtobufID(int playerID, THUAI6::PlayerType playerType)
inline protobuf::IDMsg THUAI62ProtobufID(int playerID)
{ {
protobuf::IDMsg idMsg; protobuf::IDMsg idMsg;
idMsg.set_player_id(playerID); idMsg.set_player_id(playerID);
idMsg.set_player_type(playerTypeDict[playerType]);
return idMsg; return idMsg;
} }


inline protobuf::MoveMsg THUAI62ProtobufMove(int64_t time, double angle, int64_t id, THUAI6::PlayerType playerType)
inline protobuf::MoveMsg THUAI62ProtobufMove(int64_t time, double angle, int64_t id)
{ {
protobuf::MoveMsg moveMsg; protobuf::MoveMsg moveMsg;
moveMsg.set_time_in_milliseconds(time); moveMsg.set_time_in_milliseconds(time);
moveMsg.set_angle(angle); moveMsg.set_angle(angle);
moveMsg.set_player_id(id); moveMsg.set_player_id(id);
moveMsg.set_player_type(playerTypeDict[playerType]);
return moveMsg; return moveMsg;
} }


inline protobuf::PropMsg THUAI62ProtobufProp(THUAI6::PropType prop, int64_t id, THUAI6::PlayerType playerType)
inline protobuf::PropMsg THUAI62ProtobufProp(THUAI6::PropType prop, int64_t id)
{ {
protobuf::PropMsg pickMsg; protobuf::PropMsg pickMsg;
pickMsg.set_prop_type(propTypeDict[prop]); pickMsg.set_prop_type(propTypeDict[prop]);
pickMsg.set_player_id(id); pickMsg.set_player_id(id);
pickMsg.set_player_type(playerTypeDict[playerType]);
return pickMsg; return pickMsg;
} }


inline protobuf::SendMsg THUAI62ProtobufSend(std::string msg, int64_t toID, int64_t id, THUAI6::PlayerType playerType, THUAI6::PlayerType toType)
inline protobuf::SendMsg THUAI62ProtobufSend(std::string msg, int64_t toID, int64_t id)
{ {
protobuf::SendMsg sendMsg; protobuf::SendMsg sendMsg;
sendMsg.set_message(msg); sendMsg.set_message(msg);
sendMsg.set_to_player_id(toID); sendMsg.set_to_player_id(toID);
sendMsg.set_player_id(id); sendMsg.set_player_id(id);
sendMsg.set_player_type(playerTypeDict[playerType]);
sendMsg.set_to_player_type(playerTypeDict[toType]);
return sendMsg; return sendMsg;
} }


inline protobuf::AttackMsg THUAI62ProtobufAttack(double angle, int64_t id, THUAI6::PlayerType playerType)
inline protobuf::AttackMsg THUAI62ProtobufAttack(double angle, int64_t id)
{ {
protobuf::AttackMsg attackMsg; protobuf::AttackMsg attackMsg;
attackMsg.set_angle(angle); attackMsg.set_angle(angle);
attackMsg.set_player_id(id); attackMsg.set_player_id(id);
attackMsg.set_player_type(playerTypeDict[playerType]);
return attackMsg; return attackMsg;
} }


inline protobuf::SkillMsg THUAI62ProtobufSkill(int32_t skillID, int64_t id, THUAI6::PlayerType playerType)
inline protobuf::SkillMsg THUAI62ProtobufSkill(int32_t skillID, int64_t id)
{ {
protobuf::SkillMsg skillMsg; protobuf::SkillMsg skillMsg;
skillMsg.set_skill_id(skillID); skillMsg.set_skill_id(skillID);
skillMsg.set_player_id(id); skillMsg.set_player_id(id);
skillMsg.set_player_type(playerTypeDict[playerType]);
return skillMsg; return skillMsg;
} }
} // namespace THUAI62Proto } // namespace THUAI62Proto


+ 52
- 2
CAPI/cpp/API/src/API.cpp View File

@@ -279,12 +279,62 @@ std::vector<std::vector<THUAI6::PlaceType>> TrickerAPI::GetFullMap() const
return logic.GetFullMap(); return logic.GetFullMap();
} }


const std::vector<int64_t> StudentAPI::GetPlayerGUIDs() const
bool StudentAPI::IsDoorOpen(int32_t cellX, int32_t cellY) const
{
return logic.IsDoorOpen(cellX, cellY);
}

bool TrickerAPI::IsDoorOpen(int32_t cellX, int32_t cellY) const
{
return logic.IsDoorOpen(cellX, cellY);
}

int32_t StudentAPI::GetClassroomProgress(int32_t cellX, int32_t cellY) const
{
return logic.GetClassroomProgress(cellX, cellY);
}

int32_t TrickerAPI::GetClassroomProgress(int32_t cellX, int32_t cellY) const
{
return logic.GetClassroomProgress(cellX, cellY);
}

int32_t StudentAPI::GetChestProgress(int32_t cellX, int32_t cellY) const
{
return logic.GetChestProgress(cellX, cellY);
}

int32_t TrickerAPI::GetChestProgress(int32_t cellX, int32_t cellY) const
{
return logic.GetChestProgress(cellX, cellY);
}

int32_t StudentAPI::GetGateProgress(int32_t cellX, int32_t cellY) const
{
return logic.GetGateProgress(cellX, cellY);
}

int32_t TrickerAPI::GetGateProgress(int32_t cellX, int32_t cellY) const
{
return logic.GetGateProgress(cellX, cellY);
}

std::shared_ptr<const THUAI6::GameInfo> StudentAPI::GetGameInfo() const
{
return logic.GetGameInfo();
}

std::shared_ptr<const THUAI6::GameInfo> TrickerAPI::GetGameInfo() const
{
return logic.GetGameInfo();
}

std::vector<int64_t> StudentAPI::GetPlayerGUIDs() const
{ {
return logic.GetPlayerGUIDs(); return logic.GetPlayerGUIDs();
} }


const std::vector<int64_t> TrickerAPI::GetPlayerGUIDs() const
std::vector<int64_t> TrickerAPI::GetPlayerGUIDs() const
{ {
return logic.GetPlayerGUIDs(); return logic.GetPlayerGUIDs();
} }


+ 44
- 21
CAPI/cpp/API/src/Communication.cpp View File

@@ -18,7 +18,7 @@ bool Communication::Move(int64_t time, double angle, int64_t playerID)
{ {
protobuf::MoveRes moveResult; protobuf::MoveRes moveResult;
ClientContext context; ClientContext context;
auto request = THUAI62Proto::THUAI62ProtobufMove(time, angle, playerID, playerType);
auto request = THUAI62Proto::THUAI62ProtobufMove(time, angle, playerID);
std::cout << "Move request sent" << std::endl; std::cout << "Move request sent" << std::endl;
auto status = THUAI6Stub->Move(&context, request, &moveResult); auto status = THUAI6Stub->Move(&context, request, &moveResult);
if (status.ok()) if (status.ok())
@@ -31,7 +31,7 @@ bool Communication::PickProp(THUAI6::PropType prop, int64_t playerID)
{ {
protobuf::BoolRes pickPropResult; protobuf::BoolRes pickPropResult;
ClientContext context; ClientContext context;
auto request = THUAI62Proto::THUAI62ProtobufProp(prop, playerID, playerType);
auto request = THUAI62Proto::THUAI62ProtobufProp(prop, playerID);
auto status = THUAI6Stub->PickProp(&context, request, &pickPropResult); auto status = THUAI6Stub->PickProp(&context, request, &pickPropResult);
if (status.ok()) if (status.ok())
return pickPropResult.act_success(); return pickPropResult.act_success();
@@ -43,7 +43,7 @@ bool Communication::UseProp(THUAI6::PropType prop, int64_t playerID)
{ {
protobuf::BoolRes usePropResult; protobuf::BoolRes usePropResult;
ClientContext context; ClientContext context;
auto request = THUAI62Proto::THUAI62ProtobufProp(prop, playerID, playerType);
auto request = THUAI62Proto::THUAI62ProtobufProp(prop, playerID);
auto status = THUAI6Stub->UseProp(&context, request, &usePropResult); auto status = THUAI6Stub->UseProp(&context, request, &usePropResult);
if (status.ok()) if (status.ok())
return usePropResult.act_success(); return usePropResult.act_success();
@@ -55,7 +55,7 @@ bool Communication::UseSkill(int32_t skillID, int64_t playerID)
{ {
protobuf::BoolRes useSkillResult; protobuf::BoolRes useSkillResult;
ClientContext context; ClientContext context;
auto request = THUAI62Proto::THUAI62ProtobufSkill(skillID, playerID, playerType);
auto request = THUAI62Proto::THUAI62ProtobufSkill(skillID, playerID);
auto status = THUAI6Stub->UseSkill(&context, request, &useSkillResult); auto status = THUAI6Stub->UseSkill(&context, request, &useSkillResult);
if (status.ok()) if (status.ok())
return useSkillResult.act_success(); return useSkillResult.act_success();
@@ -67,7 +67,7 @@ bool Communication::SendMessage(int64_t toID, std::string message, int64_t playe
{ {
protobuf::BoolRes sendMessageResult; protobuf::BoolRes sendMessageResult;
ClientContext context; ClientContext context;
auto request = THUAI62Proto::THUAI62ProtobufSend(message, toID, playerID, playerType, playerType);
auto request = THUAI62Proto::THUAI62ProtobufSend(message, toID, playerID);
auto status = THUAI6Stub->SendMessage(&context, request, &sendMessageResult); auto status = THUAI6Stub->SendMessage(&context, request, &sendMessageResult);
if (status.ok()) if (status.ok())
return sendMessageResult.act_success(); return sendMessageResult.act_success();
@@ -79,7 +79,7 @@ bool Communication::OpenDoor(int64_t playerID)
{ {
protobuf::BoolRes openDoorResult; protobuf::BoolRes openDoorResult;
ClientContext context; ClientContext context;
auto request = THUAI62Proto::THUAI62ProtobufID(playerID, playerType);
auto request = THUAI62Proto::THUAI62ProtobufID(playerID);
auto status = THUAI6Stub->OpenDoor(&context, request, &openDoorResult); auto status = THUAI6Stub->OpenDoor(&context, request, &openDoorResult);
if (status.ok()) if (status.ok())
return openDoorResult.act_success(); return openDoorResult.act_success();
@@ -91,7 +91,7 @@ bool Communication::CloseDoor(int64_t playerID)
{ {
protobuf::BoolRes closeDoorResult; protobuf::BoolRes closeDoorResult;
ClientContext context; ClientContext context;
auto request = THUAI62Proto::THUAI62ProtobufID(playerID, playerType);
auto request = THUAI62Proto::THUAI62ProtobufID(playerID);
auto status = THUAI6Stub->CloseDoor(&context, request, &closeDoorResult); auto status = THUAI6Stub->CloseDoor(&context, request, &closeDoorResult);
if (status.ok()) if (status.ok())
return closeDoorResult.act_success(); return closeDoorResult.act_success();
@@ -103,7 +103,7 @@ bool Communication::SkipWindow(int64_t playerID)
{ {
protobuf::BoolRes skipWindowResult; protobuf::BoolRes skipWindowResult;
ClientContext context; ClientContext context;
auto request = THUAI62Proto::THUAI62ProtobufID(playerID, playerType);
auto request = THUAI62Proto::THUAI62ProtobufID(playerID);
auto status = THUAI6Stub->SkipWindow(&context, request, &skipWindowResult); auto status = THUAI6Stub->SkipWindow(&context, request, &skipWindowResult);
if (status.ok()) if (status.ok())
return skipWindowResult.act_success(); return skipWindowResult.act_success();
@@ -115,7 +115,7 @@ bool Communication::StartOpenGate(int64_t playerID)
{ {
protobuf::BoolRes startOpenGateResult; protobuf::BoolRes startOpenGateResult;
ClientContext context; ClientContext context;
auto request = THUAI62Proto::THUAI62ProtobufID(playerID, playerType);
auto request = THUAI62Proto::THUAI62ProtobufID(playerID);
auto status = THUAI6Stub->StartOpenGate(&context, request, &startOpenGateResult); auto status = THUAI6Stub->StartOpenGate(&context, request, &startOpenGateResult);
if (status.ok()) if (status.ok())
return startOpenGateResult.act_success(); return startOpenGateResult.act_success();
@@ -127,7 +127,7 @@ bool Communication::StartOpenChest(int64_t playerID)
{ {
protobuf::BoolRes startOpenChestResult; protobuf::BoolRes startOpenChestResult;
ClientContext context; ClientContext context;
auto request = THUAI62Proto::THUAI62ProtobufID(playerID, playerType);
auto request = THUAI62Proto::THUAI62ProtobufID(playerID);
auto status = THUAI6Stub->StartOpenChest(&context, request, &startOpenChestResult); auto status = THUAI6Stub->StartOpenChest(&context, request, &startOpenChestResult);
if (status.ok()) if (status.ok())
return startOpenChestResult.act_success(); return startOpenChestResult.act_success();
@@ -139,7 +139,7 @@ bool Communication::EndAllAction(int64_t playerID)
{ {
protobuf::BoolRes endAllActionResult; protobuf::BoolRes endAllActionResult;
ClientContext context; ClientContext context;
auto request = THUAI62Proto::THUAI62ProtobufID(playerID, playerType);
auto request = THUAI62Proto::THUAI62ProtobufID(playerID);
auto status = THUAI6Stub->EndAllAction(&context, request, &endAllActionResult); auto status = THUAI6Stub->EndAllAction(&context, request, &endAllActionResult);
if (status.ok()) if (status.ok())
return endAllActionResult.act_success(); return endAllActionResult.act_success();
@@ -151,7 +151,7 @@ bool Communication::Graduate(int64_t playerID)
{ {
protobuf::BoolRes graduateResult; protobuf::BoolRes graduateResult;
ClientContext context; ClientContext context;
auto request = THUAI62Proto::THUAI62ProtobufID(playerID, playerType);
auto request = THUAI62Proto::THUAI62ProtobufID(playerID);
auto status = THUAI6Stub->Graduate(&context, request, &graduateResult); auto status = THUAI6Stub->Graduate(&context, request, &graduateResult);
if (status.ok()) if (status.ok())
return graduateResult.act_success(); return graduateResult.act_success();
@@ -163,7 +163,7 @@ bool Communication::StartLearning(int64_t playerID)
{ {
protobuf::BoolRes startLearningResult; protobuf::BoolRes startLearningResult;
ClientContext context; ClientContext context;
auto request = THUAI62Proto::THUAI62ProtobufID(playerID, playerType);
auto request = THUAI62Proto::THUAI62ProtobufID(playerID);
auto status = THUAI6Stub->StartLearning(&context, request, &startLearningResult); auto status = THUAI6Stub->StartLearning(&context, request, &startLearningResult);
if (status.ok()) if (status.ok())
return startLearningResult.act_success(); return startLearningResult.act_success();
@@ -175,7 +175,7 @@ bool Communication::StartRescueMate(int64_t playerID)
{ {
protobuf::BoolRes saveStudentResult; protobuf::BoolRes saveStudentResult;
ClientContext context; ClientContext context;
auto request = THUAI62Proto::THUAI62ProtobufID(playerID, playerType);
auto request = THUAI62Proto::THUAI62ProtobufID(playerID);
auto status = THUAI6Stub->StartRescueMate(&context, request, &saveStudentResult); auto status = THUAI6Stub->StartRescueMate(&context, request, &saveStudentResult);
if (status.ok()) if (status.ok())
return saveStudentResult.act_success(); return saveStudentResult.act_success();
@@ -187,7 +187,7 @@ bool Communication::StartTreatMate(int64_t playerID)
{ {
protobuf::BoolRes healStudentResult; protobuf::BoolRes healStudentResult;
ClientContext context; ClientContext context;
auto request = THUAI62Proto::THUAI62ProtobufID(playerID, playerType);
auto request = THUAI62Proto::THUAI62ProtobufID(playerID);
auto status = THUAI6Stub->StartTreatMate(&context, request, &healStudentResult); auto status = THUAI6Stub->StartTreatMate(&context, request, &healStudentResult);
if (status.ok()) if (status.ok())
return healStudentResult.act_success(); return healStudentResult.act_success();
@@ -199,7 +199,7 @@ bool Communication::Attack(double angle, int64_t playerID)
{ {
protobuf::BoolRes attackResult; protobuf::BoolRes attackResult;
ClientContext context; ClientContext context;
auto request = THUAI62Proto::THUAI62ProtobufAttack(angle, playerID, playerType);
auto request = THUAI62Proto::THUAI62ProtobufAttack(angle, playerID);
auto status = THUAI6Stub->Attack(&context, request, &attackResult); auto status = THUAI6Stub->Attack(&context, request, &attackResult);
if (status.ok()) if (status.ok())
return attackResult.act_success(); return attackResult.act_success();
@@ -211,7 +211,7 @@ bool Communication::TryConnection(int64_t playerID)
{ {
protobuf::BoolRes reply; protobuf::BoolRes reply;
ClientContext context; ClientContext context;
auto request = THUAI62Proto::THUAI62ProtobufID(playerID, playerType);
auto request = THUAI62Proto::THUAI62ProtobufID(playerID);
auto status = THUAI6Stub->TryConnection(&context, request, &reply); auto status = THUAI6Stub->TryConnection(&context, request, &reply);
if (status.ok()) if (status.ok())
{ {
@@ -245,7 +245,7 @@ void Communication::ReadMessage(int64_t playerID)
{ {
auto tRead = [=]() auto tRead = [=]()
{ {
auto request = THUAI62Proto::THUAI62ProtobufID(playerID, playerType);
auto request = THUAI62Proto::THUAI62ProtobufID(playerID);
ClientContext context; ClientContext context;
protobuf::MsgRes messageReceived; protobuf::MsgRes messageReceived;
auto reader = THUAI6Stub->GetMessage(&context, request); auto reader = THUAI6Stub->GetMessage(&context, request);
@@ -257,12 +257,11 @@ void Communication::ReadMessage(int64_t playerID)
std::thread(tRead).detach(); std::thread(tRead).detach();
} }


void Communication::AddPlayer(int64_t playerID, THUAI6::PlayerType playerType_, THUAI6::StudentType studentType, THUAI6::TrickerType trickerType)
void Communication::AddPlayer(int64_t playerID, THUAI6::PlayerType playerType, THUAI6::StudentType studentType, THUAI6::TrickerType trickerType)
{ {
playerType = playerType_;
auto tMessage = [=]() auto tMessage = [=]()
{ {
protobuf::PlayerMsg playerMsg = THUAI62Proto::THUAI62ProtobufPlayer(playerID, playerType_, studentType, trickerType);
protobuf::PlayerMsg playerMsg = THUAI62Proto::THUAI62ProtobufPlayer(playerID, playerType, studentType, trickerType);
grpc::ClientContext context; grpc::ClientContext context;
auto MessageReader = THUAI6Stub->AddPlayer(&context, playerMsg); auto MessageReader = THUAI6Stub->AddPlayer(&context, playerMsg);


@@ -277,3 +276,27 @@ void Communication::AddPlayer(int64_t playerID, THUAI6::PlayerType playerType_,
}; };
std::thread(tMessage).detach(); std::thread(tMessage).detach();
} }

std::vector<std::vector<THUAI6::PlaceType>> Communication::GetMap(int64_t playerID)
{
protobuf::MessageOfMap mapResult;
ClientContext context;
auto request = THUAI62Proto::THUAI62ProtobufID(playerID);
auto status = THUAI6Stub->GetMap(&context, request, &mapResult);
if (status.ok())
{
std::vector<std::vector<THUAI6::PlaceType>> map;
for (int i = 0; i < mapResult.row_size(); i++)
{
std::vector<THUAI6::PlaceType> row;
for (int j = 0; j < mapResult.row(i).col_size(); j++)
{
row.push_back(Proto2THUAI6::placeTypeDict[mapResult.row(i).col(j)]);
}
map.push_back(std::move(row));
}
return map;
}
else
return {};
}

+ 100
- 26
CAPI/cpp/API/src/DebugAPI.cpp View File

@@ -410,12 +410,62 @@ std::vector<std::vector<THUAI6::PlaceType>> TrickerDebugAPI::GetFullMap() const
return logic.GetFullMap(); return logic.GetFullMap();
} }


const std::vector<int64_t> StudentDebugAPI::GetPlayerGUIDs() const
bool StudentDebugAPI::IsDoorOpen(int32_t cellX, int32_t cellY) const
{
return logic.IsDoorOpen(cellX, cellY);
}

bool TrickerDebugAPI::IsDoorOpen(int32_t cellX, int32_t cellY) const
{
return logic.IsDoorOpen(cellX, cellY);
}

int32_t StudentDebugAPI::GetClassroomProgress(int32_t cellX, int32_t cellY) const
{
return logic.GetClassroomProgress(cellX, cellY);
}

int32_t TrickerDebugAPI::GetClassroomProgress(int32_t cellX, int32_t cellY) const
{
return logic.GetClassroomProgress(cellX, cellY);
}

int32_t StudentDebugAPI::GetChestProgress(int32_t cellX, int32_t cellY) const
{
return logic.GetChestProgress(cellX, cellY);
}

int32_t TrickerDebugAPI::GetChestProgress(int32_t cellX, int32_t cellY) const
{
return logic.GetChestProgress(cellX, cellY);
}

int32_t StudentDebugAPI::GetGateProgress(int32_t cellX, int32_t cellY) const
{
return logic.GetGateProgress(cellX, cellY);
}

int32_t TrickerDebugAPI::GetGateProgress(int32_t cellX, int32_t cellY) const
{
return logic.GetGateProgress(cellX, cellY);
}

std::shared_ptr<const THUAI6::GameInfo> StudentDebugAPI::GetGameInfo() const
{
return logic.GetGameInfo();
}

std::shared_ptr<const THUAI6::GameInfo> TrickerDebugAPI::GetGameInfo() const
{
return logic.GetGameInfo();
}

std::vector<int64_t> StudentDebugAPI::GetPlayerGUIDs() const
{ {
return logic.GetPlayerGUIDs(); return logic.GetPlayerGUIDs();
} }


const std::vector<int64_t> TrickerDebugAPI::GetPlayerGUIDs() const
std::vector<int64_t> TrickerDebugAPI::GetPlayerGUIDs() const
{ {
return logic.GetPlayerGUIDs(); return logic.GetPlayerGUIDs();
} }
@@ -492,17 +542,21 @@ std::shared_ptr<const THUAI6::Tricker> TrickerDebugAPI::GetSelfInfo() const


void StudentDebugAPI::PrintStudent() const void StudentDebugAPI::PrintStudent() const
{ {
for (auto student : logic.GetStudents())
for (const auto& student : logic.GetStudents())
{ {
logger->info("******Student Info******"); logger->info("******Student Info******");
logger->info("playerID={}, GUID={}, x={}, y={}", student->playerID, student->guid, student->x, student->y); logger->info("playerID={}, GUID={}, x={}, y={}", student->playerID, student->guid, student->x, student->y);
logger->info("speed={}, view range={}, damage={}, skill time={}, place={}", student->speed, student->viewRange, student->damage, student->timeUntilSkillAvailable, THUAI6::placeTypeDict[student->place]);
logger->info("state={}, determination={}, fail num={}, fail time={}, emo time={}", THUAI6::playerStateDict[student->playerState], student->determination, student->failNum, student->failTime, student->emoTime);
logger->info("speed={}, view range={}, damage={}, place={}", student->speed, student->viewRange, student->damage, THUAI6::placeTypeDict[student->place]);
logger->info("state={}, determination={}, addiction={}", THUAI6::playerStateDict[student->playerState], student->determination, student->addiction);
std::string skillTime = "skill time=";
for (const auto& time : student->timeUntilSkillAvailable)
skillTime += std::to_string(time) + ", ";
logger->info(skillTime);
std::string studentBuff = "buff="; std::string studentBuff = "buff=";
std::string studentProp = "prop="; std::string studentProp = "prop=";
for (auto buff : student->buff)
for (const auto& buff : student->buff)
studentBuff += THUAI6::studentBuffDict[buff] + ", "; studentBuff += THUAI6::studentBuffDict[buff] + ", ";
for (auto prop : student->props)
for (const auto& prop : student->props)
studentProp += THUAI6::propTypeDict[prop] + ", "; studentProp += THUAI6::propTypeDict[prop] + ", ";
logger->info(studentBuff); logger->info(studentBuff);
logger->info(studentProp); logger->info(studentProp);
@@ -512,17 +566,21 @@ void StudentDebugAPI::PrintStudent() const


void TrickerDebugAPI::PrintStudent() const void TrickerDebugAPI::PrintStudent() const
{ {
for (auto student : logic.GetStudents())
for (const auto& student : logic.GetStudents())
{ {
logger->info("******Student Info******"); logger->info("******Student Info******");
logger->info("playerID={}, GUID={}, x={}, y={}", student->playerID, student->guid, student->x, student->y); logger->info("playerID={}, GUID={}, x={}, y={}", student->playerID, student->guid, student->x, student->y);
logger->info("speed={}, view range={}, damage={}, skill time={}, place={}", student->speed, student->viewRange, student->damage, student->timeUntilSkillAvailable, THUAI6::placeTypeDict[student->place]);
logger->info("state={}, determination={}, fail num={}, fail time={}, emo time={}", THUAI6::playerStateDict[student->playerState], student->determination, student->failNum, student->failTime, student->emoTime);
logger->info("speed={}, view range={}, damage={}, place={}", student->speed, student->viewRange, student->damage, THUAI6::placeTypeDict[student->place]);
logger->info("state={}, determination={}, addiction={}", THUAI6::playerStateDict[student->playerState], student->determination, student->addiction);
std::string skillTime = "skill time=";
for (const auto& time : student->timeUntilSkillAvailable)
skillTime += std::to_string(time) + ", ";
logger->info(skillTime);
std::string studentBuff = "buff="; std::string studentBuff = "buff=";
std::string studentProp = "prop="; std::string studentProp = "prop=";
for (auto buff : student->buff)
for (const auto& buff : student->buff)
studentBuff += THUAI6::studentBuffDict[buff] + ", "; studentBuff += THUAI6::studentBuffDict[buff] + ", ";
for (auto prop : student->props)
for (const auto& prop : student->props)
studentProp += THUAI6::propTypeDict[prop] + ", "; studentProp += THUAI6::propTypeDict[prop] + ", ";
logger->info(studentBuff); logger->info(studentBuff);
logger->info(studentProp); logger->info(studentProp);
@@ -532,18 +590,22 @@ void TrickerDebugAPI::PrintStudent() const


void StudentDebugAPI::PrintTricker() const void StudentDebugAPI::PrintTricker() const
{ {
for (auto tricker : logic.GetTrickers())
for (const auto& tricker : logic.GetTrickers())
{ {
logger->info("******Tricker Info******"); logger->info("******Tricker Info******");
logger->info("playerID={}, GUID={}, x={}, y={}", tricker->playerID, tricker->guid, tricker->x, tricker->y); logger->info("playerID={}, GUID={}, x={}, y={}", tricker->playerID, tricker->guid, tricker->x, tricker->y);
logger->info("speed={}, view range={}, skill time={}, place={}", tricker->speed, tricker->viewRange, tricker->timeUntilSkillAvailable, THUAI6::placeTypeDict[tricker->place]);
logger->info("speed={}, view range={}, place={}", tricker->speed, tricker->viewRange, THUAI6::placeTypeDict[tricker->place]);
logger->info("damage={}, state={}", tricker->damage, THUAI6::playerStateDict[tricker->playerState]); logger->info("damage={}, state={}", tricker->damage, THUAI6::playerStateDict[tricker->playerState]);
std::string skillTime = "skill time=";
for (const auto& time : tricker->timeUntilSkillAvailable)
skillTime += std::to_string(time) + ", ";
logger->info(skillTime);
std::string trickerBuff = "buff="; std::string trickerBuff = "buff=";
for (auto buff : tricker->buff)
for (const auto& buff : tricker->buff)
trickerBuff += THUAI6::trickerBuffDict[buff] + ", "; trickerBuff += THUAI6::trickerBuffDict[buff] + ", ";
logger->info(trickerBuff); logger->info(trickerBuff);
std::string trickerProp = "prop="; std::string trickerProp = "prop=";
for (auto prop : tricker->props)
for (const auto& prop : tricker->props)
trickerProp += THUAI6::propTypeDict[prop] + ", "; trickerProp += THUAI6::propTypeDict[prop] + ", ";
logger->info(trickerProp); logger->info(trickerProp);
logger->info("************************"); logger->info("************************");
@@ -556,14 +618,18 @@ void TrickerDebugAPI::PrintTricker() const
{ {
logger->info("******Tricker Info******"); logger->info("******Tricker Info******");
logger->info("playerID={}, GUID={}, x={}, y={}", tricker->playerID, tricker->guid, tricker->x, tricker->y); logger->info("playerID={}, GUID={}, x={}, y={}", tricker->playerID, tricker->guid, tricker->x, tricker->y);
logger->info("speed={}, view range={}, skill time={}, place={}", tricker->speed, tricker->viewRange, tricker->timeUntilSkillAvailable, THUAI6::placeTypeDict[tricker->place]);
logger->info("speed={}, view range={}, place={}", tricker->speed, tricker->viewRange, THUAI6::placeTypeDict[tricker->place]);
logger->info("damage={}, state={}", tricker->damage, THUAI6::playerStateDict[tricker->playerState]); logger->info("damage={}, state={}", tricker->damage, THUAI6::playerStateDict[tricker->playerState]);
std::string skillTime = "skill time=";
for (const auto& time : tricker->timeUntilSkillAvailable)
skillTime += std::to_string(time) + ", ";
logger->info(skillTime);
std::string trickerBuff = "buff="; std::string trickerBuff = "buff=";
for (auto buff : tricker->buff)
for (const auto& buff : tricker->buff)
trickerBuff += THUAI6::trickerBuffDict[buff] + ", "; trickerBuff += THUAI6::trickerBuffDict[buff] + ", ";
logger->info(trickerBuff); logger->info(trickerBuff);
std::string trickerProp = "prop="; std::string trickerProp = "prop=";
for (auto prop : tricker->props)
for (const auto& prop : tricker->props)
trickerProp += THUAI6::propTypeDict[prop] + ", "; trickerProp += THUAI6::propTypeDict[prop] + ", ";
logger->info(trickerProp); logger->info(trickerProp);
logger->info("************************"); logger->info("************************");
@@ -595,14 +661,18 @@ void StudentDebugAPI::PrintSelfInfo() const
auto self = logic.StudentGetSelfInfo(); auto self = logic.StudentGetSelfInfo();
logger->info("******Self Info******"); logger->info("******Self Info******");
logger->info("playerID={}, GUID={}, x={}, y={}", self->playerID, self->guid, self->x, self->y); logger->info("playerID={}, GUID={}, x={}, y={}", self->playerID, self->guid, self->x, self->y);
logger->info("speed={}, view range={}, damage={}, skill time={}, place={}", self->speed, self->viewRange, self->damage, self->timeUntilSkillAvailable, THUAI6::placeTypeDict[self->place]);
logger->info("state={}, determination={}, fail num={}, fail time={}, emo time={}", THUAI6::playerStateDict[self->playerState], self->determination, self->failNum, self->failTime, self->emoTime);
logger->info("speed={}, view range={}, damage={}, place={}", self->speed, self->viewRange, self->damage, THUAI6::placeTypeDict[self->place]);
logger->info("state={}, determination={}, addiction", THUAI6::playerStateDict[self->playerState], self->determination, self->addiction);
std::string skillTime = "skill time=";
for (const auto& time : self->timeUntilSkillAvailable)
skillTime += std::to_string(time) + ", ";
logger->info(skillTime);
std::string studentBuff = "buff="; std::string studentBuff = "buff=";
for (auto buff : self->buff)
for (const auto& buff : self->buff)
studentBuff += THUAI6::studentBuffDict[buff] + ", "; studentBuff += THUAI6::studentBuffDict[buff] + ", ";
logger->info(studentBuff); logger->info(studentBuff);
std::string studentProp = "prop="; std::string studentProp = "prop=";
for (auto prop : self->props)
for (const auto& prop : self->props)
studentProp += THUAI6::propTypeDict[prop] + ", "; studentProp += THUAI6::propTypeDict[prop] + ", ";
logger->info(studentProp); logger->info(studentProp);
logger->info("*********************"); logger->info("*********************");
@@ -613,14 +683,18 @@ void TrickerDebugAPI::PrintSelfInfo() const
auto self = logic.TrickerGetSelfInfo(); auto self = logic.TrickerGetSelfInfo();
logger->info("******Self Info******"); logger->info("******Self Info******");
logger->info("playerID={}, GUID={}, x={}, y={}", self->playerID, self->guid, self->x, self->y); logger->info("playerID={}, GUID={}, x={}, y={}", self->playerID, self->guid, self->x, self->y);
logger->info("speed={}, view range={}, skill time={}, place={}", self->speed, self->viewRange, self->timeUntilSkillAvailable, THUAI6::placeTypeDict[self->place]);
logger->info("speed={}, view range={}, place={}", self->speed, self->viewRange, THUAI6::placeTypeDict[self->place]);
logger->info("damage={}, state={}", self->damage, THUAI6::playerStateDict[self->playerState]); logger->info("damage={}, state={}", self->damage, THUAI6::playerStateDict[self->playerState]);
std::string skillTime = "skill time=";
for (const auto& time : self->timeUntilSkillAvailable)
skillTime += std::to_string(time) + ", ";
logger->info(skillTime);
std::string trickerBuff = "buff="; std::string trickerBuff = "buff=";
for (auto buff : self->buff)
for (const auto& buff : self->buff)
trickerBuff += THUAI6::trickerBuffDict[buff] + ", "; trickerBuff += THUAI6::trickerBuffDict[buff] + ", ";
logger->info(trickerBuff); logger->info(trickerBuff);
std::string trickerProp = "prop="; std::string trickerProp = "prop=";
for (auto prop : self->props)
for (const auto& prop : self->props)
trickerProp += THUAI6::propTypeDict[prop] + ", "; trickerProp += THUAI6::propTypeDict[prop] + ", ";
logger->info(trickerProp); logger->info(trickerProp);
logger->info("*********************"); logger->info("*********************");


+ 122
- 8
CAPI/cpp/API/src/logic.cpp View File

@@ -65,14 +65,65 @@ std::vector<std::vector<THUAI6::PlaceType>> Logic::GetFullMap() const
{ {
std::unique_lock<std::mutex> lock(mtxState); std::unique_lock<std::mutex> lock(mtxState);
logger->debug("Called GetFullMap"); logger->debug("Called GetFullMap");
return currentState->gameMap->gameMap;
return currentState->gameMap;
} }


THUAI6::PlaceType Logic::GetPlaceType(int32_t CellX, int32_t CellY) const
THUAI6::PlaceType Logic::GetPlaceType(int32_t cellX, int32_t cellY) const
{ {
std::unique_lock<std::mutex> lock(mtxState); std::unique_lock<std::mutex> lock(mtxState);
logger->debug("Called GetPlaceType"); logger->debug("Called GetPlaceType");
return currentState->gameMap->gameMap[CellX][CellY];
return currentState->gameMap[cellX][cellY];
}

bool Logic::IsDoorOpen(int32_t cellX, int32_t cellY) const
{
std::unique_lock<std::mutex> lock(mtxState);
logger->debug("Called IsDoorOpen");
auto pos = std::make_pair(cellX, cellY);
if (currentState->mapInfo->doorState.count(pos) == 0)
return false;
else
return currentState->mapInfo->doorState[pos];
}

int32_t Logic::GetClassroomProgress(int32_t cellX, int32_t cellY) const
{
std::unique_lock<std::mutex> lock(mtxState);
logger->debug("Called GetClassroomProgress");
auto pos = std::make_pair(cellX, cellY);
if (currentState->mapInfo->classRoomState.count(pos) == 0)
return 0;
else
return currentState->mapInfo->classRoomState[pos];
}

int32_t Logic::GetChestProgress(int32_t cellX, int32_t cellY) const
{
std::unique_lock<std::mutex> lock(mtxState);
logger->debug("Called GetChestProgress");
auto pos = std::make_pair(cellX, cellY);
if (currentState->mapInfo->chestState.count(pos) == 0)
return 0;
else
return currentState->mapInfo->chestState[pos];
}

int32_t Logic::GetGateProgress(int32_t cellX, int32_t cellY) const
{
std::unique_lock<std::mutex> lock(mtxState);
logger->debug("Called GetGateProgress");
auto pos = std::make_pair(cellX, cellY);
if (currentState->mapInfo->gateState.count(pos) == 0)
return 0;
else
return currentState->mapInfo->gateState[pos];
}

std::shared_ptr<const THUAI6::GameInfo> Logic::GetGameInfo() const
{
std::unique_lock<std::mutex> lock(mtxState);
logger->debug("Called GetGameInfo");
return currentState->gameInfo;
} }


bool Logic::Move(int64_t time, double angle) bool Logic::Move(int64_t time, double angle)
@@ -195,7 +246,8 @@ void Logic::ProcessMessage()
{ {
logger->info("Message thread start!"); logger->info("Message thread start!");
pComm->AddPlayer(playerID, playerType, studentType, trickerType); pComm->AddPlayer(playerID, playerType, studentType, trickerType);
logger->info("Join the player!");
currentState->gameMap = pComm->GetMap(playerID);
bufferState->gameMap = currentState->gameMap;
pComm->ReadMessage(playerID); pComm->ReadMessage(playerID);
while (gameState != THUAI6::GameState::GameEnd) while (gameState != THUAI6::GameState::GameEnd)
{ {
@@ -268,7 +320,6 @@ void Logic::LoadBuffer(protobuf::MessageToClient& message)


logger->debug("Buffer cleared!"); logger->debug("Buffer cleared!");
// 读取新的信息 // 读取新的信息
bufferState->gameMap = Proto2THUAI6::Protobuf2THUAI6Map(message.map_message());
bufferState->gameInfo = Proto2THUAI6::Protobuf2THUAI6GameInfo(message.all_message()); bufferState->gameInfo = Proto2THUAI6::Protobuf2THUAI6GameInfo(message.all_message());
if (playerType == THUAI6::PlayerType::StudentPlayer) if (playerType == THUAI6::PlayerType::StudentPlayer)
{ {
@@ -284,7 +335,7 @@ void Logic::LoadBuffer(protobuf::MessageToClient& message)
} }
for (const auto& item : message.obj_message()) for (const auto& item : message.obj_message())
if (Proto2THUAI6::messageOfObjDict[item.message_of_obj_case()] == THUAI6::MessageOfObj::TrickerMessage) if (Proto2THUAI6::messageOfObjDict[item.message_of_obj_case()] == THUAI6::MessageOfObj::TrickerMessage)
if (AssistFunction::HaveView(bufferState->studentSelf->viewRange, bufferState->studentSelf->x, bufferState->studentSelf->y, item.tricker_message().x(), item.tricker_message().y(), bufferState->studentSelf->place, Proto2THUAI6::placeTypeDict[item.tricker_message().place()], bufferState->gameMap->gameMap))
if (AssistFunction::HaveView(bufferState->studentSelf->viewRange, bufferState->studentSelf->x, bufferState->studentSelf->y, item.tricker_message().x(), item.tricker_message().y(), bufferState->studentSelf->place, Proto2THUAI6::placeTypeDict[item.tricker_message().place()], bufferState->gameMap))
{ {
bufferState->trickers.push_back(Proto2THUAI6::Protobuf2THUAI6Tricker(item.tricker_message())); bufferState->trickers.push_back(Proto2THUAI6::Protobuf2THUAI6Tricker(item.tricker_message()));
logger->debug("Add Tricker!"); logger->debug("Add Tricker!");
@@ -306,7 +357,7 @@ void Logic::LoadBuffer(protobuf::MessageToClient& message)
} }
for (const auto& item : message.obj_message()) for (const auto& item : message.obj_message())
if (Proto2THUAI6::messageOfObjDict[item.message_of_obj_case()] == THUAI6::MessageOfObj::StudentMessage) if (Proto2THUAI6::messageOfObjDict[item.message_of_obj_case()] == THUAI6::MessageOfObj::StudentMessage)
if (AssistFunction::HaveView(bufferState->trickerSelf->viewRange, bufferState->trickerSelf->x, bufferState->trickerSelf->y, item.student_message().x(), item.student_message().y(), bufferState->trickerSelf->place, Proto2THUAI6::placeTypeDict[item.student_message().place()], bufferState->gameMap->gameMap))
if (AssistFunction::HaveView(bufferState->trickerSelf->viewRange, bufferState->trickerSelf->x, bufferState->trickerSelf->y, item.student_message().x(), item.student_message().y(), bufferState->trickerSelf->place, Proto2THUAI6::placeTypeDict[item.student_message().place()], bufferState->gameMap))
{ {
bufferState->students.push_back(Proto2THUAI6::Protobuf2THUAI6Student(item.student_message())); bufferState->students.push_back(Proto2THUAI6::Protobuf2THUAI6Student(item.student_message()));
logger->debug("Add Student!"); logger->debug("Add Student!");
@@ -327,6 +378,69 @@ void Logic::LoadBuffer(protobuf::MessageToClient& message)
bufferState->bombedBullets.push_back(Proto2THUAI6::Protobuf2THUAI6BombedBullet(item.bombed_bullet_message())); bufferState->bombedBullets.push_back(Proto2THUAI6::Protobuf2THUAI6BombedBullet(item.bombed_bullet_message()));
logger->debug("Add BombedBullet!"); logger->debug("Add BombedBullet!");
break; break;
case THUAI6::MessageOfObj::ClassroomMessage:
{
auto pos = std::make_pair(item.classroom_message().x(), item.classroom_message().y());
if (bufferState->mapInfo->classRoomState.count(pos) == 0)
{
bufferState->mapInfo->classRoomState.emplace(pos, item.classroom_message().progress());
logger->debug("Add Classroom!");
}
else
{
bufferState->mapInfo->classRoomState[pos] = item.classroom_message().progress();
logger->debug("Update Classroom!");
}
break;
}
case THUAI6::MessageOfObj::ChestMessage:
{
auto pos = std::make_pair(item.chest_message().x(), item.chest_message().y());
if (bufferState->mapInfo->chestState.count(pos) == 0)
{
bufferState->mapInfo->chestState.emplace(pos, item.chest_message().progress());
logger->debug("Add Chest!");
}
else
{
bufferState->mapInfo->chestState[pos] = item.chest_message().progress();
logger->debug("Update Chest!");
}
break;
}
case THUAI6::MessageOfObj::DoorMessage:
{
auto pos = std::make_pair(item.door_message().x(), item.door_message().y());
if (bufferState->mapInfo->doorState.count(pos) == 0)
{
bufferState->mapInfo->doorState.emplace(pos, item.door_message().is_open());
logger->debug("Add Door!");
}
else
{
bufferState->mapInfo->doorState[pos] = item.door_message().is_open();
logger->debug("Update Door!");
}
break;
}
case THUAI6::MessageOfObj::GateMessage:
{
auto pos = std::make_pair(item.gate_message().x(), item.gate_message().y());
if (bufferState->mapInfo->gateState.count(pos) == 0)
{
bufferState->mapInfo->gateState.emplace(pos, item.gate_message().progress());
logger->debug("Add Gate!");
}
else
{
bufferState->mapInfo->gateState[pos] = item.gate_message().progress();
logger->debug("Update Gate!");
}
break;
}
case THUAI6::MessageOfObj::NullMessageOfObj:
default:
break;
} }
if (asynchronous) if (asynchronous)
{ {
@@ -387,7 +501,7 @@ int Logic::GetCounter() const
return counterState; return counterState;
} }


const std::vector<int64_t> Logic::GetPlayerGUIDs() const
std::vector<int64_t> Logic::GetPlayerGUIDs() const
{ {
std::unique_lock<std::mutex> lock(mtxState); std::unique_lock<std::mutex> lock(mtxState);
return currentState->guids; return currentState->guids;


+ 547
- 986
CAPI/cpp/proto/Message2Clients.pb.cc
File diff suppressed because it is too large
View File


+ 878
- 1280
CAPI/cpp/proto/Message2Clients.pb.h
File diff suppressed because it is too large
View File


+ 102
- 338
CAPI/cpp/proto/Message2Server.pb.cc
File diff suppressed because it is too large
View File


+ 55
- 307
CAPI/cpp/proto/Message2Server.pb.h View File

@@ -153,8 +153,8 @@ namespace protobuf
} }
enum JobTypeCase enum JobTypeCase
{ {
kStudentType = 3,
kTrickerType = 4,
kStudentType = 2,
kTrickerType = 3,
JOB_TYPE_NOT_SET = 0, JOB_TYPE_NOT_SET = 0,
}; };


@@ -258,9 +258,9 @@ namespace protobuf
enum : int enum : int
{ {
kPlayerIdFieldNumber = 1, kPlayerIdFieldNumber = 1,
kPlayerTypeFieldNumber = 2,
kStudentTypeFieldNumber = 3,
kTrickerTypeFieldNumber = 4,
kPlayerTypeFieldNumber = 4,
kStudentTypeFieldNumber = 2,
kTrickerTypeFieldNumber = 3,
}; };
// int64 player_id = 1; // int64 player_id = 1;
void clear_player_id(); void clear_player_id();
@@ -272,7 +272,7 @@ namespace protobuf
void _internal_set_player_id(int64_t value); void _internal_set_player_id(int64_t value);


public: public:
// .protobuf.PlayerType player_type = 2;
// .protobuf.PlayerType player_type = 4;
void clear_player_type(); void clear_player_type();
::protobuf::PlayerType player_type() const; ::protobuf::PlayerType player_type() const;
void set_player_type(::protobuf::PlayerType value); void set_player_type(::protobuf::PlayerType value);
@@ -282,7 +282,7 @@ namespace protobuf
void _internal_set_player_type(::protobuf::PlayerType value); void _internal_set_player_type(::protobuf::PlayerType value);


public: public:
// .protobuf.StudentType student_type = 3;
// .protobuf.StudentType student_type = 2;
bool has_student_type() const; bool has_student_type() const;


private: private:
@@ -298,7 +298,7 @@ namespace protobuf
void _internal_set_student_type(::protobuf::StudentType value); void _internal_set_student_type(::protobuf::StudentType value);


public: public:
// .protobuf.TrickerType tricker_type = 4;
// .protobuf.TrickerType tricker_type = 3;
bool has_tricker_type() const; bool has_tricker_type() const;


private: private:
@@ -514,9 +514,8 @@ namespace protobuf
enum : int enum : int
{ {
kPlayerIdFieldNumber = 1, kPlayerIdFieldNumber = 1,
kAngleFieldNumber = 3,
kTimeInMillisecondsFieldNumber = 4,
kPlayerTypeFieldNumber = 2,
kAngleFieldNumber = 2,
kTimeInMillisecondsFieldNumber = 3,
}; };
// int64 player_id = 1; // int64 player_id = 1;
void clear_player_id(); void clear_player_id();
@@ -528,7 +527,7 @@ namespace protobuf
void _internal_set_player_id(int64_t value); void _internal_set_player_id(int64_t value);


public: public:
// double angle = 3;
// double angle = 2;
void clear_angle(); void clear_angle();
double angle() const; double angle() const;
void set_angle(double value); void set_angle(double value);
@@ -538,7 +537,7 @@ namespace protobuf
void _internal_set_angle(double value); void _internal_set_angle(double value);


public: public:
// int64 time_in_milliseconds = 4;
// int64 time_in_milliseconds = 3;
void clear_time_in_milliseconds(); void clear_time_in_milliseconds();
int64_t time_in_milliseconds() const; int64_t time_in_milliseconds() const;
void set_time_in_milliseconds(int64_t value); void set_time_in_milliseconds(int64_t value);
@@ -547,16 +546,6 @@ namespace protobuf
int64_t _internal_time_in_milliseconds() const; int64_t _internal_time_in_milliseconds() const;
void _internal_set_time_in_milliseconds(int64_t value); void _internal_set_time_in_milliseconds(int64_t value);


public:
// .protobuf.PlayerType player_type = 2;
void clear_player_type();
::protobuf::PlayerType player_type() const;
void set_player_type(::protobuf::PlayerType value);

private:
::protobuf::PlayerType _internal_player_type() const;
void _internal_set_player_type(::protobuf::PlayerType value);

public: public:
// @@protoc_insertion_point(class_scope:protobuf.MoveMsg) // @@protoc_insertion_point(class_scope:protobuf.MoveMsg)


@@ -572,7 +561,6 @@ namespace protobuf
int64_t player_id_; int64_t player_id_;
double angle_; double angle_;
int64_t time_in_milliseconds_; int64_t time_in_milliseconds_;
int player_type_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
}; };
union union
@@ -742,8 +730,7 @@ namespace protobuf
enum : int enum : int
{ {
kPlayerIdFieldNumber = 1, kPlayerIdFieldNumber = 1,
kPlayerTypeFieldNumber = 2,
kPropTypeFieldNumber = 3,
kPropTypeFieldNumber = 2,
}; };
// int64 player_id = 1; // int64 player_id = 1;
void clear_player_id(); void clear_player_id();
@@ -755,17 +742,7 @@ namespace protobuf
void _internal_set_player_id(int64_t value); void _internal_set_player_id(int64_t value);


public: public:
// .protobuf.PlayerType player_type = 2;
void clear_player_type();
::protobuf::PlayerType player_type() const;
void set_player_type(::protobuf::PlayerType value);

private:
::protobuf::PlayerType _internal_player_type() const;
void _internal_set_player_type(::protobuf::PlayerType value);

public:
// .protobuf.PropType prop_type = 3;
// .protobuf.PropType prop_type = 2;
void clear_prop_type(); void clear_prop_type();
::protobuf::PropType prop_type() const; ::protobuf::PropType prop_type() const;
void set_prop_type(::protobuf::PropType value); void set_prop_type(::protobuf::PropType value);
@@ -787,7 +764,6 @@ namespace protobuf
struct Impl_ struct Impl_
{ {
int64_t player_id_; int64_t player_id_;
int player_type_;
int prop_type_; int prop_type_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
}; };
@@ -957,13 +933,11 @@ namespace protobuf


enum : int enum : int
{ {
kMessageFieldNumber = 5,
kMessageFieldNumber = 3,
kPlayerIdFieldNumber = 1, kPlayerIdFieldNumber = 1,
kToPlayerIdFieldNumber = 3,
kPlayerTypeFieldNumber = 2,
kToPlayerTypeFieldNumber = 4,
kToPlayerIdFieldNumber = 2,
}; };
// string message = 5;
// string message = 3;
void clear_message(); void clear_message();
const std::string& message() const; const std::string& message() const;
template<typename ArgT0 = const std::string&, typename... ArgT> template<typename ArgT0 = const std::string&, typename... ArgT>
@@ -988,7 +962,7 @@ namespace protobuf
void _internal_set_player_id(int64_t value); void _internal_set_player_id(int64_t value);


public: public:
// int64 to_player_id = 3;
// int64 to_player_id = 2;
void clear_to_player_id(); void clear_to_player_id();
int64_t to_player_id() const; int64_t to_player_id() const;
void set_to_player_id(int64_t value); void set_to_player_id(int64_t value);
@@ -997,26 +971,6 @@ namespace protobuf
int64_t _internal_to_player_id() const; int64_t _internal_to_player_id() const;
void _internal_set_to_player_id(int64_t value); void _internal_set_to_player_id(int64_t value);


public:
// .protobuf.PlayerType player_type = 2;
void clear_player_type();
::protobuf::PlayerType player_type() const;
void set_player_type(::protobuf::PlayerType value);

private:
::protobuf::PlayerType _internal_player_type() const;
void _internal_set_player_type(::protobuf::PlayerType value);

public:
// .protobuf.PlayerType to_player_type = 4;
void clear_to_player_type();
::protobuf::PlayerType to_player_type() const;
void set_to_player_type(::protobuf::PlayerType value);

private:
::protobuf::PlayerType _internal_to_player_type() const;
void _internal_set_to_player_type(::protobuf::PlayerType value);

public: public:
// @@protoc_insertion_point(class_scope:protobuf.SendMsg) // @@protoc_insertion_point(class_scope:protobuf.SendMsg)


@@ -1032,8 +986,6 @@ namespace protobuf
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr message_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr message_;
int64_t player_id_; int64_t player_id_;
int64_t to_player_id_; int64_t to_player_id_;
int player_type_;
int to_player_type_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
}; };
union union
@@ -1203,8 +1155,7 @@ namespace protobuf
enum : int enum : int
{ {
kPlayerIdFieldNumber = 1, kPlayerIdFieldNumber = 1,
kAngleFieldNumber = 3,
kPlayerTypeFieldNumber = 2,
kAngleFieldNumber = 2,
}; };
// int64 player_id = 1; // int64 player_id = 1;
void clear_player_id(); void clear_player_id();
@@ -1216,7 +1167,7 @@ namespace protobuf
void _internal_set_player_id(int64_t value); void _internal_set_player_id(int64_t value);


public: public:
// double angle = 3;
// double angle = 2;
void clear_angle(); void clear_angle();
double angle() const; double angle() const;
void set_angle(double value); void set_angle(double value);
@@ -1225,16 +1176,6 @@ namespace protobuf
double _internal_angle() const; double _internal_angle() const;
void _internal_set_angle(double value); void _internal_set_angle(double value);


public:
// .protobuf.PlayerType player_type = 2;
void clear_player_type();
::protobuf::PlayerType player_type() const;
void set_player_type(::protobuf::PlayerType value);

private:
::protobuf::PlayerType _internal_player_type() const;
void _internal_set_player_type(::protobuf::PlayerType value);

public: public:
// @@protoc_insertion_point(class_scope:protobuf.AttackMsg) // @@protoc_insertion_point(class_scope:protobuf.AttackMsg)


@@ -1249,7 +1190,6 @@ namespace protobuf
{ {
int64_t player_id_; int64_t player_id_;
double angle_; double angle_;
int player_type_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
}; };
union union
@@ -1419,7 +1359,6 @@ namespace protobuf
enum : int enum : int
{ {
kPlayerIdFieldNumber = 1, kPlayerIdFieldNumber = 1,
kPlayerTypeFieldNumber = 2,
}; };
// int64 player_id = 1; // int64 player_id = 1;
void clear_player_id(); void clear_player_id();
@@ -1430,16 +1369,6 @@ namespace protobuf
int64_t _internal_player_id() const; int64_t _internal_player_id() const;
void _internal_set_player_id(int64_t value); void _internal_set_player_id(int64_t value);


public:
// .protobuf.PlayerType player_type = 2;
void clear_player_type();
::protobuf::PlayerType player_type() const;
void set_player_type(::protobuf::PlayerType value);

private:
::protobuf::PlayerType _internal_player_type() const;
void _internal_set_player_type(::protobuf::PlayerType value);

public: public:
// @@protoc_insertion_point(class_scope:protobuf.IDMsg) // @@protoc_insertion_point(class_scope:protobuf.IDMsg)


@@ -1453,7 +1382,6 @@ namespace protobuf
struct Impl_ struct Impl_
{ {
int64_t player_id_; int64_t player_id_;
int player_type_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
}; };
union union
@@ -1623,8 +1551,7 @@ namespace protobuf
enum : int enum : int
{ {
kPlayerIdFieldNumber = 1, kPlayerIdFieldNumber = 1,
kPlayerTypeFieldNumber = 2,
kSkillIdFieldNumber = 3,
kSkillIdFieldNumber = 2,
}; };
// int64 player_id = 1; // int64 player_id = 1;
void clear_player_id(); void clear_player_id();
@@ -1636,17 +1563,7 @@ namespace protobuf
void _internal_set_player_id(int64_t value); void _internal_set_player_id(int64_t value);


public: public:
// .protobuf.PlayerType player_type = 2;
void clear_player_type();
::protobuf::PlayerType player_type() const;
void set_player_type(::protobuf::PlayerType value);

private:
::protobuf::PlayerType _internal_player_type() const;
void _internal_set_player_type(::protobuf::PlayerType value);

public:
// int32 skill_id = 3;
// int32 skill_id = 2;
void clear_skill_id(); void clear_skill_id();
int32_t skill_id() const; int32_t skill_id() const;
void set_skill_id(int32_t value); void set_skill_id(int32_t value);
@@ -1668,7 +1585,6 @@ namespace protobuf
struct Impl_ struct Impl_
{ {
int64_t player_id_; int64_t player_id_;
int player_type_;
int32_t skill_id_; int32_t skill_id_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
}; };
@@ -1712,31 +1628,7 @@ namespace protobuf
// @@protoc_insertion_point(field_set:protobuf.PlayerMsg.player_id) // @@protoc_insertion_point(field_set:protobuf.PlayerMsg.player_id)
} }


// .protobuf.PlayerType player_type = 2;
inline void PlayerMsg::clear_player_type()
{
_impl_.player_type_ = 0;
}
inline ::protobuf::PlayerType PlayerMsg::_internal_player_type() const
{
return static_cast<::protobuf::PlayerType>(_impl_.player_type_);
}
inline ::protobuf::PlayerType PlayerMsg::player_type() const
{
// @@protoc_insertion_point(field_get:protobuf.PlayerMsg.player_type)
return _internal_player_type();
}
inline void PlayerMsg::_internal_set_player_type(::protobuf::PlayerType value)
{
_impl_.player_type_ = value;
}
inline void PlayerMsg::set_player_type(::protobuf::PlayerType value)
{
_internal_set_player_type(value);
// @@protoc_insertion_point(field_set:protobuf.PlayerMsg.player_type)
}

// .protobuf.StudentType student_type = 3;
// .protobuf.StudentType student_type = 2;
inline bool PlayerMsg::_internal_has_student_type() const inline bool PlayerMsg::_internal_has_student_type() const
{ {
return job_type_case() == kStudentType; return job_type_case() == kStudentType;
@@ -1785,7 +1677,7 @@ namespace protobuf
// @@protoc_insertion_point(field_set:protobuf.PlayerMsg.student_type) // @@protoc_insertion_point(field_set:protobuf.PlayerMsg.student_type)
} }


// .protobuf.TrickerType tricker_type = 4;
// .protobuf.TrickerType tricker_type = 3;
inline bool PlayerMsg::_internal_has_tricker_type() const inline bool PlayerMsg::_internal_has_tricker_type() const
{ {
return job_type_case() == kTrickerType; return job_type_case() == kTrickerType;
@@ -1834,6 +1726,30 @@ namespace protobuf
// @@protoc_insertion_point(field_set:protobuf.PlayerMsg.tricker_type) // @@protoc_insertion_point(field_set:protobuf.PlayerMsg.tricker_type)
} }


// .protobuf.PlayerType player_type = 4;
inline void PlayerMsg::clear_player_type()
{
_impl_.player_type_ = 0;
}
inline ::protobuf::PlayerType PlayerMsg::_internal_player_type() const
{
return static_cast<::protobuf::PlayerType>(_impl_.player_type_);
}
inline ::protobuf::PlayerType PlayerMsg::player_type() const
{
// @@protoc_insertion_point(field_get:protobuf.PlayerMsg.player_type)
return _internal_player_type();
}
inline void PlayerMsg::_internal_set_player_type(::protobuf::PlayerType value)
{
_impl_.player_type_ = value;
}
inline void PlayerMsg::set_player_type(::protobuf::PlayerType value)
{
_internal_set_player_type(value);
// @@protoc_insertion_point(field_set:protobuf.PlayerMsg.player_type)
}

inline bool PlayerMsg::has_job_type() const inline bool PlayerMsg::has_job_type() const
{ {
return job_type_case() != JOB_TYPE_NOT_SET; return job_type_case() != JOB_TYPE_NOT_SET;
@@ -1874,31 +1790,7 @@ namespace protobuf
// @@protoc_insertion_point(field_set:protobuf.MoveMsg.player_id) // @@protoc_insertion_point(field_set:protobuf.MoveMsg.player_id)
} }


// .protobuf.PlayerType player_type = 2;
inline void MoveMsg::clear_player_type()
{
_impl_.player_type_ = 0;
}
inline ::protobuf::PlayerType MoveMsg::_internal_player_type() const
{
return static_cast<::protobuf::PlayerType>(_impl_.player_type_);
}
inline ::protobuf::PlayerType MoveMsg::player_type() const
{
// @@protoc_insertion_point(field_get:protobuf.MoveMsg.player_type)
return _internal_player_type();
}
inline void MoveMsg::_internal_set_player_type(::protobuf::PlayerType value)
{
_impl_.player_type_ = value;
}
inline void MoveMsg::set_player_type(::protobuf::PlayerType value)
{
_internal_set_player_type(value);
// @@protoc_insertion_point(field_set:protobuf.MoveMsg.player_type)
}

// double angle = 3;
// double angle = 2;
inline void MoveMsg::clear_angle() inline void MoveMsg::clear_angle()
{ {
_impl_.angle_ = 0; _impl_.angle_ = 0;
@@ -1922,7 +1814,7 @@ namespace protobuf
// @@protoc_insertion_point(field_set:protobuf.MoveMsg.angle) // @@protoc_insertion_point(field_set:protobuf.MoveMsg.angle)
} }


// int64 time_in_milliseconds = 4;
// int64 time_in_milliseconds = 3;
inline void MoveMsg::clear_time_in_milliseconds() inline void MoveMsg::clear_time_in_milliseconds()
{ {
_impl_.time_in_milliseconds_ = int64_t{0}; _impl_.time_in_milliseconds_ = int64_t{0};
@@ -1974,31 +1866,7 @@ namespace protobuf
// @@protoc_insertion_point(field_set:protobuf.PropMsg.player_id) // @@protoc_insertion_point(field_set:protobuf.PropMsg.player_id)
} }


// .protobuf.PlayerType player_type = 2;
inline void PropMsg::clear_player_type()
{
_impl_.player_type_ = 0;
}
inline ::protobuf::PlayerType PropMsg::_internal_player_type() const
{
return static_cast<::protobuf::PlayerType>(_impl_.player_type_);
}
inline ::protobuf::PlayerType PropMsg::player_type() const
{
// @@protoc_insertion_point(field_get:protobuf.PropMsg.player_type)
return _internal_player_type();
}
inline void PropMsg::_internal_set_player_type(::protobuf::PlayerType value)
{
_impl_.player_type_ = value;
}
inline void PropMsg::set_player_type(::protobuf::PlayerType value)
{
_internal_set_player_type(value);
// @@protoc_insertion_point(field_set:protobuf.PropMsg.player_type)
}

// .protobuf.PropType prop_type = 3;
// .protobuf.PropType prop_type = 2;
inline void PropMsg::clear_prop_type() inline void PropMsg::clear_prop_type()
{ {
_impl_.prop_type_ = 0; _impl_.prop_type_ = 0;
@@ -2050,31 +1918,7 @@ namespace protobuf
// @@protoc_insertion_point(field_set:protobuf.SendMsg.player_id) // @@protoc_insertion_point(field_set:protobuf.SendMsg.player_id)
} }


// .protobuf.PlayerType player_type = 2;
inline void SendMsg::clear_player_type()
{
_impl_.player_type_ = 0;
}
inline ::protobuf::PlayerType SendMsg::_internal_player_type() const
{
return static_cast<::protobuf::PlayerType>(_impl_.player_type_);
}
inline ::protobuf::PlayerType SendMsg::player_type() const
{
// @@protoc_insertion_point(field_get:protobuf.SendMsg.player_type)
return _internal_player_type();
}
inline void SendMsg::_internal_set_player_type(::protobuf::PlayerType value)
{
_impl_.player_type_ = value;
}
inline void SendMsg::set_player_type(::protobuf::PlayerType value)
{
_internal_set_player_type(value);
// @@protoc_insertion_point(field_set:protobuf.SendMsg.player_type)
}

// int64 to_player_id = 3;
// int64 to_player_id = 2;
inline void SendMsg::clear_to_player_id() inline void SendMsg::clear_to_player_id()
{ {
_impl_.to_player_id_ = int64_t{0}; _impl_.to_player_id_ = int64_t{0};
@@ -2098,31 +1942,7 @@ namespace protobuf
// @@protoc_insertion_point(field_set:protobuf.SendMsg.to_player_id) // @@protoc_insertion_point(field_set:protobuf.SendMsg.to_player_id)
} }


// .protobuf.PlayerType to_player_type = 4;
inline void SendMsg::clear_to_player_type()
{
_impl_.to_player_type_ = 0;
}
inline ::protobuf::PlayerType SendMsg::_internal_to_player_type() const
{
return static_cast<::protobuf::PlayerType>(_impl_.to_player_type_);
}
inline ::protobuf::PlayerType SendMsg::to_player_type() const
{
// @@protoc_insertion_point(field_get:protobuf.SendMsg.to_player_type)
return _internal_to_player_type();
}
inline void SendMsg::_internal_set_to_player_type(::protobuf::PlayerType value)
{
_impl_.to_player_type_ = value;
}
inline void SendMsg::set_to_player_type(::protobuf::PlayerType value)
{
_internal_set_to_player_type(value);
// @@protoc_insertion_point(field_set:protobuf.SendMsg.to_player_type)
}

// string message = 5;
// string message = 3;
inline void SendMsg::clear_message() inline void SendMsg::clear_message()
{ {
_impl_.message_.ClearToEmpty(); _impl_.message_.ClearToEmpty();
@@ -2207,31 +2027,7 @@ namespace protobuf
// @@protoc_insertion_point(field_set:protobuf.AttackMsg.player_id) // @@protoc_insertion_point(field_set:protobuf.AttackMsg.player_id)
} }


// .protobuf.PlayerType player_type = 2;
inline void AttackMsg::clear_player_type()
{
_impl_.player_type_ = 0;
}
inline ::protobuf::PlayerType AttackMsg::_internal_player_type() const
{
return static_cast<::protobuf::PlayerType>(_impl_.player_type_);
}
inline ::protobuf::PlayerType AttackMsg::player_type() const
{
// @@protoc_insertion_point(field_get:protobuf.AttackMsg.player_type)
return _internal_player_type();
}
inline void AttackMsg::_internal_set_player_type(::protobuf::PlayerType value)
{
_impl_.player_type_ = value;
}
inline void AttackMsg::set_player_type(::protobuf::PlayerType value)
{
_internal_set_player_type(value);
// @@protoc_insertion_point(field_set:protobuf.AttackMsg.player_type)
}

// double angle = 3;
// double angle = 2;
inline void AttackMsg::clear_angle() inline void AttackMsg::clear_angle()
{ {
_impl_.angle_ = 0; _impl_.angle_ = 0;
@@ -2283,30 +2079,6 @@ namespace protobuf
// @@protoc_insertion_point(field_set:protobuf.IDMsg.player_id) // @@protoc_insertion_point(field_set:protobuf.IDMsg.player_id)
} }


// .protobuf.PlayerType player_type = 2;
inline void IDMsg::clear_player_type()
{
_impl_.player_type_ = 0;
}
inline ::protobuf::PlayerType IDMsg::_internal_player_type() const
{
return static_cast<::protobuf::PlayerType>(_impl_.player_type_);
}
inline ::protobuf::PlayerType IDMsg::player_type() const
{
// @@protoc_insertion_point(field_get:protobuf.IDMsg.player_type)
return _internal_player_type();
}
inline void IDMsg::_internal_set_player_type(::protobuf::PlayerType value)
{
_impl_.player_type_ = value;
}
inline void IDMsg::set_player_type(::protobuf::PlayerType value)
{
_internal_set_player_type(value);
// @@protoc_insertion_point(field_set:protobuf.IDMsg.player_type)
}

// ------------------------------------------------------------------- // -------------------------------------------------------------------


// SkillMsg // SkillMsg
@@ -2335,31 +2107,7 @@ namespace protobuf
// @@protoc_insertion_point(field_set:protobuf.SkillMsg.player_id) // @@protoc_insertion_point(field_set:protobuf.SkillMsg.player_id)
} }


// .protobuf.PlayerType player_type = 2;
inline void SkillMsg::clear_player_type()
{
_impl_.player_type_ = 0;
}
inline ::protobuf::PlayerType SkillMsg::_internal_player_type() const
{
return static_cast<::protobuf::PlayerType>(_impl_.player_type_);
}
inline ::protobuf::PlayerType SkillMsg::player_type() const
{
// @@protoc_insertion_point(field_get:protobuf.SkillMsg.player_type)
return _internal_player_type();
}
inline void SkillMsg::_internal_set_player_type(::protobuf::PlayerType value)
{
_impl_.player_type_ = value;
}
inline void SkillMsg::set_player_type(::protobuf::PlayerType value)
{
_internal_set_player_type(value);
// @@protoc_insertion_point(field_set:protobuf.SkillMsg.player_type)
}

// int32 skill_id = 3;
// int32 skill_id = 2;
inline void SkillMsg::clear_skill_id() inline void SkillMsg::clear_skill_id()
{ {
_impl_.skill_id_ = 0; _impl_.skill_id_ = 0;


+ 53
- 1
CAPI/cpp/proto/Services.grpc.pb.cc View File

@@ -42,6 +42,7 @@ namespace protobuf
"/protobuf.AvailableService/StartOpenGate", "/protobuf.AvailableService/StartOpenGate",
"/protobuf.AvailableService/StartOpenChest", "/protobuf.AvailableService/StartOpenChest",
"/protobuf.AvailableService/EndAllAction", "/protobuf.AvailableService/EndAllAction",
"/protobuf.AvailableService/GetMap",
}; };


std::unique_ptr<AvailableService::Stub> AvailableService::NewStub(const std::shared_ptr<::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) std::unique_ptr<AvailableService::Stub> AvailableService::NewStub(const std::shared_ptr<::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options)
@@ -71,7 +72,8 @@ namespace protobuf
rpcmethod_SkipWindow_(AvailableService_method_names[15], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), rpcmethod_SkipWindow_(AvailableService_method_names[15], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel),
rpcmethod_StartOpenGate_(AvailableService_method_names[16], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), rpcmethod_StartOpenGate_(AvailableService_method_names[16], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel),
rpcmethod_StartOpenChest_(AvailableService_method_names[17], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), rpcmethod_StartOpenChest_(AvailableService_method_names[17], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel),
rpcmethod_EndAllAction_(AvailableService_method_names[18], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel)
rpcmethod_EndAllAction_(AvailableService_method_names[18], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel),
rpcmethod_GetMap_(AvailableService_method_names[19], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel)
{ {
} }


@@ -591,6 +593,34 @@ namespace protobuf
return result; return result;
} }


::grpc::Status AvailableService::Stub::GetMap(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::protobuf::MessageOfMap* response)
{
return ::grpc::internal::BlockingUnaryCall<::protobuf::IDMsg, ::protobuf::MessageOfMap, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_GetMap_, context, request, response);
}

void AvailableService::Stub::async::GetMap(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::MessageOfMap* response, std::function<void(::grpc::Status)> f)
{
::grpc::internal::CallbackUnaryCall<::protobuf::IDMsg, ::protobuf::MessageOfMap, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_GetMap_, context, request, response, std::move(f));
}

void AvailableService::Stub::async::GetMap(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::MessageOfMap* response, ::grpc::ClientUnaryReactor* reactor)
{
::grpc::internal::ClientCallbackUnaryFactory::Create<::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_GetMap_, context, request, response, reactor);
}

::grpc::ClientAsyncResponseReader<::protobuf::MessageOfMap>* AvailableService::Stub::PrepareAsyncGetMapRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq)
{
return ::grpc::internal::ClientAsyncResponseReaderHelper::Create<::protobuf::MessageOfMap, ::protobuf::IDMsg, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_GetMap_, context, request);
}

::grpc::ClientAsyncResponseReader<::protobuf::MessageOfMap>* AvailableService::Stub::AsyncGetMapRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq)
{
auto* result =
this->PrepareAsyncGetMapRaw(context, request, cq);
result->StartCall();
return result;
}

AvailableService::Service::Service() AvailableService::Service::Service()
{ {
AddMethod(new ::grpc::internal::RpcServiceMethod( AddMethod(new ::grpc::internal::RpcServiceMethod(
@@ -859,6 +889,20 @@ namespace protobuf
this this
) )
)); ));
AddMethod(new ::grpc::internal::RpcServiceMethod(
AvailableService_method_names[19],
::grpc::internal::RpcMethod::NORMAL_RPC,
new ::grpc::internal::RpcMethodHandler<AvailableService::Service, ::protobuf::IDMsg, ::protobuf::MessageOfMap, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(
[](AvailableService::Service* service,
::grpc::ServerContext* ctx,
const ::protobuf::IDMsg* req,
::protobuf::MessageOfMap* resp)
{
return service->GetMap(ctx, req, resp);
},
this
)
));
} }


AvailableService::Service::~Service() AvailableService::Service::~Service()
@@ -1017,4 +1061,12 @@ namespace protobuf
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
} }


::grpc::Status AvailableService::Service::GetMap(::grpc::ServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::MessageOfMap* response)
{
(void)context;
(void)request;
(void)response;
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}

} // namespace protobuf } // namespace protobuf

+ 212
- 4
CAPI/cpp/proto/Services.grpc.pb.h View File

@@ -230,6 +230,16 @@ namespace protobuf
return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>>(PrepareAsyncEndAllActionRaw(context, request, cq)); return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>>(PrepareAsyncEndAllActionRaw(context, request, cq));
} }
// 结束所有动作 // 结束所有动作
virtual ::grpc::Status GetMap(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::protobuf::MessageOfMap* response) = 0;
std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::MessageOfMap>> AsyncGetMap(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq)
{
return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::MessageOfMap>>(AsyncGetMapRaw(context, request, cq));
}
std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::MessageOfMap>> PrepareAsyncGetMap(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq)
{
return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::MessageOfMap>>(PrepareAsyncGetMapRaw(context, request, cq));
}
// 游戏开始时候获取地图
class async_interface class async_interface
{ {
public: public:
@@ -284,6 +294,9 @@ namespace protobuf
virtual void EndAllAction(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, std::function<void(::grpc::Status)>) = 0; virtual void EndAllAction(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, std::function<void(::grpc::Status)>) = 0;
virtual void EndAllAction(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) = 0; virtual void EndAllAction(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) = 0;
// 结束所有动作 // 结束所有动作
virtual void GetMap(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::MessageOfMap* response, std::function<void(::grpc::Status)>) = 0;
virtual void GetMap(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::MessageOfMap* response, ::grpc::ClientUnaryReactor* reactor) = 0;
// 游戏开始时候获取地图
}; };
typedef class async_interface experimental_async_interface; typedef class async_interface experimental_async_interface;
virtual class async_interface* async() virtual class async_interface* async()
@@ -336,6 +349,8 @@ namespace protobuf
virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* PrepareAsyncStartOpenChestRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) = 0; virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* PrepareAsyncStartOpenChestRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) = 0;
virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* AsyncEndAllActionRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) = 0; virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* AsyncEndAllActionRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) = 0;
virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* PrepareAsyncEndAllActionRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) = 0; virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* PrepareAsyncEndAllActionRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) = 0;
virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::MessageOfMap>* AsyncGetMapRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) = 0;
virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::MessageOfMap>* PrepareAsyncGetMapRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) = 0;
}; };
class Stub final : public StubInterface class Stub final : public StubInterface
{ {
@@ -518,6 +533,15 @@ namespace protobuf
{ {
return std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>>(PrepareAsyncEndAllActionRaw(context, request, cq)); return std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>>(PrepareAsyncEndAllActionRaw(context, request, cq));
} }
::grpc::Status GetMap(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::protobuf::MessageOfMap* response) override;
std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::MessageOfMap>> AsyncGetMap(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq)
{
return std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::MessageOfMap>>(AsyncGetMapRaw(context, request, cq));
}
std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::MessageOfMap>> PrepareAsyncGetMap(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq)
{
return std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::MessageOfMap>>(PrepareAsyncGetMapRaw(context, request, cq));
}
class async final : class async final :
public StubInterface::async_interface public StubInterface::async_interface
{ {
@@ -558,6 +582,8 @@ namespace protobuf
void StartOpenChest(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) override; void StartOpenChest(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) override;
void EndAllAction(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, std::function<void(::grpc::Status)>) override; void EndAllAction(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, std::function<void(::grpc::Status)>) override;
void EndAllAction(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) override; void EndAllAction(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) override;
void GetMap(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::MessageOfMap* response, std::function<void(::grpc::Status)>) override;
void GetMap(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::MessageOfMap* response, ::grpc::ClientUnaryReactor* reactor) override;


private: private:
friend class Stub; friend class Stub;
@@ -622,6 +648,8 @@ namespace protobuf
::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* PrepareAsyncStartOpenChestRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override; ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* PrepareAsyncStartOpenChestRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override;
::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AsyncEndAllActionRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override; ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AsyncEndAllActionRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override;
::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* PrepareAsyncEndAllActionRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override; ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* PrepareAsyncEndAllActionRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override;
::grpc::ClientAsyncResponseReader<::protobuf::MessageOfMap>* AsyncGetMapRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override;
::grpc::ClientAsyncResponseReader<::protobuf::MessageOfMap>* PrepareAsyncGetMapRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override;
const ::grpc::internal::RpcMethod rpcmethod_TryConnection_; const ::grpc::internal::RpcMethod rpcmethod_TryConnection_;
const ::grpc::internal::RpcMethod rpcmethod_AddPlayer_; const ::grpc::internal::RpcMethod rpcmethod_AddPlayer_;
const ::grpc::internal::RpcMethod rpcmethod_Move_; const ::grpc::internal::RpcMethod rpcmethod_Move_;
@@ -641,6 +669,7 @@ namespace protobuf
const ::grpc::internal::RpcMethod rpcmethod_StartOpenGate_; const ::grpc::internal::RpcMethod rpcmethod_StartOpenGate_;
const ::grpc::internal::RpcMethod rpcmethod_StartOpenChest_; const ::grpc::internal::RpcMethod rpcmethod_StartOpenChest_;
const ::grpc::internal::RpcMethod rpcmethod_EndAllAction_; const ::grpc::internal::RpcMethod rpcmethod_EndAllAction_;
const ::grpc::internal::RpcMethod rpcmethod_GetMap_;
}; };
static std::unique_ptr<Stub> NewStub(const std::shared_ptr<::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions()); static std::unique_ptr<Stub> NewStub(const std::shared_ptr<::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions());


@@ -680,6 +709,8 @@ namespace protobuf
virtual ::grpc::Status StartOpenChest(::grpc::ServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response); virtual ::grpc::Status StartOpenChest(::grpc::ServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response);
virtual ::grpc::Status EndAllAction(::grpc::ServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response); virtual ::grpc::Status EndAllAction(::grpc::ServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response);
// 结束所有动作 // 结束所有动作
virtual ::grpc::Status GetMap(::grpc::ServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::MessageOfMap* response);
// 游戏开始时候获取地图
}; };
template<class BaseClass> template<class BaseClass>
class WithAsyncMethod_TryConnection : public BaseClass class WithAsyncMethod_TryConnection : public BaseClass
@@ -1213,7 +1244,35 @@ namespace protobuf
::grpc::Service::RequestAsyncUnary(18, context, request, response, new_call_cq, notification_cq, tag); ::grpc::Service::RequestAsyncUnary(18, context, request, response, new_call_cq, notification_cq, tag);
} }
}; };
typedef WithAsyncMethod_TryConnection<WithAsyncMethod_AddPlayer<WithAsyncMethod_Move<WithAsyncMethod_PickProp<WithAsyncMethod_UseProp<WithAsyncMethod_UseSkill<WithAsyncMethod_SendMessage<WithAsyncMethod_GetMessage<WithAsyncMethod_StartLearning<WithAsyncMethod_StartRescueMate<WithAsyncMethod_StartTreatMate<WithAsyncMethod_Attack<WithAsyncMethod_Graduate<WithAsyncMethod_OpenDoor<WithAsyncMethod_CloseDoor<WithAsyncMethod_SkipWindow<WithAsyncMethod_StartOpenGate<WithAsyncMethod_StartOpenChest<WithAsyncMethod_EndAllAction<Service>>>>>>>>>>>>>>>>>>> AsyncService;
template<class BaseClass>
class WithAsyncMethod_GetMap : public BaseClass
{
private:
void BaseClassMustBeDerivedFromService(const Service* /*service*/)
{
}

public:
WithAsyncMethod_GetMap()
{
::grpc::Service::MarkMethodAsync(19);
}
~WithAsyncMethod_GetMap() override
{
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
::grpc::Status GetMap(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::MessageOfMap* /*response*/) override
{
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
void RequestGetMap(::grpc::ServerContext* context, ::protobuf::IDMsg* request, ::grpc::ServerAsyncResponseWriter<::protobuf::MessageOfMap>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag)
{
::grpc::Service::RequestAsyncUnary(19, context, request, response, new_call_cq, notification_cq, tag);
}
};
typedef WithAsyncMethod_TryConnection<WithAsyncMethod_AddPlayer<WithAsyncMethod_Move<WithAsyncMethod_PickProp<WithAsyncMethod_UseProp<WithAsyncMethod_UseSkill<WithAsyncMethod_SendMessage<WithAsyncMethod_GetMessage<WithAsyncMethod_StartLearning<WithAsyncMethod_StartRescueMate<WithAsyncMethod_StartTreatMate<WithAsyncMethod_Attack<WithAsyncMethod_Graduate<WithAsyncMethod_OpenDoor<WithAsyncMethod_CloseDoor<WithAsyncMethod_SkipWindow<WithAsyncMethod_StartOpenGate<WithAsyncMethod_StartOpenChest<WithAsyncMethod_EndAllAction<WithAsyncMethod_GetMap<Service>>>>>>>>>>>>>>>>>>>> AsyncService;
template<class BaseClass> template<class BaseClass>
class WithCallbackMethod_TryConnection : public BaseClass class WithCallbackMethod_TryConnection : public BaseClass
{ {
@@ -1939,7 +1998,46 @@ namespace protobuf
return nullptr; return nullptr;
} }
}; };
typedef WithCallbackMethod_TryConnection<WithCallbackMethod_AddPlayer<WithCallbackMethod_Move<WithCallbackMethod_PickProp<WithCallbackMethod_UseProp<WithCallbackMethod_UseSkill<WithCallbackMethod_SendMessage<WithCallbackMethod_GetMessage<WithCallbackMethod_StartLearning<WithCallbackMethod_StartRescueMate<WithCallbackMethod_StartTreatMate<WithCallbackMethod_Attack<WithCallbackMethod_Graduate<WithCallbackMethod_OpenDoor<WithCallbackMethod_CloseDoor<WithCallbackMethod_SkipWindow<WithCallbackMethod_StartOpenGate<WithCallbackMethod_StartOpenChest<WithCallbackMethod_EndAllAction<Service>>>>>>>>>>>>>>>>>>> CallbackService;
template<class BaseClass>
class WithCallbackMethod_GetMap : public BaseClass
{
private:
void BaseClassMustBeDerivedFromService(const Service* /*service*/)
{
}

public:
WithCallbackMethod_GetMap()
{
::grpc::Service::MarkMethodCallback(19, new ::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::MessageOfMap>([this](::grpc::CallbackServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::MessageOfMap* response)
{ return this->GetMap(context, request, response); }));
}
void SetMessageAllocatorFor_GetMap(
::grpc::MessageAllocator<::protobuf::IDMsg, ::protobuf::MessageOfMap>* allocator
)
{
::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(19);
static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::MessageOfMap>*>(handler)
->SetMessageAllocator(allocator);
}
~WithCallbackMethod_GetMap() override
{
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
::grpc::Status GetMap(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::MessageOfMap* /*response*/) override
{
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
virtual ::grpc::ServerUnaryReactor* GetMap(
::grpc::CallbackServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::MessageOfMap* /*response*/
)
{
return nullptr;
}
};
typedef WithCallbackMethod_TryConnection<WithCallbackMethod_AddPlayer<WithCallbackMethod_Move<WithCallbackMethod_PickProp<WithCallbackMethod_UseProp<WithCallbackMethod_UseSkill<WithCallbackMethod_SendMessage<WithCallbackMethod_GetMessage<WithCallbackMethod_StartLearning<WithCallbackMethod_StartRescueMate<WithCallbackMethod_StartTreatMate<WithCallbackMethod_Attack<WithCallbackMethod_Graduate<WithCallbackMethod_OpenDoor<WithCallbackMethod_CloseDoor<WithCallbackMethod_SkipWindow<WithCallbackMethod_StartOpenGate<WithCallbackMethod_StartOpenChest<WithCallbackMethod_EndAllAction<WithCallbackMethod_GetMap<Service>>>>>>>>>>>>>>>>>>>> CallbackService;
typedef CallbackService ExperimentalCallbackService; typedef CallbackService ExperimentalCallbackService;
template<class BaseClass> template<class BaseClass>
class WithGenericMethod_TryConnection : public BaseClass class WithGenericMethod_TryConnection : public BaseClass
@@ -2398,6 +2496,30 @@ namespace protobuf
} }
}; };
template<class BaseClass> template<class BaseClass>
class WithGenericMethod_GetMap : public BaseClass
{
private:
void BaseClassMustBeDerivedFromService(const Service* /*service*/)
{
}

public:
WithGenericMethod_GetMap()
{
::grpc::Service::MarkMethodGeneric(19);
}
~WithGenericMethod_GetMap() override
{
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
::grpc::Status GetMap(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::MessageOfMap* /*response*/) override
{
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
};
template<class BaseClass>
class WithRawMethod_TryConnection : public BaseClass class WithRawMethod_TryConnection : public BaseClass
{ {
private: private:
@@ -2930,6 +3052,34 @@ namespace protobuf
} }
}; };
template<class BaseClass> template<class BaseClass>
class WithRawMethod_GetMap : public BaseClass
{
private:
void BaseClassMustBeDerivedFromService(const Service* /*service*/)
{
}

public:
WithRawMethod_GetMap()
{
::grpc::Service::MarkMethodRaw(19);
}
~WithRawMethod_GetMap() override
{
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
::grpc::Status GetMap(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::MessageOfMap* /*response*/) override
{
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
void RequestGetMap(::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(19, context, request, response, new_call_cq, notification_cq, tag);
}
};
template<class BaseClass>
class WithRawCallbackMethod_TryConnection : public BaseClass class WithRawCallbackMethod_TryConnection : public BaseClass
{ {
private: private:
@@ -3519,6 +3669,37 @@ namespace protobuf
} }
}; };
template<class BaseClass> template<class BaseClass>
class WithRawCallbackMethod_GetMap : public BaseClass
{
private:
void BaseClassMustBeDerivedFromService(const Service* /*service*/)
{
}

public:
WithRawCallbackMethod_GetMap()
{
::grpc::Service::MarkMethodRawCallback(19, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response)
{ return this->GetMap(context, request, response); }));
}
~WithRawCallbackMethod_GetMap() override
{
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
::grpc::Status GetMap(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::MessageOfMap* /*response*/) override
{
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
virtual ::grpc::ServerUnaryReactor* GetMap(
::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/
)
{
return nullptr;
}
};
template<class BaseClass>
class WithStreamedUnaryMethod_TryConnection : public BaseClass class WithStreamedUnaryMethod_TryConnection : public BaseClass
{ {
private: private:
@@ -3977,7 +4158,34 @@ namespace protobuf
// replace default version of method with streamed unary // replace default version of method with streamed unary
virtual ::grpc::Status StreamedEndAllAction(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* server_unary_streamer) = 0; virtual ::grpc::Status StreamedEndAllAction(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* server_unary_streamer) = 0;
}; };
typedef WithStreamedUnaryMethod_TryConnection<WithStreamedUnaryMethod_Move<WithStreamedUnaryMethod_PickProp<WithStreamedUnaryMethod_UseProp<WithStreamedUnaryMethod_UseSkill<WithStreamedUnaryMethod_SendMessage<WithStreamedUnaryMethod_StartLearning<WithStreamedUnaryMethod_StartRescueMate<WithStreamedUnaryMethod_StartTreatMate<WithStreamedUnaryMethod_Attack<WithStreamedUnaryMethod_Graduate<WithStreamedUnaryMethod_OpenDoor<WithStreamedUnaryMethod_CloseDoor<WithStreamedUnaryMethod_SkipWindow<WithStreamedUnaryMethod_StartOpenGate<WithStreamedUnaryMethod_StartOpenChest<WithStreamedUnaryMethod_EndAllAction<Service>>>>>>>>>>>>>>>>> StreamedUnaryService;
template<class BaseClass>
class WithStreamedUnaryMethod_GetMap : public BaseClass
{
private:
void BaseClassMustBeDerivedFromService(const Service* /*service*/)
{
}

public:
WithStreamedUnaryMethod_GetMap()
{
::grpc::Service::MarkMethodStreamed(19, new ::grpc::internal::StreamedUnaryHandler<::protobuf::IDMsg, ::protobuf::MessageOfMap>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::MessageOfMap>* streamer)
{ return this->StreamedGetMap(context, streamer); }));
}
~WithStreamedUnaryMethod_GetMap() override
{
BaseClassMustBeDerivedFromService(this);
}
// disable regular version of this method
::grpc::Status GetMap(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::MessageOfMap* /*response*/) override
{
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
// replace default version of method with streamed unary
virtual ::grpc::Status StreamedGetMap(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::MessageOfMap>* server_unary_streamer) = 0;
};
typedef WithStreamedUnaryMethod_TryConnection<WithStreamedUnaryMethod_Move<WithStreamedUnaryMethod_PickProp<WithStreamedUnaryMethod_UseProp<WithStreamedUnaryMethod_UseSkill<WithStreamedUnaryMethod_SendMessage<WithStreamedUnaryMethod_StartLearning<WithStreamedUnaryMethod_StartRescueMate<WithStreamedUnaryMethod_StartTreatMate<WithStreamedUnaryMethod_Attack<WithStreamedUnaryMethod_Graduate<WithStreamedUnaryMethod_OpenDoor<WithStreamedUnaryMethod_CloseDoor<WithStreamedUnaryMethod_SkipWindow<WithStreamedUnaryMethod_StartOpenGate<WithStreamedUnaryMethod_StartOpenChest<WithStreamedUnaryMethod_EndAllAction<WithStreamedUnaryMethod_GetMap<Service>>>>>>>>>>>>>>>>>> StreamedUnaryService;
template<class BaseClass> template<class BaseClass>
class WithSplitStreamingMethod_AddPlayer : public BaseClass class WithSplitStreamingMethod_AddPlayer : public BaseClass
{ {
@@ -4033,7 +4241,7 @@ namespace protobuf
virtual ::grpc::Status StreamedGetMessage(::grpc::ServerContext* context, ::grpc::ServerSplitStreamer<::protobuf::IDMsg, ::protobuf::MsgRes>* server_split_streamer) = 0; virtual ::grpc::Status StreamedGetMessage(::grpc::ServerContext* context, ::grpc::ServerSplitStreamer<::protobuf::IDMsg, ::protobuf::MsgRes>* server_split_streamer) = 0;
}; };
typedef WithSplitStreamingMethod_AddPlayer<WithSplitStreamingMethod_GetMessage<Service>> SplitStreamedService; typedef WithSplitStreamingMethod_AddPlayer<WithSplitStreamingMethod_GetMessage<Service>> SplitStreamedService;
typedef WithStreamedUnaryMethod_TryConnection<WithSplitStreamingMethod_AddPlayer<WithStreamedUnaryMethod_Move<WithStreamedUnaryMethod_PickProp<WithStreamedUnaryMethod_UseProp<WithStreamedUnaryMethod_UseSkill<WithStreamedUnaryMethod_SendMessage<WithSplitStreamingMethod_GetMessage<WithStreamedUnaryMethod_StartLearning<WithStreamedUnaryMethod_StartRescueMate<WithStreamedUnaryMethod_StartTreatMate<WithStreamedUnaryMethod_Attack<WithStreamedUnaryMethod_Graduate<WithStreamedUnaryMethod_OpenDoor<WithStreamedUnaryMethod_CloseDoor<WithStreamedUnaryMethod_SkipWindow<WithStreamedUnaryMethod_StartOpenGate<WithStreamedUnaryMethod_StartOpenChest<WithStreamedUnaryMethod_EndAllAction<Service>>>>>>>>>>>>>>>>>>> StreamedService;
typedef WithStreamedUnaryMethod_TryConnection<WithSplitStreamingMethod_AddPlayer<WithStreamedUnaryMethod_Move<WithStreamedUnaryMethod_PickProp<WithStreamedUnaryMethod_UseProp<WithStreamedUnaryMethod_UseSkill<WithStreamedUnaryMethod_SendMessage<WithSplitStreamingMethod_GetMessage<WithStreamedUnaryMethod_StartLearning<WithStreamedUnaryMethod_StartRescueMate<WithStreamedUnaryMethod_StartTreatMate<WithStreamedUnaryMethod_Attack<WithStreamedUnaryMethod_Graduate<WithStreamedUnaryMethod_OpenDoor<WithStreamedUnaryMethod_CloseDoor<WithStreamedUnaryMethod_SkipWindow<WithStreamedUnaryMethod_StartOpenGate<WithStreamedUnaryMethod_StartOpenChest<WithStreamedUnaryMethod_EndAllAction<WithStreamedUnaryMethod_GetMap<Service>>>>>>>>>>>>>>>>>>>> StreamedService;
}; };


} // namespace protobuf } // namespace protobuf


+ 5
- 4
CAPI/cpp/proto/Services.pb.cc View File

@@ -31,7 +31,7 @@ static constexpr ::_pb::Message* const* file_default_instances = nullptr;


const char descriptor_table_protodef_Services_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = const char descriptor_table_protodef_Services_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
"\n\016Services.proto\022\010protobuf\032\025Message2Clie" "\n\016Services.proto\022\010protobuf\032\025Message2Clie"
"nts.proto\032\024Message2Server.proto2\350\007\n\020Avai"
"nts.proto\032\024Message2Server.proto2\233\010\n\020Avai"
"lableService\0223\n\rTryConnection\022\017.protobuf" "lableService\0223\n\rTryConnection\022\017.protobuf"
".IDMsg\032\021.protobuf.BoolRes\022=\n\tAddPlayer\022\023" ".IDMsg\032\021.protobuf.BoolRes\022=\n\tAddPlayer\022\023"
".protobuf.PlayerMsg\032\031.protobuf.MessageTo" ".protobuf.PlayerMsg\032\031.protobuf.MessageTo"
@@ -56,8 +56,9 @@ const char descriptor_table_protodef_Services_2eproto[] PROTOBUF_SECTION_VARIABL
"tartOpenGate\022\017.protobuf.IDMsg\032\021.protobuf" "tartOpenGate\022\017.protobuf.IDMsg\032\021.protobuf"
".BoolRes\0224\n\016StartOpenChest\022\017.protobuf.ID" ".BoolRes\0224\n\016StartOpenChest\022\017.protobuf.ID"
"Msg\032\021.protobuf.BoolRes\0222\n\014EndAllAction\022\017" "Msg\032\021.protobuf.BoolRes\0222\n\014EndAllAction\022\017"
".protobuf.IDMsg\032\021.protobuf.BoolResb\006prot"
"o3";
".protobuf.IDMsg\032\021.protobuf.BoolRes\0221\n\006Ge"
"tMap\022\017.protobuf.IDMsg\032\026.protobuf.Message"
"OfMapb\006proto3";
static const ::_pbi::DescriptorTable* const descriptor_table_Services_2eproto_deps[2] = { static const ::_pbi::DescriptorTable* const descriptor_table_Services_2eproto_deps[2] = {
&::descriptor_table_Message2Clients_2eproto, &::descriptor_table_Message2Clients_2eproto,
&::descriptor_table_Message2Server_2eproto, &::descriptor_table_Message2Server_2eproto,
@@ -66,7 +67,7 @@ static ::_pbi::once_flag descriptor_table_Services_2eproto_once;
const ::_pbi::DescriptorTable descriptor_table_Services_2eproto = { const ::_pbi::DescriptorTable descriptor_table_Services_2eproto = {
false, false,
false, false,
1082,
1133,
descriptor_table_protodef_Services_2eproto, descriptor_table_protodef_Services_2eproto,
"Services.proto", "Services.proto",
&descriptor_table_Services_2eproto_once, &descriptor_table_Services_2eproto_once,


Loading…
Cancel
Save