diff --git a/CAPI/API/include/API.h b/CAPI/API/include/API.h index 1b672e2..d42a89d 100644 --- a/CAPI/API/include/API.h +++ b/CAPI/API/include/API.h @@ -34,6 +34,7 @@ public: virtual std::shared_ptr ButcherGetSelfInfo() const = 0; virtual std::vector> GetFullMap() const = 0; + virtual THUAI6::PlaceType GetPlaceType(int32_t CellX, int32_t CellY) const = 0; // 供IAPI使用的操作相关的部分 virtual bool Move(int64_t time, double angle) = 0; @@ -42,17 +43,17 @@ public: virtual bool UseSkill() = 0; virtual bool SendMessage(int64_t toID, std::string message) = 0; virtual bool HaveMessage() = 0; - virtual std::pair GetMessage() = 0; + virtual std::pair GetMessage() = 0; virtual bool Escape() = 0; // 说明:双向stream由三个函数共同实现,两个记录开始和结束,结果由Logic里的私有的成员变量记录,获得返回值则另调函数 - virtual bool StartFixMachine() = 0; - virtual bool EndFixMachine() = 0; + virtual void StartFixMachine() = 0; + virtual void EndFixMachine() = 0; virtual bool GetFixStatus() = 0; - virtual bool StartSaveHuman() = 0; - virtual bool EndSaveHuman() = 0; + virtual void StartSaveHuman() = 0; + virtual void EndSaveHuman() = 0; virtual bool GetSaveStatus() = 0; virtual bool Attack(double angle) = 0; @@ -128,11 +129,11 @@ class IHumanAPI : public IAPI public: /*****人类阵营的特定函数*****/ - virtual std::future StartFixMachine() = 0; - virtual std::future EndFixMachine() = 0; + virtual void StartFixMachine() = 0; + virtual void EndFixMachine() = 0; virtual std::future GetFixStatus() = 0; - virtual std::future StartSaveHuman() = 0; - virtual std::future EndSaveHuman() = 0; + virtual void StartSaveHuman() = 0; + virtual void EndSaveHuman() = 0; virtual std::future GetSaveStatus() = 0; virtual std::future Escape() = 0; [[nodiscard]] virtual std::shared_ptr GetSelfInfo() const = 0; @@ -189,12 +190,8 @@ public: std::future UseSkill() override; std::future SendMessage(int64_t, std::string) override; - [[nodiscard]] std::future HaveMessage() override - { - } - [[nodiscard]] std::future> GetMessage() override - { - } + [[nodiscard]] std::future HaveMessage() override; + [[nodiscard]] std::future> GetMessage() override; std::future Wait() override { @@ -206,38 +203,20 @@ public: [[nodiscard]] std::vector> GetProps() const override; [[nodiscard]] std::vector> GetFullMap() const override; - [[nodiscard]] THUAI6::PlaceType GetPlaceType(int32_t CellX, int32_t CellY) const override - { - } + [[nodiscard]] THUAI6::PlaceType GetPlaceType(int32_t CellX, int32_t CellY) const override; [[nodiscard]] const std::vector GetPlayerGUIDs() const override { } - std::future StartFixMachine() override - { - } - std::future EndFixMachine() override - { - } - std::future GetFixStatus() override - { - } - std::future StartSaveHuman() override - { - } - std::future EndSaveHuman() override - { - } - std::future GetSaveStatus() override - { - } - std::future Escape() override - { - } - [[nodiscard]] virtual std::shared_ptr GetSelfInfo() const override - { - } + void StartFixMachine() override; + void EndFixMachine() override; + std::future GetFixStatus() override; + void StartSaveHuman() override; + void EndSaveHuman() override; + std::future GetSaveStatus() override; + std::future Escape() override; + [[nodiscard]] std::shared_ptr GetSelfInfo() const override; private: ILogic& logic; @@ -273,54 +252,30 @@ public: std::future UseSkill() override; std::future SendMessage(int64_t, std::string) override; - [[nodiscard]] std::future HaveMessage() override - { - } - [[nodiscard]] std::future> GetMessage() override - { - } + [[nodiscard]] std::future HaveMessage() override; + [[nodiscard]] std::future> GetMessage() override; std::future Wait() override { } - [[nodiscard]] std::vector> GetHuman() const override - { - } - [[nodiscard]] std::vector> GetButcher() const override - { - } + [[nodiscard]] std::vector> GetHuman() const override; + [[nodiscard]] std::vector> GetButcher() const override; - [[nodiscard]] std::vector> GetProps() const override - { - } + [[nodiscard]] std::vector> GetProps() const override; - [[nodiscard]] std::vector> GetFullMap() const override - { - } - [[nodiscard]] THUAI6::PlaceType GetPlaceType(int32_t CellX, int32_t CellY) const override - { - } + [[nodiscard]] std::vector> GetFullMap() const override; + [[nodiscard]] THUAI6::PlaceType GetPlaceType(int32_t CellX, int32_t CellY) const override; [[nodiscard]] const std::vector GetPlayerGUIDs() const override { } - std::future Attack(double angleInRadian) override - { - } - std::future CarryHuman() override - { - } - std::future ReleaseHuman() override - { - } - std::future HangHuman() override - { - } - [[nodiscard]] std::shared_ptr GetSelfInfo() const override - { - } + std::future Attack(double angleInRadian) override; + std::future CarryHuman() override; + std::future ReleaseHuman() override; + std::future HangHuman() override; + [[nodiscard]] std::shared_ptr GetSelfInfo() const override; private: ILogic& logic; @@ -408,19 +363,19 @@ public: { } - std::future StartFixMachine() override + void StartFixMachine() override { } - std::future EndFixMachine() override + void EndFixMachine() override { } std::future GetFixStatus() override { } - std::future StartSaveHuman() override + void StartSaveHuman() override { } - std::future EndSaveHuman() override + void EndSaveHuman() override { } std::future GetSaveStatus() override diff --git a/CAPI/API/include/Communication.h b/CAPI/API/include/Communication.h index 3dc7668..35c2711 100644 --- a/CAPI/API/include/Communication.h +++ b/CAPI/API/include/Communication.h @@ -8,6 +8,7 @@ #include "Services.pb.h" #include #include "structures.h" +#include class Logic; @@ -24,17 +25,35 @@ public: bool UseSkill(int64_t playerID); bool SendMessage(int64_t toID, std::string message, int64_t playerID); bool HaveMessage(int64_t playerID); - std::pair GetMessage(int64_t playerID); + std::pair GetMessage(int64_t playerID); bool Escape(int64_t playerID); + + void StartFixMachine(int64_t playerID); + void EndFixMachine(); + bool GetFixStatus(); + void StartSaveHuman(int64_t playerID); + void EndSaveHuman(); + bool GetSaveStatus(); + + bool Attack(double angle, int64_t playerID); + + bool CarryHuman(int64_t playerID); + bool ReleaseHuman(int64_t playerID); + bool HangHuman(int64_t playerID); + bool TryConnection(int64_t playerID); protobuf::MessageToClient GetMessage2Client(); bool HaveMessage2Client(); void AddPlayer(int64_t playerID, THUAI6::PlayerType playerType, THUAI6::HumanType humanType, THUAI6::ButcherType butcherType); private: + void FixMachine(int64_t playerID); + void SaveHuman(int64_t playerID); std::unique_ptr THUAI6Stub; bool haveNewMessage = false; protobuf::MessageToClient message2Client; + bool isFixing = false; + bool isSaving = false; }; #endif \ No newline at end of file diff --git a/CAPI/API/include/logic.h b/CAPI/API/include/logic.h index 6c00ca1..160f9a2 100644 --- a/CAPI/API/include/logic.h +++ b/CAPI/API/include/logic.h @@ -90,6 +90,7 @@ private: std::shared_ptr ButcherGetSelfInfo() const override; std::vector> GetFullMap() const override; + THUAI6::PlaceType GetPlaceType(int32_t CellX, int32_t CellY) const override; // 供IAPI使用的操作相关的部分 bool Move(int64_t time, double angle) override; @@ -98,43 +99,23 @@ private: bool UseSkill() override; bool SendMessage(int64_t toID, std::string message) override; bool HaveMessage() override; - std::pair GetMessage() override; + std::pair GetMessage() override; bool Escape() override; // 说明:双向stream由三个函数共同实现,两个记录开始和结束,结果由Logic里的私有的成员变量记录,获得返回值则另调函数 - bool StartFixMachine() override - { - } - bool EndFixMachine() override - { - } - bool GetFixStatus() override - { - } - - bool StartSaveHuman() override - { - } - bool EndSaveHuman() override - { - } - bool GetSaveStatus() override - { - } - - bool Attack(double angle) override - { - } - bool CarryHuman() override - { - } - bool ReleaseHuman() override - { - } - bool HangHuman() override - { - } + void StartFixMachine() override; + void EndFixMachine() override; + bool GetFixStatus() override; + + void StartSaveHuman() override; + void EndSaveHuman() override; + bool GetSaveStatus() override; + + bool Attack(double angle) override; + bool CarryHuman() override; + bool ReleaseHuman() override; + bool HangHuman() override; bool WaitThread() override { diff --git a/CAPI/API/include/utils.hpp b/CAPI/API/include/utils.hpp index a785837..1f5a5f9 100644 --- a/CAPI/API/include/utils.hpp +++ b/CAPI/API/include/utils.hpp @@ -272,6 +272,14 @@ namespace THUAI62Proto sendMsg.set_player_id(id); return sendMsg; } + + inline protobuf::AttackMsg THUAI62ProtobufAttack(double angle, int64_t id) + { + protobuf::AttackMsg attackMsg; + attackMsg.set_angle(angle); + attackMsg.set_player_id(id); + return attackMsg; + } } // namespace THUAI62Proto #endif \ No newline at end of file diff --git a/CAPI/API/src/API.cpp b/CAPI/API/src/API.cpp index 506c802..dd29eeb 100644 --- a/CAPI/API/src/API.cpp +++ b/CAPI/API/src/API.cpp @@ -10,26 +10,22 @@ std::future HumanAPI::Move(int64_t timeInMilliseconds, double angleInRadia std::future HumanAPI::MoveDown(int64_t timeInMilliseconds) { - return std::async(std::launch::async, [&]() - { return logic.Move(timeInMilliseconds, 0); }); + return Move(timeInMilliseconds, 0); } std::future HumanAPI::MoveRight(int64_t timeInMilliseconds) { - return std::async(std::launch::async, [&]() - { return logic.Move(timeInMilliseconds, PI * 0.5); }); + return Move(timeInMilliseconds, PI * 0.5); } std::future HumanAPI::MoveUp(int64_t timeInMilliseconds) { - return std::async(std::launch::async, [&]() - { return logic.Move(timeInMilliseconds, PI); }); + return Move(timeInMilliseconds, PI); } std::future HumanAPI::MoveLeft(int64_t timeInMilliseconds) { - return std::async(std::launch::async, [&]() - { return logic.Move(timeInMilliseconds, PI * 1.5); }); + return Move(timeInMilliseconds, PI * 1.5); } std::future ButcherAPI::Move(int64_t timeInMilliseconds, double angleInRadian) @@ -40,26 +36,22 @@ std::future ButcherAPI::Move(int64_t timeInMilliseconds, double angleInRad std::future ButcherAPI::MoveDown(int64_t timeInMilliseconds) { - return std::async(std::launch::async, [&]() - { return logic.Move(timeInMilliseconds, 0); }); + return Move(timeInMilliseconds, 0); } std::future ButcherAPI::MoveRight(int64_t timeInMilliseconds) { - return std::async(std::launch::async, [&]() - { return logic.Move(timeInMilliseconds, PI * 0.5); }); + return Move(timeInMilliseconds, PI * 0.5); } std::future ButcherAPI::MoveUp(int64_t timeInMilliseconds) { - return std::async(std::launch::async, [&]() - { return logic.Move(timeInMilliseconds, PI); }); + return Move(timeInMilliseconds, PI); } std::future ButcherAPI::MoveLeft(int64_t timeInMilliseconds) { - return std::async(std::launch::async, [&]() - { return logic.Move(timeInMilliseconds, PI * 1.5); }); + return Move(timeInMilliseconds, PI * 1.5); } std::future HumanAPI::PickProp(THUAI6::PropType prop) @@ -110,6 +102,30 @@ std::future ButcherAPI::SendMessage(int64_t toID, std::string message) { return logic.SendMessage(toID, message); }); } +std::future HumanAPI::HaveMessage() +{ + return std::async(std::launch::async, [&]() + { return logic.HaveMessage(); }); +} + +std::future ButcherAPI::HaveMessage() +{ + return std::async(std::launch::async, [&]() + { return logic.HaveMessage(); }); +} + +std::future> HumanAPI::GetMessage() +{ + return std::async(std::launch::async, [&]() + { return logic.GetMessage(); }); +} + +std::future> ButcherAPI::GetMessage() +{ + return std::async(std::launch::async, [&]() + { return logic.GetMessage(); }); +} + std::vector> HumanAPI::GetButcher() const { return logic.GetButchers(); @@ -120,16 +136,126 @@ std::vector> HumanAPI::GetHuman() const return logic.GetHumans(); } +std::vector> ButcherAPI::GetButcher() const +{ + return logic.GetButchers(); +} + +std::vector> ButcherAPI::GetHuman() const +{ + return logic.GetHumans(); +} + std::vector> HumanAPI::GetProps() const { return logic.GetProps(); } +std::vector> ButcherAPI::GetProps() const +{ + return logic.GetProps(); +} + std::vector> HumanAPI::GetFullMap() const { return logic.GetFullMap(); } +THUAI6::PlaceType HumanAPI::GetPlaceType(int32_t CellX, int32_t CellY) const +{ + return logic.GetPlaceType(CellX, CellY); +} + +THUAI6::PlaceType ButcherAPI::GetPlaceType(int32_t CellX, int32_t CellY) const +{ + return logic.GetPlaceType(CellX, CellY); +} + +std::vector> ButcherAPI::GetFullMap() const +{ + return logic.GetFullMap(); +} + +void HumanAPI::StartFixMachine() +{ + std::thread([&]() + { logic.StartFixMachine(); }) + .detach(); +} + +void HumanAPI::EndFixMachine() +{ + std::thread([&]() + { logic.EndFixMachine(); }) + .detach(); +} + +std::future HumanAPI::GetFixStatus() +{ + return std::async(std::launch::async, [&]() + { return logic.GetFixStatus(); }); +} + +void HumanAPI::StartSaveHuman() +{ + std::thread([&]() + { logic.StartSaveHuman(); }) + .detach(); +} + +void HumanAPI::EndSaveHuman() +{ + std::thread([&]() + { logic.EndSaveHuman(); }) + .detach(); +} + +std::future HumanAPI::GetSaveStatus() +{ + return std::async(std::launch::async, [&]() + { return logic.GetSaveStatus(); }); +} + +std::future HumanAPI::Escape() +{ + return std::async(std::launch::async, [&]() + { return logic.Escape(); }); +} + +std::shared_ptr HumanAPI::GetSelfInfo() const +{ + return logic.HumanGetSelfInfo(); +} + +std::future ButcherAPI::Attack(double angleInRadian) +{ + return std::async(std::launch::async, [&]() + { return logic.Attack(angleInRadian); }); +} + +std::future ButcherAPI::CarryHuman() +{ + return std::async(std::launch::async, [&]() + { return logic.CarryHuman(); }); +} + +std::future ButcherAPI::ReleaseHuman() +{ + return std::async(std::launch::async, [&]() + { return logic.ReleaseHuman(); }); +} + +std::future ButcherAPI::HangHuman() +{ + return std::async(std::launch::async, [&]() + { return logic.HangHuman(); }); +} + +std::shared_ptr ButcherAPI::GetSelfInfo() const +{ + return logic.ButcherGetSelfInfo(); +} + void HumanAPI::Play(IAI& ai) { ai.play(*this); diff --git a/CAPI/API/src/Communication.cpp b/CAPI/API/src/Communication.cpp index 3a0d83f..d1634fb 100644 --- a/CAPI/API/src/Communication.cpp +++ b/CAPI/API/src/Communication.cpp @@ -85,7 +85,7 @@ bool Communication::HaveMessage(int64_t playerID) return false; } -std::pair Communication::GetMessage(int64_t playerID) +std::pair Communication::GetMessage(int64_t playerID) { protobuf::MsgRes getMessageResult; ClientContext context; @@ -94,12 +94,12 @@ std::pair Communication::GetMessage(int64_t playerID) if (status.ok()) { if (getMessageResult.have_message()) - return std::make_pair(getMessageResult.message_received(), getMessageResult.from_player_id()); + return std::make_pair(getMessageResult.from_player_id(), getMessageResult.message_received()); else - return std::make_pair("", -1); + return std::make_pair(-1, ""); } else - return std::make_pair("", -1); + return std::make_pair(-1, ""); } bool Communication::Escape(int64_t playerID) @@ -114,6 +114,124 @@ bool Communication::Escape(int64_t playerID) return false; } +void Communication::FixMachine(int64_t playerID) +{ + protobuf::BoolRes fixMachineResult; + auto request = THUAI62Proto::THUAI62ProtobufID(playerID); + ClientContext context; + while (isFixing) + { + auto fixStream = THUAI6Stub->FixMachine(&context); + fixStream->Write(request); + fixStream->Read(&fixMachineResult); + if (!fixMachineResult.act_success()) + { + isFixing = false; + break; + } + std::this_thread::sleep_for(std::chrono::milliseconds(10)); // 防止巨量发信 + } +} + +void Communication::StartFixMachine(int64_t playerID) +{ + isFixing = true; + FixMachine(playerID); +} + +void Communication::EndFixMachine() +{ + isFixing = false; +} + +bool Communication::GetFixStatus() +{ + return isFixing; +} + +void Communication::SaveHuman(int64_t playerID) +{ + protobuf::BoolRes saveHumanResult; + auto request = THUAI62Proto::THUAI62ProtobufID(playerID); + ClientContext context; + while (isSaving) + { + auto saveStream = THUAI6Stub->SaveHuman(&context); + saveStream->Write(request); + saveStream->Read(&saveHumanResult); + if (!saveHumanResult.act_success()) + { + isSaving = false; + break; + } + std::this_thread::sleep_for(std::chrono::milliseconds(10)); // 防止巨量发信 + } +} + +void Communication::StartSaveHuman(int64_t playerID) +{ + isSaving = true; + SaveHuman(playerID); +} + +void Communication::EndSaveHuman() +{ + isSaving = false; +} + +bool Communication::GetSaveStatus() +{ + return isSaving; +} + +bool Communication::Attack(double angle, int64_t playerID) +{ + protobuf::BoolRes attackResult; + ClientContext context; + auto request = THUAI62Proto::THUAI62ProtobufAttack(angle, playerID); + auto status = THUAI6Stub->Attack(&context, request, &attackResult); + if (status.ok()) + return attackResult.act_success(); + else + return false; +} + +bool Communication::CarryHuman(int64_t playerID) +{ + protobuf::BoolRes carryHumanResult; + ClientContext context; + auto request = THUAI62Proto::THUAI62ProtobufID(playerID); + auto status = THUAI6Stub->CarryHuman(&context, request, &carryHumanResult); + if (status.ok()) + return carryHumanResult.act_success(); + else + return false; +} + +bool Communication::ReleaseHuman(int64_t playerID) +{ + protobuf::BoolRes releaseHumanResult; + ClientContext context; + auto request = THUAI62Proto::THUAI62ProtobufID(playerID); + auto status = THUAI6Stub->ReleaseHuman(&context, request, &releaseHumanResult); + if (status.ok()) + return releaseHumanResult.act_success(); + else + return false; +} + +bool Communication::HangHuman(int64_t playerID) +{ + protobuf::BoolRes hangHumanResult; + ClientContext context; + auto request = THUAI62Proto::THUAI62ProtobufID(playerID); + auto status = THUAI6Stub->HangHuman(&context, request, &hangHumanResult); + if (status.ok()) + return hangHumanResult.act_success(); + else + return false; +} + bool Communication::TryConnection(int64_t playerID) { protobuf::BoolRes reply; diff --git a/CAPI/API/src/logic.cpp b/CAPI/API/src/logic.cpp index 8acdcc4..3cb688a 100644 --- a/CAPI/API/src/logic.cpp +++ b/CAPI/API/src/logic.cpp @@ -62,121 +62,102 @@ std::vector> Logic::GetFullMap() const return currentState->gamemap; } +THUAI6::PlaceType Logic::GetPlaceType(int32_t CellX, int32_t CellY) const +{ + std::lock_guard lock(mtxState); + return currentState->gamemap[CellX][CellY]; +} + bool Logic::Move(int64_t time, double angle) { - // protobuf::MoveRes moveResult; - // ClientContext context; - // auto request = THUAI62Proto::THUAI62ProtobufMove(time, angle, playerID); - // auto status = THUAI6Stub->Move(&context, request, &moveResult); - // if (status.ok()) - // return moveResult.act_success(); - // else - // return false; return pComm->Move(time, angle, playerID); } bool Logic::PickProp(THUAI6::PropType prop) { - // protobuf::BoolRes pickPropResult; - // ClientContext context; - // auto request = THUAI62Proto::THUAI62ProtobufPick(prop, playerID); - // auto status = THUAI6Stub->PickProp(&context, request, &pickPropResult); - // if (status.ok()) - // return pickPropResult.act_success(); - // else - // return false; - return pComm->PickProp(prop, playerID); } bool Logic::UseProp() { - // protobuf::BoolRes usePropResult; - // ClientContext context; - // auto request = THUAI62Proto::THUAI62ProtobufID(playerID); - // auto status = THUAI6Stub->UseProp(&context, request, &usePropResult); - // if (status.ok()) - // return usePropResult.act_success(); - // else - // return false; return pComm->UseProp(playerID); } bool Logic::UseSkill() { - // protobuf::BoolRes useSkillResult; - // ClientContext context; - // auto request = THUAI62Proto::THUAI62ProtobufID(playerID); - // auto status = THUAI6Stub->UseSkill(&context, request, &useSkillResult); - // if (status.ok()) - // return useSkillResult.act_success(); - // else - // return false; - return pComm->UseSkill(playerID); } bool Logic::SendMessage(int64_t toID, std::string message) { - // protobuf::BoolRes sendMessageResult; - // ClientContext context; - // auto request = THUAI62Proto::THUAI62ProtobufSend(message, toID, playerID); - // auto status = THUAI6Stub->SendMessage(&context, request, &sendMessageResult); - // if (status.ok()) - // return sendMessageResult.act_success(); - // else - // return false; - return pComm->SendMessage(toID, message, playerID); } bool Logic::HaveMessage() { - // protobuf::BoolRes haveMessageResult; - // ClientContext context; - // auto request = THUAI62Proto::THUAI62ProtobufID(playerID); - // auto status = THUAI6Stub->HaveMessage(&context, request, &haveMessageResult); - // if (status.ok()) - // return haveMessageResult.act_success(); - // else - // return false; - return pComm->HaveMessage(playerID); } -std::pair Logic::GetMessage() +std::pair Logic::GetMessage() { - // protobuf::MsgRes getMessageResult; - // ClientContext context; - // auto request = THUAI62Proto::THUAI62ProtobufID(playerID); - // auto status = THUAI6Stub->GetMessage(&context, request, &getMessageResult); - // if (status.ok()) - // { - // if (getMessageResult.have_message()) - // return std::make_pair(getMessageResult.message_received(), getMessageResult.from_player_id()); - // else - // return std::make_pair("", -1); - // } - // else - // return std::make_pair("", -1); - return pComm->GetMessage(playerID); } bool Logic::Escape() { - // protobuf::BoolRes escapeResult; - // ClientContext context; - // auto request = THUAI62Proto::THUAI62ProtobufID(playerID); - // auto status = THUAI6Stub->Escape(&context, request, &escapeResult); - // if (status.ok()) - // return escapeResult.act_success(); - // else - // return false; - return pComm->Escape(playerID); } +void Logic::StartFixMachine() +{ + pComm->StartFixMachine(playerID); +} + +void Logic::EndFixMachine() +{ + pComm->EndFixMachine(); +} + +bool Logic::GetFixStatus() +{ + return pComm->GetFixStatus(); +} + +void Logic::StartSaveHuman() +{ + pComm->StartSaveHuman(playerID); +} + +void Logic::EndSaveHuman() +{ + pComm->EndSaveHuman(); +} + +bool Logic::GetSaveStatus() +{ + return pComm->GetSaveStatus(); +} + +bool Logic::Attack(double angle) +{ + return pComm->Attack(angle, playerID); +} + +bool Logic::CarryHuman() +{ + return pComm->CarryHuman(playerID); +} + +bool Logic::ReleaseHuman() +{ + return pComm->ReleaseHuman(playerID); +} + +bool Logic::HangHuman() +{ + return pComm->HangHuman(playerID); +} + void Logic::ProcessMessage() { auto messageThread = [&]() @@ -268,14 +249,6 @@ void Logic::PlayerWrapper(std::function player) bool Logic::TryConnection() { - // IDMsg request = THUAI62Proto::THUAI62ProtobufID(playerID); - // BoolRes reply; - // ClientContext context; - // auto status = THUAI6Stub->TryConnection(&context, request, &reply); - // if (status.ok()) - // return true; - // else - // return false; return pComm->TryConnection(playerID); }