You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

Communication.h 1.2 kB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef COMMUNICATION_H
  2. #define COMMUNICATION_H
  3. #include "Message2Server.pb.h"
  4. #include "Message2Clients.pb.h"
  5. #include "MessageType.pb.h"
  6. #include "Services.grpc.pb.h"
  7. #include "Services.pb.h"
  8. #include <grpcpp/grpcpp.h>
  9. #include "structures.h"
  10. class Logic;
  11. class Communication
  12. {
  13. public:
  14. Communication(std::string sIP, std::string sPort);
  15. ~Communication()
  16. {
  17. }
  18. bool Move(int64_t time, double angle, int64_t playerID);
  19. bool PickProp(THUAI6::PropType prop, int64_t playerID);
  20. bool UseProp(int64_t playerID);
  21. bool UseSkill(int64_t playerID);
  22. bool SendMessage(int64_t toID, std::string message, int64_t playerID);
  23. bool HaveMessage(int64_t playerID);
  24. std::pair<std::string, int64_t> GetMessage(int64_t playerID);
  25. bool Escape(int64_t playerID);
  26. bool TryConnection(int64_t playerID);
  27. protobuf::MessageToClient GetMessage2Client();
  28. bool HaveMessage2Client();
  29. void AddPlayer(int64_t playerID, THUAI6::PlayerType playerType, THUAI6::HumanType humanType, THUAI6::ButcherType butcherType);
  30. private:
  31. std::unique_ptr<protobuf::AvailableService::Stub> THUAI6Stub;
  32. bool haveNewMessage = false;
  33. protobuf::MessageToClient message2Client;
  34. };
  35. #endif