| @@ -1,3 +1,4 @@ | |||||
| # .vs, .vscode must be ignored | # .vs, .vscode must be ignored | ||||
| .vs/ | .vs/ | ||||
| .vscode/ | .vscode/ | ||||
| CAPI/build | |||||
| @@ -0,0 +1,27 @@ | |||||
| #pragma once | |||||
| #ifndef AI_H | |||||
| #define AI_H | |||||
| #include "API.h" | |||||
| // 暂定版本:Human和Butcher全部继承AI类, | |||||
| class IAI | |||||
| { | |||||
| public: | |||||
| IAI() | |||||
| { | |||||
| } | |||||
| virtual void play(IAPI& api) = 0; | |||||
| }; | |||||
| class AI : public IAI | |||||
| { | |||||
| public: | |||||
| AI() : | |||||
| IAI() | |||||
| { | |||||
| } | |||||
| void play(IAPI& api) override; | |||||
| }; | |||||
| #endif | |||||
| @@ -0,0 +1,247 @@ | |||||
| #pragma once | |||||
| #ifndef API_H | |||||
| #define API_H | |||||
| #ifdef _MSC_VER | |||||
| #pragma warning(disable : 4996) | |||||
| #endif | |||||
| #include <Message2Server.pb.h> | |||||
| #include <Message2Clients.pb.h> | |||||
| #include <MessageType.pb.h> | |||||
| #include <Message2Server.grpc.pb.h> | |||||
| #include <Message2Clients.grpc.pb.h> | |||||
| #include <MessageType.grpc.pb.h> | |||||
| #include <future> | |||||
| #include <iostream> | |||||
| #include <vector> | |||||
| #include "structures.h" | |||||
| const constexpr int num_of_grid_per_cell = 1000; | |||||
| class ILogic | |||||
| { | |||||
| // API中依赖Logic的部分 | |||||
| public: | |||||
| // 获取服务器发来的所有消息,要注意线程安全问题 | |||||
| virtual protobuf::MessageToClient GetFullMessage() = 0; | |||||
| // 供IAPI使用的操作相关的部分 | |||||
| virtual bool Move(protobuf::MoveMsg) = 0; | |||||
| virtual bool PickProp(protobuf::PickMsg) = 0; | |||||
| virtual bool UseProp(protobuf::IDMsg) = 0; | |||||
| virtual bool UseSkill(protobuf::IDMsg) = 0; | |||||
| virtual void SendMessage(protobuf::SendMsg) = 0; | |||||
| virtual bool HaveMessage(protobuf::IDMsg) = 0; | |||||
| virtual protobuf::MsgRes GetMessage(protobuf::IDMsg) = 0; | |||||
| virtual bool Escape(protobuf::IDMsg) = 0; | |||||
| // 说明:双向stream由三个函数共同实现,两个记录开始和结束,结果由Logic里的私有的成员变量记录,获得返回值则另调函数 | |||||
| virtual bool StartFixMachine(protobuf::IDMsg) = 0; | |||||
| virtual bool EndFixMachine(protobuf::IDMsg) = 0; | |||||
| virtual bool GetFixStatus() = 0; | |||||
| virtual bool StartSaveHuman(protobuf::IDMsg) = 0; | |||||
| virtual bool EndSaveHuman(protobuf::IDMsg) = 0; | |||||
| virtual bool GetSaveStatus() = 0; | |||||
| virtual bool Attack(protobuf::AttackMsg) = 0; | |||||
| virtual bool CarryHuman(protobuf::IDMsg) = 0; | |||||
| virtual bool ReleaseHuman(protobuf::IDMsg) = 0; | |||||
| virtual bool HangHuman(protobuf::IDMsg) = 0; | |||||
| virtual bool WaitThread() = 0; | |||||
| virtual int GetCounter() = 0; | |||||
| }; | |||||
| class IAPI | |||||
| { | |||||
| public: | |||||
| // 选手可执行的操作,应当保证所有函数的返回值都应当为std::future,例如下面的移动函数: | |||||
| // 指挥本角色进行移动,`timeInMilliseconds` 为移动时间,单位为毫秒;`angleInRadian` 表示移动的方向,单位是弧度,使用极坐标——竖直向下方向为 x 轴,水平向右方向为 y 轴 | |||||
| virtual std::future<bool> Move(uint32_t timeInMilliseconds, double angleInRadian) = 0; | |||||
| // 向特定方向移动 | |||||
| virtual std::future<bool> MoveRight(uint32_t timeInMilliseconds) = 0; | |||||
| virtual std::future<bool> MoveUp(uint32_t timeInMilliseconds) = 0; | |||||
| virtual std::future<bool> MoveLeft(uint32_t timeInMilliseconds) = 0; | |||||
| virtual std::future<bool> MoveDown(uint32_t timeInMilliseconds) = 0; | |||||
| // 捡道具、使用技能 | |||||
| virtual std::future<bool> PickProp() = 0; | |||||
| virtual std::future<bool> UseProp() = 0; | |||||
| virtual std::future<bool> UseSkill() = 0; | |||||
| // 发送信息、接受信息 | |||||
| virtual std::future<bool> SendMessage(int, std::string) = 0; | |||||
| [[nodiscard]] virtual std::future<bool> HaveMessage() = 0; | |||||
| [[nodiscard]] virtual std::future<std::pair<int, std::string>> GetMessage() = 0; | |||||
| // 等待下一帧 | |||||
| virtual std::future<bool> Wait() = 0; | |||||
| // 获取视野内可见的人类/屠夫的信息 | |||||
| [[nodiscard]] virtual std::vector<std::shared_ptr<const THUAI6::Human>> GetHuman() const = 0; | |||||
| [[nodiscard]] virtual std::vector<std::shared_ptr<const THUAI6::Buthcer>> GetButcher() const = 0; | |||||
| // 获取视野内可见的道具信息 | |||||
| [[nodiscard]] virtual std::vector<std::shared_ptr<const THUAI6::Prop>> GetProps() const = 0; | |||||
| // 获取地图信息,视野外的地图统一为Land | |||||
| [[nodiscard]] virtual std::array<std::array<THUAI6::PlaceType, 50>, 50> GetFullMap() const = 0; | |||||
| [[nodiscard]] virtual THUAI6::PlaceType GetPlaceType(int32_t CellX, int32_t CellY) const = 0; | |||||
| // 获取所有玩家的GUID | |||||
| [[nodiscard]] virtual const std::vector<int64_t> GetPlayerGUIDs() const = 0; | |||||
| // 获取游戏目前所进行的帧数 | |||||
| [[nodiscard]] virtual int GetFrameCount() const = 0; | |||||
| /*****人类阵营的特定函数*****/ | |||||
| virtual std::future<bool> StartFixMachine() = 0; | |||||
| virtual std::future<bool> EndFixMachine() = 0; | |||||
| virtual std::future<bool> GetFixStatus() = 0; | |||||
| virtual std::future<bool> StartSaveHuman() = 0; | |||||
| virtual std::future<bool> EndSaveHuman() = 0; | |||||
| virtual std::future<bool> GetSaveStatus() = 0; | |||||
| virtual std::future<bool> Escape() = 0; | |||||
| [[nodiscard]] virtual std::shared_ptr<const THUAI6::Human> HumanGetSelfInfo() const = 0; | |||||
| /*****屠夫阵营的特定函数*****/ | |||||
| virtual std::future<bool> Attack(double angleInRadian) = 0; | |||||
| virtual std::future<bool> CarryHuman() = 0; | |||||
| virtual std::future<bool> ReleaseHuman() = 0; | |||||
| virtual std::future<bool> HangHuman() = 0; | |||||
| [[nodiscard]] virtual std::shared_ptr<const THUAI6::Buthcer> ButcherGetSelfInfo() const = 0; | |||||
| /*****选手可能用的辅助函数*****/ | |||||
| // 获取指定格子中心的坐标 | |||||
| [[nodiscard]] static inline int CellToGrid(int cell) noexcept | |||||
| { | |||||
| return cell * num_of_grid_per_cell + num_of_grid_per_cell / 2; | |||||
| } | |||||
| // 获取指定坐标点所位于的格子的 X 序号 | |||||
| [[nodiscard]] static inline int GridToCell(int grid) noexcept | |||||
| { | |||||
| return grid / num_of_grid_per_cell; | |||||
| } | |||||
| IAPI(ILogic& logic) : | |||||
| logic(logic) | |||||
| { | |||||
| } | |||||
| virtual ~IAPI() | |||||
| { | |||||
| } | |||||
| protected: | |||||
| ILogic& logic; | |||||
| }; | |||||
| // 给Logic使用的IAPI接口,为了保证面向对象的设计模式 | |||||
| class IAPIForLogic : public IAPI | |||||
| { | |||||
| public: | |||||
| IAPIForLogic(ILogic& logic) : | |||||
| IAPI(logic) | |||||
| { | |||||
| } | |||||
| virtual void StartTimer() = 0; | |||||
| virtual void EndTimer() = 0; | |||||
| }; | |||||
| class HumanAPI : public IAPIForLogic | |||||
| { | |||||
| public: | |||||
| HumanAPI(ILogic& logic) : | |||||
| IAPIForLogic(logic) | |||||
| { | |||||
| } | |||||
| }; | |||||
| class ButcherAPI : public IAPIForLogic | |||||
| { | |||||
| public: | |||||
| ButcherAPI(ILogic& logic) : | |||||
| IAPIForLogic(logic) | |||||
| { | |||||
| } | |||||
| }; | |||||
| // class IHumanAPI : public IAPIForLogic | |||||
| // { | |||||
| // public: | |||||
| // IHumanAPI(ILogic& logic) : | |||||
| // IAPIForLogic(logic) | |||||
| // { | |||||
| // } | |||||
| // virtual std::future<bool> StartFixMachine() = 0; | |||||
| // virtual std::future<bool> EndFixMachine() = 0; | |||||
| // virtual std::future<bool> GetFixStatus() = 0; | |||||
| // virtual std::future<bool> StartSaveHuman() = 0; | |||||
| // virtual std::future<bool> EndSaveHuman() = 0; | |||||
| // virtual std::future<bool> GetSaveStatus() = 0; | |||||
| // virtual std::future<bool> Escape() = 0; | |||||
| // [[nodiscard]] virtual std::shared_ptr<const THUAI6::Human> GetSelfInfo() const = 0; | |||||
| // }; | |||||
| // class IButcherAPI : public IAPIForLogic | |||||
| // { | |||||
| // public: | |||||
| // IButcherAPI(Logic& logic) : | |||||
| // IAPIForLogic(logic) | |||||
| // { | |||||
| // } | |||||
| // virtual std::future<bool> Attack(double angleInRadian) = 0; | |||||
| // virtual std::future<bool> CarryHuman() = 0; | |||||
| // virtual std::future<bool> ReleaseHuman() = 0; | |||||
| // virtual std::future<bool> HangHuman() = 0; | |||||
| // [[nodiscard]] virtual std::shared_ptr<const THUAI6::Buthcer> GetSelfInfo() const = 0; | |||||
| // }; | |||||
| // class HumanAPI : public IHumanAPI | |||||
| // { | |||||
| // public: | |||||
| // HumanAPI(Logic& logic) : | |||||
| // IHumanAPI(logic) | |||||
| // { | |||||
| // } | |||||
| // }; | |||||
| // class DebugHumanAPI : public IHumanAPI | |||||
| // { | |||||
| // public: | |||||
| // DebugHumanAPI(Logic& logic) : | |||||
| // IHumanAPI(logic) | |||||
| // { | |||||
| // } | |||||
| // }; | |||||
| // class ButhcerAPI : public IButcherAPI | |||||
| // { | |||||
| // public: | |||||
| // ButhcerAPI(Logic& logic) : | |||||
| // IButcherAPI(logic) | |||||
| // { | |||||
| // } | |||||
| // }; | |||||
| // class DebugButcherAPI : public IButcherAPI | |||||
| // { | |||||
| // public: | |||||
| // DebugButcherAPI(Logic& logic) : | |||||
| // IButcherAPI(logic) | |||||
| // { | |||||
| // } | |||||
| // }; | |||||
| #endif | |||||
| @@ -0,0 +1,8 @@ | |||||
| #pragma once | |||||
| #ifndef CONSTANTS_H | |||||
| #define CONSTANTS_H | |||||
| namespace Constants | |||||
| { | |||||
| } | |||||
| #endif | |||||
| @@ -0,0 +1,112 @@ | |||||
| #pragma once | |||||
| #ifndef LOGIC_H | |||||
| #define LOGIC_H | |||||
| #ifdef _MSC_VER | |||||
| #pragma warning(disable : 4996) | |||||
| #endif | |||||
| #include <iostream> | |||||
| #include <vector> | |||||
| #include <thread> | |||||
| #include <mutex> | |||||
| #include <condition_variable> | |||||
| #include <atomic> | |||||
| #include <Message2Server.pb.h> | |||||
| #include <Message2Clients.pb.h> | |||||
| #include <MessageType.pb.h> | |||||
| #include <Message2Server.grpc.pb.h> | |||||
| #include <Message2Clients.grpc.pb.h> | |||||
| #include <MessageType.grpc.pb.h> | |||||
| #include "API.h" | |||||
| #include "AI.h" | |||||
| // 封装了通信组件和对AI对象进行操作 | |||||
| class Logic : public ILogic | |||||
| { | |||||
| private: | |||||
| // gRPC客户端的stub,所有与服务端之间的通信操作都需要基于stub完成。 | |||||
| std::unique_ptr<Protobuf::AvailableService::Stub> THUAI6Stub; | |||||
| // ID、阵营记录 | |||||
| int playerID; | |||||
| THUAI6::PlayerType playerType; | |||||
| // 类型记录 | |||||
| THUAI6::HumanType humanType; | |||||
| THUAI6::ButcherType butcherType; | |||||
| // GUID信息 | |||||
| std::vector<int64_t> playerGUIDs; | |||||
| // THUAI5中的通信组件可以完全被我们的stub取代,故无须再写 | |||||
| std::unique_ptr<IAI> pAI; | |||||
| std::shared_ptr<IAPIForLogic> pAPI; | |||||
| std::thread tAI; | |||||
| mutable std::mutex mtxAI; | |||||
| mutable std::mutex mtxState; | |||||
| mutable std::mutex mtxBuffer; | |||||
| std::condition_variable cvBuffer; | |||||
| std::condition_variable cvAI; | |||||
| // 信息队列目前可能会不用?具体待定 | |||||
| // 存储状态,分别是现在的状态和缓冲区的状态。 | |||||
| State state[2]; | |||||
| State* currentState; | |||||
| State* bufferState; | |||||
| // 是否应该执行player() | |||||
| std::atomic_bool AILoop = true; | |||||
| // buffer是否更新完毕 | |||||
| bool bufferUpdated = true; | |||||
| // 是否可以启用当前状态 | |||||
| bool currentStateAccessed = false; | |||||
| // 是否应当启动AI | |||||
| bool AIStart = false; | |||||
| // 控制内容更新的变量 | |||||
| std::atomic_bool freshed = false; | |||||
| // 所有API中声明的函数都需要在此处重写,先暂时略过,等到之后具体实现时再考虑 | |||||
| // 执行AI线程 | |||||
| void PlayerWrapper(std::function<void()> player); | |||||
| // THUAI5中的一系列用于处理信息的函数可能也不会再用 | |||||
| // 将信息加载到buffer | |||||
| void LoadBuffer(std::shared_ptr<Protobuf::MessageToClient>); | |||||
| // 解锁状态更新线程 | |||||
| void UnBlockBuffer(); | |||||
| // 解锁AI线程 | |||||
| void UnBlockAI(); | |||||
| // 更新状态 | |||||
| void Update() noexcept; | |||||
| // 等待 | |||||
| void Wait() noexcept; | |||||
| public: | |||||
| // 构造函数还需要传更多参数,有待补充 | |||||
| Logic(std::shared_ptr<grpc::Channel> channel); | |||||
| ~Logic() = default; | |||||
| // Main函数同上 | |||||
| void Main(); | |||||
| }; | |||||
| #endif | |||||
| @@ -0,0 +1,27 @@ | |||||
| #pragma once | |||||
| #ifndef STATE_H | |||||
| #define STATE_H | |||||
| #include <vector> | |||||
| #include "structures.h" | |||||
| // 存储场上的状态 | |||||
| struct State | |||||
| { | |||||
| uint32_t teamScore; | |||||
| // 自身信息,根据playerType的不同,可以调用的值也不同。 | |||||
| std::shared_ptr<THUAI6::Human> humanSelf; | |||||
| std::shared_ptr<THUAI6::Butcher> butcherSelf; | |||||
| std::vector<std::shared_ptr<THUAI6::Human>> humans; | |||||
| std::vector<std::shared_ptr<THUAI6::Butcher>> butchers; | |||||
| std::vector<std::shared_ptr<THUAI6::Prop>> props; | |||||
| THUAI6::PlaceType gamemap[51][51]; | |||||
| std::vector<int64_t> guids; | |||||
| }; | |||||
| #endif | |||||
| @@ -0,0 +1,151 @@ | |||||
| #pragma once | |||||
| #ifndef STRUCTURES_H | |||||
| #define STRUCTURES_H | |||||
| #include <cstdint> | |||||
| #include <array> | |||||
| #include <map> | |||||
| namespace THUAI6 | |||||
| { | |||||
| // 所有NullXXXType均为错误类型,其余为可能出现的正常类型 | |||||
| // 位置标志 | |||||
| enum class PlaceType : unsigned char | |||||
| { | |||||
| NullPlaceType = 0, | |||||
| Land = 1, | |||||
| Wall = 2, | |||||
| Grass = 3, | |||||
| Machine = 4, | |||||
| Gate = 5, | |||||
| HiddenGate = 6, | |||||
| }; | |||||
| // 形状标志 | |||||
| enum class ShapeType : unsigned char | |||||
| { | |||||
| NullShapeType = 0, | |||||
| Circle = 1, | |||||
| Square = 2, | |||||
| }; | |||||
| // 道具类型 | |||||
| enum class PropType : unsigned char | |||||
| { | |||||
| NullPropType = 0, | |||||
| PropType1 = 1, | |||||
| PropType2 = 2, | |||||
| PropType3 = 3, | |||||
| PropType4 = 4, | |||||
| }; | |||||
| // 玩家类型 | |||||
| enum class PlayerType : unsigned char | |||||
| { | |||||
| NullPlayerType = 0, | |||||
| HumanPlayer = 1, | |||||
| ButcherType = 2, | |||||
| }; | |||||
| // 人类类型 | |||||
| enum class HumanType : unsigned char | |||||
| { | |||||
| NullHumanType = 0, | |||||
| HumanType1 = 1, | |||||
| HumanType2 = 2, | |||||
| HumanType3 = 3, | |||||
| HumanType4 = 4, | |||||
| }; | |||||
| // 屠夫类型 | |||||
| enum class ButcherType : unsigned char | |||||
| { | |||||
| NullButcherType = 0, | |||||
| ButcherType1 = 1, | |||||
| ButcherType2 = 2, | |||||
| ButcherType3 = 3, | |||||
| ButcherType4 = 4, | |||||
| }; | |||||
| // 人类Buff类型 | |||||
| enum class HumanBuffType : unsigned char | |||||
| { | |||||
| NullHumanBuffType = 0, | |||||
| HumanBuffType1 = 1, | |||||
| HumanBuffType2 = 2, | |||||
| HumanBuffType3 = 3, | |||||
| HumanBuffType4 = 4, | |||||
| }; | |||||
| // 玩家类 | |||||
| struct Player | |||||
| { | |||||
| int32_t x; // x坐标 | |||||
| int32_t y; // y坐标 | |||||
| uint32_t speed; // 移动速度 | |||||
| uint32_t viewRange; // 视野范围 | |||||
| uint64_t playerID; // 玩家ID | |||||
| uint64_t guid; // 全局唯一ID | |||||
| uint16_t radius; // 圆形物体的半径或正方形物体的内切圆半径 | |||||
| double timeUntilSkillAvailable; // 技能冷却时间 | |||||
| PlayerType playerType; // 玩家类型 | |||||
| PropType prop; // 手上的道具类型 | |||||
| PlaceType place; // 所处格子的类型 | |||||
| }; | |||||
| struct Human : public Player | |||||
| { | |||||
| bool onChair; // 是否被挂 | |||||
| bool onGround; // 是否倒地 | |||||
| uint32_t life; // 剩余生命(本次倒地之前还能承受的伤害) | |||||
| uint32_t hangedTime; // 被挂的次数 | |||||
| HumanType humanType; // 人类类型 | |||||
| std::vector<HumanBuffType> buff; // buff | |||||
| }; | |||||
| struct Butcher : public Player | |||||
| { | |||||
| uint32_t damage; // 攻击伤害 | |||||
| bool movable; // 是否处在攻击后摇中 | |||||
| ButcherType butcherType; // 屠夫类型 | |||||
| std::vector<ButcherBuffType> buff; // buff | |||||
| }; | |||||
| struct Prop | |||||
| { | |||||
| int32_t x; | |||||
| int32_t y; | |||||
| uint32_t size; | |||||
| uint64_t guid; | |||||
| PropType type; | |||||
| PlaceType place; | |||||
| double facingDirection; // 朝向 | |||||
| bool isMoving; | |||||
| }; | |||||
| // 仅供DEBUG使用,名称可改动 | |||||
| // 还没写完,后面待续 | |||||
| inline std::map<PlaceType, std::string> placeDict{ | |||||
| {PlaceType::NullPlaceType, "NullPlaceType"}, | |||||
| {PlaceType::Land, "Land"}, | |||||
| {PlaceType::Wall, "Wall"}, | |||||
| {PlaceType::Grass, "Grass"}, | |||||
| {PlaceType::Machine, "Machine"}, | |||||
| {PlaceType::Gate, "Gate"}, | |||||
| {PlaceType::HiddenGate, "HiddenGate"}, | |||||
| }; | |||||
| inline std::map<PropType, std::string> propDict{ | |||||
| {PropType::NullPropType, "NullPropType"}, | |||||
| }; | |||||
| } // namespace THUAI6 | |||||
| #endif | |||||
| @@ -0,0 +1,15 @@ | |||||
| #include <vector> | |||||
| #include <thread> | |||||
| #include "AI.h" | |||||
| // 选手必须定义该变量来选择自己的阵营 | |||||
| const THUAI6::PlayerType playerType = THUAI6::PlayerType::HumanPlayer; | |||||
| // 选手只需要定义两者中自己选中的那个即可,定义两个也不会有影响。 | |||||
| const THUAI6::ButcherType butcherType = THUAI6::ButcherType::ButcherType1; | |||||
| const THUAI6::HumanType humanType = THUAI6::HumanType::HumanType1; | |||||
| void AI::play(IAPI& api) | |||||
| { | |||||
| } | |||||
| @@ -0,0 +1,7 @@ | |||||
| #pragma once | |||||
| #include "logic.h" | |||||
| Logic::Logic(std::shared_ptr<grpc::Channel> channel) : | |||||
| THUAI6Stub(Protobuf::AvailableService::NewStub(channel)) | |||||
| { | |||||
| } | |||||
| @@ -0,0 +1,28 @@ | |||||
| # 临时CMakeLists,仅供本地调试用 | |||||
| cmake_minimum_required(VERSION 3.5) | |||||
| project(THUAI6_CAPI VERSION 1.0) | |||||
| set(CMAKE_CXX_STANDARD 17) | |||||
| set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -pthread") | |||||
| aux_source_directory(./API/src CPP_LIST) | |||||
| aux_source_directory(./proto PROTO_CPP_LIST) | |||||
| find_package(Protobuf CONFIG REQUIRED) | |||||
| find_package(gRPC CONFIG REQUIRED) | |||||
| message(STATUS "Using protobuf ${Protobuf_VERSION}") | |||||
| message(STATUS "Using gRPC ${gRPC_VERSION}") | |||||
| add_executable(capi ${CPP_LIST} ${PROTO_CPP_LIST}) | |||||
| target_include_directories(capi PUBLIC ${PROJECT_SOURCE_DIR}/proto ${PROJECT_SOURCE_DIR}/API/include) | |||||
| target_link_libraries(capi | |||||
| protobuf::libprotobuf | |||||
| gRPC::grpc | |||||
| gRPC::grpc++_reflection | |||||
| gRPC::grpc++ | |||||
| ) | |||||
| @@ -23,12 +23,15 @@ namespace protobuf | |||||
| { | { | ||||
| static const char* AvailableService_method_names[] = { | static const char* AvailableService_method_names[] = { | ||||
| "/protobuf.AvailableService/TryConnection", | |||||
| "/protobuf.AvailableService/AddPlayer", | "/protobuf.AvailableService/AddPlayer", | ||||
| "/protobuf.AvailableService/Move", | "/protobuf.AvailableService/Move", | ||||
| "/protobuf.AvailableService/PickProp", | "/protobuf.AvailableService/PickProp", | ||||
| "/protobuf.AvailableService/UseProp", | "/protobuf.AvailableService/UseProp", | ||||
| "/protobuf.AvailableService/UseSkill", | "/protobuf.AvailableService/UseSkill", | ||||
| "/protobuf.AvailableService/SendMessage", | "/protobuf.AvailableService/SendMessage", | ||||
| "/protobuf.AvailableService/HaveMessage", | |||||
| "/protobuf.AvailableService/GetMessage", | |||||
| "/protobuf.AvailableService/FixMachine", | "/protobuf.AvailableService/FixMachine", | ||||
| "/protobuf.AvailableService/SaveHuman", | "/protobuf.AvailableService/SaveHuman", | ||||
| "/protobuf.AvailableService/Attack", | "/protobuf.AvailableService/Attack", | ||||
| @@ -47,22 +50,53 @@ namespace protobuf | |||||
| AvailableService::Stub::Stub(const std::shared_ptr<::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) : | AvailableService::Stub::Stub(const std::shared_ptr<::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) : | ||||
| channel_(channel), | channel_(channel), | ||||
| rpcmethod_AddPlayer_(AvailableService_method_names[0], options.suffix_for_stats(), ::grpc::internal::RpcMethod::SERVER_STREAMING, channel), | |||||
| rpcmethod_Move_(AvailableService_method_names[1], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), | |||||
| rpcmethod_PickProp_(AvailableService_method_names[2], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), | |||||
| rpcmethod_UseProp_(AvailableService_method_names[3], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), | |||||
| rpcmethod_UseSkill_(AvailableService_method_names[4], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), | |||||
| rpcmethod_SendMessage_(AvailableService_method_names[5], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), | |||||
| rpcmethod_FixMachine_(AvailableService_method_names[6], options.suffix_for_stats(), ::grpc::internal::RpcMethod::BIDI_STREAMING, channel), | |||||
| rpcmethod_SaveHuman_(AvailableService_method_names[7], options.suffix_for_stats(), ::grpc::internal::RpcMethod::BIDI_STREAMING, channel), | |||||
| rpcmethod_Attack_(AvailableService_method_names[8], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), | |||||
| rpcmethod_CarryHuman_(AvailableService_method_names[9], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), | |||||
| rpcmethod_ReleaseHuman_(AvailableService_method_names[10], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), | |||||
| rpcmethod_HangHuman_(AvailableService_method_names[11], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), | |||||
| rpcmethod_Escape_(AvailableService_method_names[12], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel) | |||||
| rpcmethod_TryConnection_(AvailableService_method_names[0], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), | |||||
| rpcmethod_AddPlayer_(AvailableService_method_names[1], options.suffix_for_stats(), ::grpc::internal::RpcMethod::SERVER_STREAMING, channel), | |||||
| rpcmethod_Move_(AvailableService_method_names[2], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), | |||||
| rpcmethod_PickProp_(AvailableService_method_names[3], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), | |||||
| rpcmethod_UseProp_(AvailableService_method_names[4], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), | |||||
| rpcmethod_UseSkill_(AvailableService_method_names[5], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), | |||||
| rpcmethod_SendMessage_(AvailableService_method_names[6], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), | |||||
| rpcmethod_HaveMessage_(AvailableService_method_names[7], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), | |||||
| rpcmethod_GetMessage_(AvailableService_method_names[8], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), | |||||
| rpcmethod_FixMachine_(AvailableService_method_names[9], options.suffix_for_stats(), ::grpc::internal::RpcMethod::BIDI_STREAMING, channel), | |||||
| rpcmethod_SaveHuman_(AvailableService_method_names[10], options.suffix_for_stats(), ::grpc::internal::RpcMethod::BIDI_STREAMING, channel), | |||||
| rpcmethod_Attack_(AvailableService_method_names[11], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), | |||||
| rpcmethod_CarryHuman_(AvailableService_method_names[12], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), | |||||
| rpcmethod_ReleaseHuman_(AvailableService_method_names[13], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), | |||||
| rpcmethod_HangHuman_(AvailableService_method_names[14], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), | |||||
| rpcmethod_Escape_(AvailableService_method_names[15], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel) | |||||
| { | { | ||||
| } | } | ||||
| ::grpc::Status AvailableService::Stub::TryConnection(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::protobuf::BoolRes* response) | |||||
| { | |||||
| return ::grpc::internal::BlockingUnaryCall<::protobuf::IDMsg, ::protobuf::BoolRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_TryConnection_, context, request, response); | |||||
| } | |||||
| void AvailableService::Stub::async::TryConnection(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, std::function<void(::grpc::Status)> f) | |||||
| { | |||||
| ::grpc::internal::CallbackUnaryCall<::protobuf::IDMsg, ::protobuf::BoolRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_TryConnection_, context, request, response, std::move(f)); | |||||
| } | |||||
| void AvailableService::Stub::async::TryConnection(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) | |||||
| { | |||||
| ::grpc::internal::ClientCallbackUnaryFactory::Create<::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_TryConnection_, context, request, response, reactor); | |||||
| } | |||||
| ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AvailableService::Stub::PrepareAsyncTryConnectionRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) | |||||
| { | |||||
| return ::grpc::internal::ClientAsyncResponseReaderHelper::Create<::protobuf::BoolRes, ::protobuf::IDMsg, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_TryConnection_, context, request); | |||||
| } | |||||
| ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AvailableService::Stub::AsyncTryConnectionRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) | |||||
| { | |||||
| auto* result = | |||||
| this->PrepareAsyncTryConnectionRaw(context, request, cq); | |||||
| result->StartCall(); | |||||
| return result; | |||||
| } | |||||
| ::grpc::ClientReader<::protobuf::MessageToClient>* AvailableService::Stub::AddPlayerRaw(::grpc::ClientContext* context, const ::protobuf::PlayerMsg& request) | ::grpc::ClientReader<::protobuf::MessageToClient>* AvailableService::Stub::AddPlayerRaw(::grpc::ClientContext* context, const ::protobuf::PlayerMsg& request) | ||||
| { | { | ||||
| return ::grpc::internal::ClientReaderFactory<::protobuf::MessageToClient>::Create(channel_.get(), rpcmethod_AddPlayer_, context, request); | return ::grpc::internal::ClientReaderFactory<::protobuf::MessageToClient>::Create(channel_.get(), rpcmethod_AddPlayer_, context, request); | ||||
| @@ -223,6 +257,62 @@ namespace protobuf | |||||
| return result; | return result; | ||||
| } | } | ||||
| ::grpc::Status AvailableService::Stub::HaveMessage(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::protobuf::BoolRes* response) | |||||
| { | |||||
| return ::grpc::internal::BlockingUnaryCall<::protobuf::IDMsg, ::protobuf::BoolRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_HaveMessage_, context, request, response); | |||||
| } | |||||
| void AvailableService::Stub::async::HaveMessage(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, std::function<void(::grpc::Status)> f) | |||||
| { | |||||
| ::grpc::internal::CallbackUnaryCall<::protobuf::IDMsg, ::protobuf::BoolRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_HaveMessage_, context, request, response, std::move(f)); | |||||
| } | |||||
| void AvailableService::Stub::async::HaveMessage(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) | |||||
| { | |||||
| ::grpc::internal::ClientCallbackUnaryFactory::Create<::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_HaveMessage_, context, request, response, reactor); | |||||
| } | |||||
| ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AvailableService::Stub::PrepareAsyncHaveMessageRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) | |||||
| { | |||||
| return ::grpc::internal::ClientAsyncResponseReaderHelper::Create<::protobuf::BoolRes, ::protobuf::IDMsg, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_HaveMessage_, context, request); | |||||
| } | |||||
| ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AvailableService::Stub::AsyncHaveMessageRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) | |||||
| { | |||||
| auto* result = | |||||
| this->PrepareAsyncHaveMessageRaw(context, request, cq); | |||||
| result->StartCall(); | |||||
| return result; | |||||
| } | |||||
| ::grpc::Status AvailableService::Stub::GetMessage(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::protobuf::MsgRes* response) | |||||
| { | |||||
| return ::grpc::internal::BlockingUnaryCall<::protobuf::IDMsg, ::protobuf::MsgRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_GetMessage_, context, request, response); | |||||
| } | |||||
| void AvailableService::Stub::async::GetMessage(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::MsgRes* response, std::function<void(::grpc::Status)> f) | |||||
| { | |||||
| ::grpc::internal::CallbackUnaryCall<::protobuf::IDMsg, ::protobuf::MsgRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_GetMessage_, context, request, response, std::move(f)); | |||||
| } | |||||
| void AvailableService::Stub::async::GetMessage(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::MsgRes* response, ::grpc::ClientUnaryReactor* reactor) | |||||
| { | |||||
| ::grpc::internal::ClientCallbackUnaryFactory::Create<::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_GetMessage_, context, request, response, reactor); | |||||
| } | |||||
| ::grpc::ClientAsyncResponseReader<::protobuf::MsgRes>* AvailableService::Stub::PrepareAsyncGetMessageRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) | |||||
| { | |||||
| return ::grpc::internal::ClientAsyncResponseReaderHelper::Create<::protobuf::MsgRes, ::protobuf::IDMsg, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_GetMessage_, context, request); | |||||
| } | |||||
| ::grpc::ClientAsyncResponseReader<::protobuf::MsgRes>* AvailableService::Stub::AsyncGetMessageRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) | |||||
| { | |||||
| auto* result = | |||||
| this->PrepareAsyncGetMessageRaw(context, request, cq); | |||||
| result->StartCall(); | |||||
| return result; | |||||
| } | |||||
| ::grpc::ClientReaderWriter<::protobuf::IDMsg, ::protobuf::BoolRes>* AvailableService::Stub::FixMachineRaw(::grpc::ClientContext* context) | ::grpc::ClientReaderWriter<::protobuf::IDMsg, ::protobuf::BoolRes>* AvailableService::Stub::FixMachineRaw(::grpc::ClientContext* context) | ||||
| { | { | ||||
| return ::grpc::internal::ClientReaderWriterFactory<::protobuf::IDMsg, ::protobuf::BoolRes>::Create(channel_.get(), rpcmethod_FixMachine_, context); | return ::grpc::internal::ClientReaderWriterFactory<::protobuf::IDMsg, ::protobuf::BoolRes>::Create(channel_.get(), rpcmethod_FixMachine_, context); | ||||
| @@ -407,6 +497,20 @@ namespace protobuf | |||||
| { | { | ||||
| AddMethod(new ::grpc::internal::RpcServiceMethod( | AddMethod(new ::grpc::internal::RpcServiceMethod( | ||||
| AvailableService_method_names[0], | AvailableService_method_names[0], | ||||
| ::grpc::internal::RpcMethod::NORMAL_RPC, | |||||
| new ::grpc::internal::RpcMethodHandler<AvailableService::Service, ::protobuf::IDMsg, ::protobuf::BoolRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( | |||||
| [](AvailableService::Service* service, | |||||
| ::grpc::ServerContext* ctx, | |||||
| const ::protobuf::IDMsg* req, | |||||
| ::protobuf::BoolRes* resp) | |||||
| { | |||||
| return service->TryConnection(ctx, req, resp); | |||||
| }, | |||||
| this | |||||
| ) | |||||
| )); | |||||
| AddMethod(new ::grpc::internal::RpcServiceMethod( | |||||
| AvailableService_method_names[1], | |||||
| ::grpc::internal::RpcMethod::SERVER_STREAMING, | ::grpc::internal::RpcMethod::SERVER_STREAMING, | ||||
| new ::grpc::internal::ServerStreamingHandler<AvailableService::Service, ::protobuf::PlayerMsg, ::protobuf::MessageToClient>( | new ::grpc::internal::ServerStreamingHandler<AvailableService::Service, ::protobuf::PlayerMsg, ::protobuf::MessageToClient>( | ||||
| [](AvailableService::Service* service, | [](AvailableService::Service* service, | ||||
| @@ -420,7 +524,7 @@ namespace protobuf | |||||
| ) | ) | ||||
| )); | )); | ||||
| AddMethod(new ::grpc::internal::RpcServiceMethod( | AddMethod(new ::grpc::internal::RpcServiceMethod( | ||||
| AvailableService_method_names[1], | |||||
| AvailableService_method_names[2], | |||||
| ::grpc::internal::RpcMethod::NORMAL_RPC, | ::grpc::internal::RpcMethod::NORMAL_RPC, | ||||
| new ::grpc::internal::RpcMethodHandler<AvailableService::Service, ::protobuf::MoveMsg, ::protobuf::MoveRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( | new ::grpc::internal::RpcMethodHandler<AvailableService::Service, ::protobuf::MoveMsg, ::protobuf::MoveRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( | ||||
| [](AvailableService::Service* service, | [](AvailableService::Service* service, | ||||
| @@ -434,7 +538,7 @@ namespace protobuf | |||||
| ) | ) | ||||
| )); | )); | ||||
| AddMethod(new ::grpc::internal::RpcServiceMethod( | AddMethod(new ::grpc::internal::RpcServiceMethod( | ||||
| AvailableService_method_names[2], | |||||
| AvailableService_method_names[3], | |||||
| ::grpc::internal::RpcMethod::NORMAL_RPC, | ::grpc::internal::RpcMethod::NORMAL_RPC, | ||||
| new ::grpc::internal::RpcMethodHandler<AvailableService::Service, ::protobuf::PickMsg, ::protobuf::BoolRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( | new ::grpc::internal::RpcMethodHandler<AvailableService::Service, ::protobuf::PickMsg, ::protobuf::BoolRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( | ||||
| [](AvailableService::Service* service, | [](AvailableService::Service* service, | ||||
| @@ -448,7 +552,7 @@ namespace protobuf | |||||
| ) | ) | ||||
| )); | )); | ||||
| AddMethod(new ::grpc::internal::RpcServiceMethod( | AddMethod(new ::grpc::internal::RpcServiceMethod( | ||||
| AvailableService_method_names[3], | |||||
| AvailableService_method_names[4], | |||||
| ::grpc::internal::RpcMethod::NORMAL_RPC, | ::grpc::internal::RpcMethod::NORMAL_RPC, | ||||
| new ::grpc::internal::RpcMethodHandler<AvailableService::Service, ::protobuf::IDMsg, ::protobuf::BoolRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( | new ::grpc::internal::RpcMethodHandler<AvailableService::Service, ::protobuf::IDMsg, ::protobuf::BoolRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( | ||||
| [](AvailableService::Service* service, | [](AvailableService::Service* service, | ||||
| @@ -462,7 +566,7 @@ namespace protobuf | |||||
| ) | ) | ||||
| )); | )); | ||||
| AddMethod(new ::grpc::internal::RpcServiceMethod( | AddMethod(new ::grpc::internal::RpcServiceMethod( | ||||
| AvailableService_method_names[4], | |||||
| AvailableService_method_names[5], | |||||
| ::grpc::internal::RpcMethod::NORMAL_RPC, | ::grpc::internal::RpcMethod::NORMAL_RPC, | ||||
| new ::grpc::internal::RpcMethodHandler<AvailableService::Service, ::protobuf::IDMsg, ::protobuf::BoolRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( | new ::grpc::internal::RpcMethodHandler<AvailableService::Service, ::protobuf::IDMsg, ::protobuf::BoolRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( | ||||
| [](AvailableService::Service* service, | [](AvailableService::Service* service, | ||||
| @@ -476,7 +580,7 @@ namespace protobuf | |||||
| ) | ) | ||||
| )); | )); | ||||
| AddMethod(new ::grpc::internal::RpcServiceMethod( | AddMethod(new ::grpc::internal::RpcServiceMethod( | ||||
| AvailableService_method_names[5], | |||||
| AvailableService_method_names[6], | |||||
| ::grpc::internal::RpcMethod::NORMAL_RPC, | ::grpc::internal::RpcMethod::NORMAL_RPC, | ||||
| new ::grpc::internal::RpcMethodHandler<AvailableService::Service, ::protobuf::SendMsg, ::protobuf::BoolRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( | new ::grpc::internal::RpcMethodHandler<AvailableService::Service, ::protobuf::SendMsg, ::protobuf::BoolRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( | ||||
| [](AvailableService::Service* service, | [](AvailableService::Service* service, | ||||
| @@ -490,7 +594,35 @@ namespace protobuf | |||||
| ) | ) | ||||
| )); | )); | ||||
| AddMethod(new ::grpc::internal::RpcServiceMethod( | AddMethod(new ::grpc::internal::RpcServiceMethod( | ||||
| AvailableService_method_names[6], | |||||
| AvailableService_method_names[7], | |||||
| ::grpc::internal::RpcMethod::NORMAL_RPC, | |||||
| new ::grpc::internal::RpcMethodHandler<AvailableService::Service, ::protobuf::IDMsg, ::protobuf::BoolRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( | |||||
| [](AvailableService::Service* service, | |||||
| ::grpc::ServerContext* ctx, | |||||
| const ::protobuf::IDMsg* req, | |||||
| ::protobuf::BoolRes* resp) | |||||
| { | |||||
| return service->HaveMessage(ctx, req, resp); | |||||
| }, | |||||
| this | |||||
| ) | |||||
| )); | |||||
| AddMethod(new ::grpc::internal::RpcServiceMethod( | |||||
| AvailableService_method_names[8], | |||||
| ::grpc::internal::RpcMethod::NORMAL_RPC, | |||||
| new ::grpc::internal::RpcMethodHandler<AvailableService::Service, ::protobuf::IDMsg, ::protobuf::MsgRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( | |||||
| [](AvailableService::Service* service, | |||||
| ::grpc::ServerContext* ctx, | |||||
| const ::protobuf::IDMsg* req, | |||||
| ::protobuf::MsgRes* resp) | |||||
| { | |||||
| return service->GetMessage(ctx, req, resp); | |||||
| }, | |||||
| this | |||||
| ) | |||||
| )); | |||||
| AddMethod(new ::grpc::internal::RpcServiceMethod( | |||||
| AvailableService_method_names[9], | |||||
| ::grpc::internal::RpcMethod::BIDI_STREAMING, | ::grpc::internal::RpcMethod::BIDI_STREAMING, | ||||
| new ::grpc::internal::BidiStreamingHandler<AvailableService::Service, ::protobuf::IDMsg, ::protobuf::BoolRes>( | new ::grpc::internal::BidiStreamingHandler<AvailableService::Service, ::protobuf::IDMsg, ::protobuf::BoolRes>( | ||||
| [](AvailableService::Service* service, | [](AvailableService::Service* service, | ||||
| @@ -503,7 +635,7 @@ namespace protobuf | |||||
| ) | ) | ||||
| )); | )); | ||||
| AddMethod(new ::grpc::internal::RpcServiceMethod( | AddMethod(new ::grpc::internal::RpcServiceMethod( | ||||
| AvailableService_method_names[7], | |||||
| AvailableService_method_names[10], | |||||
| ::grpc::internal::RpcMethod::BIDI_STREAMING, | ::grpc::internal::RpcMethod::BIDI_STREAMING, | ||||
| new ::grpc::internal::BidiStreamingHandler<AvailableService::Service, ::protobuf::IDMsg, ::protobuf::BoolRes>( | new ::grpc::internal::BidiStreamingHandler<AvailableService::Service, ::protobuf::IDMsg, ::protobuf::BoolRes>( | ||||
| [](AvailableService::Service* service, | [](AvailableService::Service* service, | ||||
| @@ -516,7 +648,7 @@ namespace protobuf | |||||
| ) | ) | ||||
| )); | )); | ||||
| AddMethod(new ::grpc::internal::RpcServiceMethod( | AddMethod(new ::grpc::internal::RpcServiceMethod( | ||||
| AvailableService_method_names[8], | |||||
| AvailableService_method_names[11], | |||||
| ::grpc::internal::RpcMethod::NORMAL_RPC, | ::grpc::internal::RpcMethod::NORMAL_RPC, | ||||
| new ::grpc::internal::RpcMethodHandler<AvailableService::Service, ::protobuf::AttackMsg, ::protobuf::BoolRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( | new ::grpc::internal::RpcMethodHandler<AvailableService::Service, ::protobuf::AttackMsg, ::protobuf::BoolRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( | ||||
| [](AvailableService::Service* service, | [](AvailableService::Service* service, | ||||
| @@ -530,7 +662,7 @@ namespace protobuf | |||||
| ) | ) | ||||
| )); | )); | ||||
| AddMethod(new ::grpc::internal::RpcServiceMethod( | AddMethod(new ::grpc::internal::RpcServiceMethod( | ||||
| AvailableService_method_names[9], | |||||
| AvailableService_method_names[12], | |||||
| ::grpc::internal::RpcMethod::NORMAL_RPC, | ::grpc::internal::RpcMethod::NORMAL_RPC, | ||||
| new ::grpc::internal::RpcMethodHandler<AvailableService::Service, ::protobuf::IDMsg, ::protobuf::BoolRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( | new ::grpc::internal::RpcMethodHandler<AvailableService::Service, ::protobuf::IDMsg, ::protobuf::BoolRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( | ||||
| [](AvailableService::Service* service, | [](AvailableService::Service* service, | ||||
| @@ -544,7 +676,7 @@ namespace protobuf | |||||
| ) | ) | ||||
| )); | )); | ||||
| AddMethod(new ::grpc::internal::RpcServiceMethod( | AddMethod(new ::grpc::internal::RpcServiceMethod( | ||||
| AvailableService_method_names[10], | |||||
| AvailableService_method_names[13], | |||||
| ::grpc::internal::RpcMethod::NORMAL_RPC, | ::grpc::internal::RpcMethod::NORMAL_RPC, | ||||
| new ::grpc::internal::RpcMethodHandler<AvailableService::Service, ::protobuf::IDMsg, ::protobuf::BoolRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( | new ::grpc::internal::RpcMethodHandler<AvailableService::Service, ::protobuf::IDMsg, ::protobuf::BoolRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( | ||||
| [](AvailableService::Service* service, | [](AvailableService::Service* service, | ||||
| @@ -558,7 +690,7 @@ namespace protobuf | |||||
| ) | ) | ||||
| )); | )); | ||||
| AddMethod(new ::grpc::internal::RpcServiceMethod( | AddMethod(new ::grpc::internal::RpcServiceMethod( | ||||
| AvailableService_method_names[11], | |||||
| AvailableService_method_names[14], | |||||
| ::grpc::internal::RpcMethod::NORMAL_RPC, | ::grpc::internal::RpcMethod::NORMAL_RPC, | ||||
| new ::grpc::internal::RpcMethodHandler<AvailableService::Service, ::protobuf::IDMsg, ::protobuf::BoolRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( | new ::grpc::internal::RpcMethodHandler<AvailableService::Service, ::protobuf::IDMsg, ::protobuf::BoolRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( | ||||
| [](AvailableService::Service* service, | [](AvailableService::Service* service, | ||||
| @@ -572,7 +704,7 @@ namespace protobuf | |||||
| ) | ) | ||||
| )); | )); | ||||
| AddMethod(new ::grpc::internal::RpcServiceMethod( | AddMethod(new ::grpc::internal::RpcServiceMethod( | ||||
| AvailableService_method_names[12], | |||||
| AvailableService_method_names[15], | |||||
| ::grpc::internal::RpcMethod::NORMAL_RPC, | ::grpc::internal::RpcMethod::NORMAL_RPC, | ||||
| new ::grpc::internal::RpcMethodHandler<AvailableService::Service, ::protobuf::IDMsg, ::protobuf::BoolRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( | new ::grpc::internal::RpcMethodHandler<AvailableService::Service, ::protobuf::IDMsg, ::protobuf::BoolRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( | ||||
| [](AvailableService::Service* service, | [](AvailableService::Service* service, | ||||
| @@ -591,6 +723,14 @@ namespace protobuf | |||||
| { | { | ||||
| } | } | ||||
| ::grpc::Status AvailableService::Service::TryConnection(::grpc::ServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response) | |||||
| { | |||||
| (void)context; | |||||
| (void)request; | |||||
| (void)response; | |||||
| return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); | |||||
| } | |||||
| ::grpc::Status AvailableService::Service::AddPlayer(::grpc::ServerContext* context, const ::protobuf::PlayerMsg* request, ::grpc::ServerWriter<::protobuf::MessageToClient>* writer) | ::grpc::Status AvailableService::Service::AddPlayer(::grpc::ServerContext* context, const ::protobuf::PlayerMsg* request, ::grpc::ServerWriter<::protobuf::MessageToClient>* writer) | ||||
| { | { | ||||
| (void)context; | (void)context; | ||||
| @@ -639,6 +779,22 @@ namespace protobuf | |||||
| return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); | ||||
| } | } | ||||
| ::grpc::Status AvailableService::Service::HaveMessage(::grpc::ServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response) | |||||
| { | |||||
| (void)context; | |||||
| (void)request; | |||||
| (void)response; | |||||
| return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); | |||||
| } | |||||
| ::grpc::Status AvailableService::Service::GetMessage(::grpc::ServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::MsgRes* response) | |||||
| { | |||||
| (void)context; | |||||
| (void)request; | |||||
| (void)response; | |||||
| return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); | |||||
| } | |||||
| ::grpc::Status AvailableService::Service::FixMachine(::grpc::ServerContext* context, ::grpc::ServerReaderWriter<::protobuf::BoolRes, ::protobuf::IDMsg>* stream) | ::grpc::Status AvailableService::Service::FixMachine(::grpc::ServerContext* context, ::grpc::ServerReaderWriter<::protobuf::BoolRes, ::protobuf::IDMsg>* stream) | ||||
| { | { | ||||
| (void)context; | (void)context; | ||||
| @@ -114,7 +114,9 @@ namespace protobuf | |||||
| place_(0) | place_(0) | ||||
| , | , | ||||
| guid_(int64_t{0}) | |||||
| guid_(int64_t{0}), | |||||
| size_(0), | |||||
| is_moving_(false) | |||||
| { | { | ||||
| } | } | ||||
| struct MessageOfPropDefaultTypeInternal | struct MessageOfPropDefaultTypeInternal | ||||
| @@ -269,8 +271,31 @@ namespace protobuf | |||||
| }; | }; | ||||
| }; | }; | ||||
| PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT BoolResDefaultTypeInternal _BoolRes_default_instance_; | PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT BoolResDefaultTypeInternal _BoolRes_default_instance_; | ||||
| constexpr MsgRes::MsgRes( | |||||
| ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized | |||||
| ) : | |||||
| message_received_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string), | |||||
| from_player_id_(int64_t{0}), | |||||
| have_message_(false) | |||||
| { | |||||
| } | |||||
| struct MsgResDefaultTypeInternal | |||||
| { | |||||
| constexpr MsgResDefaultTypeInternal() : | |||||
| _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) | |||||
| { | |||||
| } | |||||
| ~MsgResDefaultTypeInternal() | |||||
| { | |||||
| } | |||||
| union | |||||
| { | |||||
| MsgRes _instance; | |||||
| }; | |||||
| }; | |||||
| PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT MsgResDefaultTypeInternal _MsgRes_default_instance_; | |||||
| } // namespace protobuf | } // namespace protobuf | ||||
| static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_Message2Clients_2eproto[9]; | |||||
| static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_Message2Clients_2eproto[10]; | |||||
| static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_Message2Clients_2eproto = nullptr; | static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_Message2Clients_2eproto = nullptr; | ||||
| static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_Message2Clients_2eproto = nullptr; | static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_Message2Clients_2eproto = nullptr; | ||||
| @@ -329,6 +354,8 @@ const uint32_t TableStruct_Message2Clients_2eproto::offsets[] PROTOBUF_SECTION_V | |||||
| PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfProp, facing_direction_), | PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfProp, facing_direction_), | ||||
| PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfProp, guid_), | PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfProp, guid_), | ||||
| PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfProp, place_), | PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfProp, place_), | ||||
| PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfProp, size_), | |||||
| PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfProp, is_moving_), | |||||
| ~0u, // no _has_bits_ | ~0u, // no _has_bits_ | ||||
| PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfPickedProp, _internal_metadata_), | PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfPickedProp, _internal_metadata_), | ||||
| ~0u, // no _extensions_ | ~0u, // no _extensions_ | ||||
| @@ -379,17 +406,27 @@ const uint32_t TableStruct_Message2Clients_2eproto::offsets[] PROTOBUF_SECTION_V | |||||
| ~0u, // no _weak_field_map_ | ~0u, // no _weak_field_map_ | ||||
| ~0u, // no _inlined_string_donated_ | ~0u, // no _inlined_string_donated_ | ||||
| PROTOBUF_FIELD_OFFSET(::protobuf::BoolRes, act_success_), | PROTOBUF_FIELD_OFFSET(::protobuf::BoolRes, act_success_), | ||||
| ~0u, // no _has_bits_ | |||||
| PROTOBUF_FIELD_OFFSET(::protobuf::MsgRes, _internal_metadata_), | |||||
| ~0u, // no _extensions_ | |||||
| ~0u, // no _oneof_case_ | |||||
| ~0u, // no _weak_field_map_ | |||||
| ~0u, // no _inlined_string_donated_ | |||||
| PROTOBUF_FIELD_OFFSET(::protobuf::MsgRes, have_message_), | |||||
| PROTOBUF_FIELD_OFFSET(::protobuf::MsgRes, from_player_id_), | |||||
| PROTOBUF_FIELD_OFFSET(::protobuf::MsgRes, message_received_), | |||||
| }; | }; | ||||
| static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { | static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { | ||||
| {0, -1, -1, sizeof(::protobuf::MessageOfHuman)}, | {0, -1, -1, sizeof(::protobuf::MessageOfHuman)}, | ||||
| {23, -1, -1, sizeof(::protobuf::MessageOfButcher)}, | {23, -1, -1, sizeof(::protobuf::MessageOfButcher)}, | ||||
| {42, -1, -1, sizeof(::protobuf::MessageOfProp)}, | {42, -1, -1, sizeof(::protobuf::MessageOfProp)}, | ||||
| {54, -1, -1, sizeof(::protobuf::MessageOfPickedProp)}, | |||||
| {65, -1, -1, sizeof(::protobuf::MessageOfMap_Row)}, | |||||
| {72, -1, -1, sizeof(::protobuf::MessageOfMap)}, | |||||
| {79, -1, -1, sizeof(::protobuf::MessageToClient)}, | |||||
| {89, -1, -1, sizeof(::protobuf::MoveRes)}, | |||||
| {97, -1, -1, sizeof(::protobuf::BoolRes)}, | |||||
| {56, -1, -1, sizeof(::protobuf::MessageOfPickedProp)}, | |||||
| {67, -1, -1, sizeof(::protobuf::MessageOfMap_Row)}, | |||||
| {74, -1, -1, sizeof(::protobuf::MessageOfMap)}, | |||||
| {81, -1, -1, sizeof(::protobuf::MessageToClient)}, | |||||
| {91, -1, -1, sizeof(::protobuf::MoveRes)}, | |||||
| {99, -1, -1, sizeof(::protobuf::BoolRes)}, | |||||
| {106, -1, -1, sizeof(::protobuf::MsgRes)}, | |||||
| }; | }; | ||||
| static ::PROTOBUF_NAMESPACE_ID::Message const* const file_default_instances[] = { | static ::PROTOBUF_NAMESPACE_ID::Message const* const file_default_instances[] = { | ||||
| @@ -402,6 +439,7 @@ static ::PROTOBUF_NAMESPACE_ID::Message const* const file_default_instances[] = | |||||
| reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::protobuf::_MessageToClient_default_instance_), | reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::protobuf::_MessageToClient_default_instance_), | ||||
| reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::protobuf::_MoveRes_default_instance_), | reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::protobuf::_MoveRes_default_instance_), | ||||
| reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::protobuf::_BoolRes_default_instance_), | reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::protobuf::_BoolRes_default_instance_), | ||||
| reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::protobuf::_MsgRes_default_instance_), | |||||
| }; | }; | ||||
| const char descriptor_table_protodef_Message2Clients_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = | const char descriptor_table_protodef_Message2Clients_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = | ||||
| @@ -425,41 +463,48 @@ const char descriptor_table_protodef_Message2Clients_2eproto[] PROTOBUF_SECTION_ | |||||
| " \001(\0162\025.protobuf.ButcherType\022\014\n\004guid\030\t \001(" | " \001(\0162\025.protobuf.ButcherType\022\014\n\004guid\030\t \001(" | ||||
| "\003\022\017\n\007movable\030\n \001(\010\022\020\n\010playerID\030\013 \001(\003\022\022\n\n" | "\003\022\017\n\007movable\030\n \001(\010\022\020\n\010playerID\030\013 \001(\003\022\022\n\n" | ||||
| "view_range\030\014 \001(\005\022\'\n\004buff\030\r \003(\0162\031.protobu" | "view_range\030\014 \001(\005\022\'\n\004buff\030\r \003(\0162\031.protobu" | ||||
| "f.ButcherBuffType\"\223\001\n\rMessageOfProp\022 \n\004t" | |||||
| "f.ButcherBuffType\"\264\001\n\rMessageOfProp\022 \n\004t" | |||||
| "ype\030\001 \001(\0162\022.protobuf.PropType\022\t\n\001x\030\002 \001(\005" | "ype\030\001 \001(\0162\022.protobuf.PropType\022\t\n\001x\030\002 \001(\005" | ||||
| "\022\t\n\001y\030\003 \001(\005\022\030\n\020facing_direction\030\004 \001(\001\022\014\n" | "\022\t\n\001y\030\003 \001(\005\022\030\n\020facing_direction\030\004 \001(\001\022\014\n" | ||||
| "\004guid\030\005 \001(\003\022\"\n\005place\030\006 \001(\0162\023.protobuf.Pl" | "\004guid\030\005 \001(\003\022\"\n\005place\030\006 \001(\0162\023.protobuf.Pl" | ||||
| "aceType\"{\n\023MessageOfPickedProp\022 \n\004type\030\001" | |||||
| " \001(\0162\022.protobuf.PropType\022\t\n\001x\030\002 \001(\005\022\t\n\001y" | |||||
| "\030\003 \001(\005\022\030\n\020facing_direction\030\004 \001(\001\022\022\n\nmapp" | |||||
| "ing_id\030\005 \001(\003\"`\n\014MessageOfMap\022\'\n\003row\030\002 \003(" | |||||
| "\0132\032.protobuf.MessageOfMap.Row\032\'\n\003Row\022 \n\003" | |||||
| "col\030\001 \003(\0162\023.protobuf.PlaceType\"\323\001\n\017Messa" | |||||
| "geToClient\022/\n\rhuman_message\030\001 \003(\0132\030.prot" | |||||
| "obuf.MessageOfHuman\0223\n\017butcher_message\030\002" | |||||
| " \003(\0132\032.protobuf.MessageOfButcher\022-\n\014prop" | |||||
| "_message\030\003 \003(\0132\027.protobuf.MessageOfProp\022" | |||||
| "+\n\013map_massage\030\004 \001(\0132\026.protobuf.MessageO" | |||||
| "fMap\"5\n\007MoveRes\022\024\n\014actual_speed\030\001 \001(\003\022\024\n" | |||||
| "\014actual_angle\030\002 \001(\001\"\036\n\007BoolRes\022\023\n\013act_su" | |||||
| "ccess\030\001 \001(\0102\247\005\n\020AvailableService\022=\n\tAddP" | |||||
| "layer\022\023.protobuf.PlayerMsg\032\031.protobuf.Me" | |||||
| "ssageToClient0\001\022,\n\004Move\022\021.protobuf.MoveM" | |||||
| "sg\032\021.protobuf.MoveRes\0220\n\010PickProp\022\021.prot" | |||||
| "obuf.PickMsg\032\021.protobuf.BoolRes\022-\n\007UsePr" | |||||
| "op\022\017.protobuf.IDMsg\032\021.protobuf.BoolRes\022." | |||||
| "\n\010UseSkill\022\017.protobuf.IDMsg\032\021.protobuf.B" | |||||
| "oolRes\0223\n\013SendMessage\022\021.protobuf.SendMsg" | |||||
| "\032\021.protobuf.BoolRes\0224\n\nFixMachine\022\017.prot" | |||||
| "obuf.IDMsg\032\021.protobuf.BoolRes(\0010\001\0223\n\tSav" | |||||
| "eHuman\022\017.protobuf.IDMsg\032\021.protobuf.BoolR" | |||||
| "es(\0010\001\0220\n\006Attack\022\023.protobuf.AttackMsg\032\021." | |||||
| "protobuf.BoolRes\0220\n\nCarryHuman\022\017.protobu" | |||||
| "f.IDMsg\032\021.protobuf.BoolRes\0222\n\014ReleaseHum" | |||||
| "an\022\017.protobuf.IDMsg\032\021.protobuf.BoolRes\022/" | |||||
| "\n\tHangHuman\022\017.protobuf.IDMsg\032\021.protobuf." | |||||
| "BoolRes\022,\n\006Escape\022\017.protobuf.IDMsg\032\021.pro" | |||||
| "tobuf.BoolResb\006proto3"; | |||||
| "aceType\022\014\n\004size\030\007 \001(\005\022\021\n\tis_moving\030\010 \001(\010" | |||||
| "\"{\n\023MessageOfPickedProp\022 \n\004type\030\001 \001(\0162\022." | |||||
| "protobuf.PropType\022\t\n\001x\030\002 \001(\005\022\t\n\001y\030\003 \001(\005\022" | |||||
| "\030\n\020facing_direction\030\004 \001(\001\022\022\n\nmapping_id\030" | |||||
| "\005 \001(\003\"`\n\014MessageOfMap\022\'\n\003row\030\002 \003(\0132\032.pro" | |||||
| "tobuf.MessageOfMap.Row\032\'\n\003Row\022 \n\003col\030\001 \003" | |||||
| "(\0162\023.protobuf.PlaceType\"\323\001\n\017MessageToCli" | |||||
| "ent\022/\n\rhuman_message\030\001 \003(\0132\030.protobuf.Me" | |||||
| "ssageOfHuman\0223\n\017butcher_message\030\002 \003(\0132\032." | |||||
| "protobuf.MessageOfButcher\022-\n\014prop_messag" | |||||
| "e\030\003 \003(\0132\027.protobuf.MessageOfProp\022+\n\013map_" | |||||
| "massage\030\004 \001(\0132\026.protobuf.MessageOfMap\"5\n" | |||||
| "\007MoveRes\022\024\n\014actual_speed\030\001 \001(\003\022\024\n\014actual" | |||||
| "_angle\030\002 \001(\001\"\036\n\007BoolRes\022\023\n\013act_success\030\001" | |||||
| " \001(\010\"P\n\006MsgRes\022\024\n\014have_message\030\001 \001(\010\022\026\n\016" | |||||
| "from_player_id\030\002 \001(\003\022\030\n\020message_received" | |||||
| "\030\003 \001(\t2\300\006\n\020AvailableService\0223\n\rTryConnec" | |||||
| "tion\022\017.protobuf.IDMsg\032\021.protobuf.BoolRes" | |||||
| "\022=\n\tAddPlayer\022\023.protobuf.PlayerMsg\032\031.pro" | |||||
| "tobuf.MessageToClient0\001\022,\n\004Move\022\021.protob" | |||||
| "uf.MoveMsg\032\021.protobuf.MoveRes\0220\n\010PickPro" | |||||
| "p\022\021.protobuf.PickMsg\032\021.protobuf.BoolRes\022" | |||||
| "-\n\007UseProp\022\017.protobuf.IDMsg\032\021.protobuf.B" | |||||
| "oolRes\022.\n\010UseSkill\022\017.protobuf.IDMsg\032\021.pr" | |||||
| "otobuf.BoolRes\0223\n\013SendMessage\022\021.protobuf" | |||||
| ".SendMsg\032\021.protobuf.BoolRes\0221\n\013HaveMessa" | |||||
| "ge\022\017.protobuf.IDMsg\032\021.protobuf.BoolRes\022/" | |||||
| "\n\nGetMessage\022\017.protobuf.IDMsg\032\020.protobuf" | |||||
| ".MsgRes\0224\n\nFixMachine\022\017.protobuf.IDMsg\032\021" | |||||
| ".protobuf.BoolRes(\0010\001\0223\n\tSaveHuman\022\017.pro" | |||||
| "tobuf.IDMsg\032\021.protobuf.BoolRes(\0010\001\0220\n\006At" | |||||
| "tack\022\023.protobuf.AttackMsg\032\021.protobuf.Boo" | |||||
| "lRes\0220\n\nCarryHuman\022\017.protobuf.IDMsg\032\021.pr" | |||||
| "otobuf.BoolRes\0222\n\014ReleaseHuman\022\017.protobu" | |||||
| "f.IDMsg\032\021.protobuf.BoolRes\022/\n\tHangHuman\022" | |||||
| "\017.protobuf.IDMsg\032\021.protobuf.BoolRes\022,\n\006E" | |||||
| "scape\022\017.protobuf.IDMsg\032\021.protobuf.BoolRe" | |||||
| "sb\006proto3"; | |||||
| static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable* const descriptor_table_Message2Clients_2eproto_deps[2] = { | static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable* const descriptor_table_Message2Clients_2eproto_deps[2] = { | ||||
| &::descriptor_table_Message2Server_2eproto, | &::descriptor_table_Message2Server_2eproto, | ||||
| &::descriptor_table_MessageType_2eproto, | &::descriptor_table_MessageType_2eproto, | ||||
| @@ -468,13 +513,13 @@ static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_Message2Cli | |||||
| const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_Message2Clients_2eproto = { | const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_Message2Clients_2eproto = { | ||||
| false, | false, | ||||
| false, | false, | ||||
| 2181, | |||||
| 2449, | |||||
| descriptor_table_protodef_Message2Clients_2eproto, | descriptor_table_protodef_Message2Clients_2eproto, | ||||
| "Message2Clients.proto", | "Message2Clients.proto", | ||||
| &descriptor_table_Message2Clients_2eproto_once, | &descriptor_table_Message2Clients_2eproto_once, | ||||
| descriptor_table_Message2Clients_2eproto_deps, | descriptor_table_Message2Clients_2eproto_deps, | ||||
| 2, | 2, | ||||
| 9, | |||||
| 10, | |||||
| schemas, | schemas, | ||||
| file_default_instances, | file_default_instances, | ||||
| TableStruct_Message2Clients_2eproto::offsets, | TableStruct_Message2Clients_2eproto::offsets, | ||||
| @@ -1836,13 +1881,13 @@ namespace protobuf | |||||
| ::PROTOBUF_NAMESPACE_ID::Message() | ::PROTOBUF_NAMESPACE_ID::Message() | ||||
| { | { | ||||
| _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); | _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); | ||||
| ::memcpy(&type_, &from.type_, static_cast<size_t>(reinterpret_cast<char*>(&guid_) - reinterpret_cast<char*>(&type_)) + sizeof(guid_)); | |||||
| ::memcpy(&type_, &from.type_, static_cast<size_t>(reinterpret_cast<char*>(&is_moving_) - reinterpret_cast<char*>(&type_)) + sizeof(is_moving_)); | |||||
| // @@protoc_insertion_point(copy_constructor:protobuf.MessageOfProp) | // @@protoc_insertion_point(copy_constructor:protobuf.MessageOfProp) | ||||
| } | } | ||||
| inline void MessageOfProp::SharedCtor() | inline void MessageOfProp::SharedCtor() | ||||
| { | { | ||||
| ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(reinterpret_cast<char*>(&type_) - reinterpret_cast<char*>(this)), 0, static_cast<size_t>(reinterpret_cast<char*>(&guid_) - reinterpret_cast<char*>(&type_)) + sizeof(guid_)); | |||||
| ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(reinterpret_cast<char*>(&type_) - reinterpret_cast<char*>(this)), 0, static_cast<size_t>(reinterpret_cast<char*>(&is_moving_) - reinterpret_cast<char*>(&type_)) + sizeof(is_moving_)); | |||||
| } | } | ||||
| MessageOfProp::~MessageOfProp() | MessageOfProp::~MessageOfProp() | ||||
| @@ -1879,7 +1924,7 @@ namespace protobuf | |||||
| // Prevent compiler warnings about cached_has_bits being unused | // Prevent compiler warnings about cached_has_bits being unused | ||||
| (void)cached_has_bits; | (void)cached_has_bits; | ||||
| ::memset(&type_, 0, static_cast<size_t>(reinterpret_cast<char*>(&guid_) - reinterpret_cast<char*>(&type_)) + sizeof(guid_)); | |||||
| ::memset(&type_, 0, static_cast<size_t>(reinterpret_cast<char*>(&is_moving_) - reinterpret_cast<char*>(&type_)) + sizeof(is_moving_)); | |||||
| _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); | _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); | ||||
| } | } | ||||
| @@ -1956,6 +2001,26 @@ namespace protobuf | |||||
| else | else | ||||
| goto handle_unusual; | goto handle_unusual; | ||||
| continue; | continue; | ||||
| // int32 size = 7; | |||||
| case 7: | |||||
| if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 56)) | |||||
| { | |||||
| size_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); | |||||
| CHK_(ptr); | |||||
| } | |||||
| else | |||||
| goto handle_unusual; | |||||
| continue; | |||||
| // bool is_moving = 8; | |||||
| case 8: | |||||
| if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 64)) | |||||
| { | |||||
| is_moving_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); | |||||
| CHK_(ptr); | |||||
| } | |||||
| else | |||||
| goto handle_unusual; | |||||
| continue; | |||||
| default: | default: | ||||
| goto handle_unusual; | goto handle_unusual; | ||||
| } // switch | } // switch | ||||
| @@ -2040,6 +2105,20 @@ namespace protobuf | |||||
| ); | ); | ||||
| } | } | ||||
| // int32 size = 7; | |||||
| if (this->_internal_size() != 0) | |||||
| { | |||||
| target = stream->EnsureSpace(target); | |||||
| target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(7, this->_internal_size(), target); | |||||
| } | |||||
| // bool is_moving = 8; | |||||
| if (this->_internal_is_moving() != 0) | |||||
| { | |||||
| target = stream->EnsureSpace(target); | |||||
| target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(8, this->_internal_is_moving(), target); | |||||
| } | |||||
| if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) | if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) | ||||
| { | { | ||||
| target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( | ||||
| @@ -2101,6 +2180,18 @@ namespace protobuf | |||||
| total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_guid()); | total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_guid()); | ||||
| } | } | ||||
| // int32 size = 7; | |||||
| if (this->_internal_size() != 0) | |||||
| { | |||||
| total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_size()); | |||||
| } | |||||
| // bool is_moving = 8; | |||||
| if (this->_internal_is_moving() != 0) | |||||
| { | |||||
| total_size += 1 + 1; | |||||
| } | |||||
| return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); | return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); | ||||
| } | } | ||||
| @@ -2154,6 +2245,14 @@ namespace protobuf | |||||
| { | { | ||||
| _internal_set_guid(from._internal_guid()); | _internal_set_guid(from._internal_guid()); | ||||
| } | } | ||||
| if (from._internal_size() != 0) | |||||
| { | |||||
| _internal_set_size(from._internal_size()); | |||||
| } | |||||
| if (from._internal_is_moving() != 0) | |||||
| { | |||||
| _internal_set_is_moving(from._internal_is_moving()); | |||||
| } | |||||
| _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); | _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); | ||||
| } | } | ||||
| @@ -2176,7 +2275,7 @@ namespace protobuf | |||||
| using std::swap; | using std::swap; | ||||
| _internal_metadata_.InternalSwap(&other->_internal_metadata_); | _internal_metadata_.InternalSwap(&other->_internal_metadata_); | ||||
| ::PROTOBUF_NAMESPACE_ID::internal::memswap< | ::PROTOBUF_NAMESPACE_ID::internal::memswap< | ||||
| PROTOBUF_FIELD_OFFSET(MessageOfProp, guid_) + sizeof(MessageOfProp::guid_) - PROTOBUF_FIELD_OFFSET(MessageOfProp, type_)>( | |||||
| PROTOBUF_FIELD_OFFSET(MessageOfProp, is_moving_) + sizeof(MessageOfProp::is_moving_) - PROTOBUF_FIELD_OFFSET(MessageOfProp, type_)>( | |||||
| reinterpret_cast<char*>(&type_), | reinterpret_cast<char*>(&type_), | ||||
| reinterpret_cast<char*>(&other->type_) | reinterpret_cast<char*>(&other->type_) | ||||
| ); | ); | ||||
| @@ -3831,6 +3930,311 @@ namespace protobuf | |||||
| ); | ); | ||||
| } | } | ||||
| // =================================================================== | |||||
| class MsgRes::_Internal | |||||
| { | |||||
| public: | |||||
| }; | |||||
| MsgRes::MsgRes(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned) : | |||||
| ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) | |||||
| { | |||||
| SharedCtor(); | |||||
| if (!is_message_owned) | |||||
| { | |||||
| RegisterArenaDtor(arena); | |||||
| } | |||||
| // @@protoc_insertion_point(arena_constructor:protobuf.MsgRes) | |||||
| } | |||||
| MsgRes::MsgRes(const MsgRes& from) : | |||||
| ::PROTOBUF_NAMESPACE_ID::Message() | |||||
| { | |||||
| _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); | |||||
| message_received_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); | |||||
| #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING | |||||
| message_received_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); | |||||
| #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING | |||||
| if (!from._internal_message_received().empty()) | |||||
| { | |||||
| message_received_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_message_received(), GetArenaForAllocation()); | |||||
| } | |||||
| ::memcpy(&from_player_id_, &from.from_player_id_, static_cast<size_t>(reinterpret_cast<char*>(&have_message_) - reinterpret_cast<char*>(&from_player_id_)) + sizeof(have_message_)); | |||||
| // @@protoc_insertion_point(copy_constructor:protobuf.MsgRes) | |||||
| } | |||||
| inline void MsgRes::SharedCtor() | |||||
| { | |||||
| message_received_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); | |||||
| #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING | |||||
| message_received_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); | |||||
| #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING | |||||
| ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(reinterpret_cast<char*>(&from_player_id_) - reinterpret_cast<char*>(this)), 0, static_cast<size_t>(reinterpret_cast<char*>(&have_message_) - reinterpret_cast<char*>(&from_player_id_)) + sizeof(have_message_)); | |||||
| } | |||||
| MsgRes::~MsgRes() | |||||
| { | |||||
| // @@protoc_insertion_point(destructor:protobuf.MsgRes) | |||||
| if (GetArenaForAllocation() != nullptr) | |||||
| return; | |||||
| SharedDtor(); | |||||
| _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); | |||||
| } | |||||
| inline void MsgRes::SharedDtor() | |||||
| { | |||||
| GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); | |||||
| message_received_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); | |||||
| } | |||||
| void MsgRes::ArenaDtor(void* object) | |||||
| { | |||||
| MsgRes* _this = reinterpret_cast<MsgRes*>(object); | |||||
| (void)_this; | |||||
| } | |||||
| void MsgRes::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) | |||||
| { | |||||
| } | |||||
| void MsgRes::SetCachedSize(int size) const | |||||
| { | |||||
| _cached_size_.Set(size); | |||||
| } | |||||
| void MsgRes::Clear() | |||||
| { | |||||
| // @@protoc_insertion_point(message_clear_start:protobuf.MsgRes) | |||||
| uint32_t cached_has_bits = 0; | |||||
| // Prevent compiler warnings about cached_has_bits being unused | |||||
| (void)cached_has_bits; | |||||
| message_received_.ClearToEmpty(); | |||||
| ::memset(&from_player_id_, 0, static_cast<size_t>(reinterpret_cast<char*>(&have_message_) - reinterpret_cast<char*>(&from_player_id_)) + sizeof(have_message_)); | |||||
| _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); | |||||
| } | |||||
| const char* MsgRes::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) | |||||
| { | |||||
| #define CHK_(x) \ | |||||
| if (PROTOBUF_PREDICT_FALSE(!(x))) \ | |||||
| goto failure | |||||
| while (!ctx->Done(&ptr)) | |||||
| { | |||||
| uint32_t tag; | |||||
| ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); | |||||
| switch (tag >> 3) | |||||
| { | |||||
| // bool have_message = 1; | |||||
| case 1: | |||||
| if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) | |||||
| { | |||||
| have_message_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); | |||||
| CHK_(ptr); | |||||
| } | |||||
| else | |||||
| goto handle_unusual; | |||||
| continue; | |||||
| // int64 from_player_id = 2; | |||||
| case 2: | |||||
| if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) | |||||
| { | |||||
| from_player_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); | |||||
| CHK_(ptr); | |||||
| } | |||||
| else | |||||
| goto handle_unusual; | |||||
| continue; | |||||
| // string message_received = 3; | |||||
| case 3: | |||||
| if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) | |||||
| { | |||||
| auto str = _internal_mutable_message_received(); | |||||
| ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); | |||||
| CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "protobuf.MsgRes.message_received")); | |||||
| CHK_(ptr); | |||||
| } | |||||
| else | |||||
| goto handle_unusual; | |||||
| continue; | |||||
| default: | |||||
| goto handle_unusual; | |||||
| } // switch | |||||
| handle_unusual: | |||||
| if ((tag == 0) || ((tag & 7) == 4)) | |||||
| { | |||||
| CHK_(ptr); | |||||
| ctx->SetLastTag(tag); | |||||
| goto message_done; | |||||
| } | |||||
| ptr = UnknownFieldParse( | |||||
| tag, | |||||
| _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), | |||||
| ptr, | |||||
| ctx | |||||
| ); | |||||
| CHK_(ptr != nullptr); | |||||
| } // while | |||||
| message_done: | |||||
| return ptr; | |||||
| failure: | |||||
| ptr = nullptr; | |||||
| goto message_done; | |||||
| #undef CHK_ | |||||
| } | |||||
| uint8_t* MsgRes::_InternalSerialize( | |||||
| uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream | |||||
| ) const | |||||
| { | |||||
| // @@protoc_insertion_point(serialize_to_array_start:protobuf.MsgRes) | |||||
| uint32_t cached_has_bits = 0; | |||||
| (void)cached_has_bits; | |||||
| // bool have_message = 1; | |||||
| if (this->_internal_have_message() != 0) | |||||
| { | |||||
| target = stream->EnsureSpace(target); | |||||
| target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(1, this->_internal_have_message(), target); | |||||
| } | |||||
| // int64 from_player_id = 2; | |||||
| if (this->_internal_from_player_id() != 0) | |||||
| { | |||||
| target = stream->EnsureSpace(target); | |||||
| target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(2, this->_internal_from_player_id(), target); | |||||
| } | |||||
| // string message_received = 3; | |||||
| if (!this->_internal_message_received().empty()) | |||||
| { | |||||
| ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( | |||||
| this->_internal_message_received().data(), static_cast<int>(this->_internal_message_received().length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, "protobuf.MsgRes.message_received" | |||||
| ); | |||||
| target = stream->WriteStringMaybeAliased( | |||||
| 3, this->_internal_message_received(), target | |||||
| ); | |||||
| } | |||||
| if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) | |||||
| { | |||||
| target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( | |||||
| _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream | |||||
| ); | |||||
| } | |||||
| // @@protoc_insertion_point(serialize_to_array_end:protobuf.MsgRes) | |||||
| return target; | |||||
| } | |||||
| size_t MsgRes::ByteSizeLong() const | |||||
| { | |||||
| // @@protoc_insertion_point(message_byte_size_start:protobuf.MsgRes) | |||||
| size_t total_size = 0; | |||||
| uint32_t cached_has_bits = 0; | |||||
| // Prevent compiler warnings about cached_has_bits being unused | |||||
| (void)cached_has_bits; | |||||
| // string message_received = 3; | |||||
| if (!this->_internal_message_received().empty()) | |||||
| { | |||||
| total_size += 1 + | |||||
| ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( | |||||
| this->_internal_message_received() | |||||
| ); | |||||
| } | |||||
| // int64 from_player_id = 2; | |||||
| if (this->_internal_from_player_id() != 0) | |||||
| { | |||||
| total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_from_player_id()); | |||||
| } | |||||
| // bool have_message = 1; | |||||
| if (this->_internal_have_message() != 0) | |||||
| { | |||||
| total_size += 1 + 1; | |||||
| } | |||||
| return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); | |||||
| } | |||||
| const ::PROTOBUF_NAMESPACE_ID::Message::ClassData MsgRes::_class_data_ = { | |||||
| ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, | |||||
| MsgRes::MergeImpl}; | |||||
| const ::PROTOBUF_NAMESPACE_ID::Message::ClassData* MsgRes::GetClassData() const | |||||
| { | |||||
| return &_class_data_; | |||||
| } | |||||
| void MsgRes::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from) | |||||
| { | |||||
| static_cast<MsgRes*>(to)->MergeFrom( | |||||
| static_cast<const MsgRes&>(from) | |||||
| ); | |||||
| } | |||||
| void MsgRes::MergeFrom(const MsgRes& from) | |||||
| { | |||||
| // @@protoc_insertion_point(class_specific_merge_from_start:protobuf.MsgRes) | |||||
| GOOGLE_DCHECK_NE(&from, this); | |||||
| uint32_t cached_has_bits = 0; | |||||
| (void)cached_has_bits; | |||||
| if (!from._internal_message_received().empty()) | |||||
| { | |||||
| _internal_set_message_received(from._internal_message_received()); | |||||
| } | |||||
| if (from._internal_from_player_id() != 0) | |||||
| { | |||||
| _internal_set_from_player_id(from._internal_from_player_id()); | |||||
| } | |||||
| if (from._internal_have_message() != 0) | |||||
| { | |||||
| _internal_set_have_message(from._internal_have_message()); | |||||
| } | |||||
| _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); | |||||
| } | |||||
| void MsgRes::CopyFrom(const MsgRes& from) | |||||
| { | |||||
| // @@protoc_insertion_point(class_specific_copy_from_start:protobuf.MsgRes) | |||||
| if (&from == this) | |||||
| return; | |||||
| Clear(); | |||||
| MergeFrom(from); | |||||
| } | |||||
| bool MsgRes::IsInitialized() const | |||||
| { | |||||
| return true; | |||||
| } | |||||
| void MsgRes::InternalSwap(MsgRes* other) | |||||
| { | |||||
| using std::swap; | |||||
| auto* lhs_arena = GetArenaForAllocation(); | |||||
| auto* rhs_arena = other->GetArenaForAllocation(); | |||||
| _internal_metadata_.InternalSwap(&other->_internal_metadata_); | |||||
| ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( | |||||
| &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), | |||||
| &message_received_, | |||||
| lhs_arena, | |||||
| &other->message_received_, | |||||
| rhs_arena | |||||
| ); | |||||
| ::PROTOBUF_NAMESPACE_ID::internal::memswap< | |||||
| PROTOBUF_FIELD_OFFSET(MsgRes, have_message_) + sizeof(MsgRes::have_message_) - PROTOBUF_FIELD_OFFSET(MsgRes, from_player_id_)>( | |||||
| reinterpret_cast<char*>(&from_player_id_), | |||||
| reinterpret_cast<char*>(&other->from_player_id_) | |||||
| ); | |||||
| } | |||||
| ::PROTOBUF_NAMESPACE_ID::Metadata MsgRes::GetMetadata() const | |||||
| { | |||||
| return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( | |||||
| &descriptor_table_Message2Clients_2eproto_getter, &descriptor_table_Message2Clients_2eproto_once, file_level_metadata_Message2Clients_2eproto[9] | |||||
| ); | |||||
| } | |||||
| // @@protoc_insertion_point(namespace_scope) | // @@protoc_insertion_point(namespace_scope) | ||||
| } // namespace protobuf | } // namespace protobuf | ||||
| PROTOBUF_NAMESPACE_OPEN | PROTOBUF_NAMESPACE_OPEN | ||||
| @@ -3879,6 +4283,11 @@ PROTOBUF_NOINLINE ::protobuf::BoolRes* Arena::CreateMaybeMessage<::protobuf::Boo | |||||
| { | { | ||||
| return Arena::CreateMessageInternal<::protobuf::BoolRes>(arena); | return Arena::CreateMessageInternal<::protobuf::BoolRes>(arena); | ||||
| } | } | ||||
| template<> | |||||
| PROTOBUF_NOINLINE ::protobuf::MsgRes* Arena::CreateMaybeMessage<::protobuf::MsgRes>(Arena* arena) | |||||
| { | |||||
| return Arena::CreateMessageInternal<::protobuf::MsgRes>(arena); | |||||
| } | |||||
| PROTOBUF_NAMESPACE_CLOSE | PROTOBUF_NAMESPACE_CLOSE | ||||
| // @@protoc_insertion_point(global_scope) | // @@protoc_insertion_point(global_scope) | ||||
| @@ -48,7 +48,7 @@ struct TableStruct_Message2Clients_2eproto | |||||
| { | { | ||||
| static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTableField entries[] PROTOBUF_SECTION_VARIABLE(protodesc_cold); | static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTableField entries[] PROTOBUF_SECTION_VARIABLE(protodesc_cold); | ||||
| static const ::PROTOBUF_NAMESPACE_ID::internal::AuxiliaryParseTableField aux[] PROTOBUF_SECTION_VARIABLE(protodesc_cold); | static const ::PROTOBUF_NAMESPACE_ID::internal::AuxiliaryParseTableField aux[] PROTOBUF_SECTION_VARIABLE(protodesc_cold); | ||||
| static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[9] PROTOBUF_SECTION_VARIABLE(protodesc_cold); | |||||
| static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[10] PROTOBUF_SECTION_VARIABLE(protodesc_cold); | |||||
| static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[]; | static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[]; | ||||
| static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[]; | static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[]; | ||||
| static const uint32_t offsets[]; | static const uint32_t offsets[]; | ||||
| @@ -83,6 +83,9 @@ namespace protobuf | |||||
| class MoveRes; | class MoveRes; | ||||
| struct MoveResDefaultTypeInternal; | struct MoveResDefaultTypeInternal; | ||||
| extern MoveResDefaultTypeInternal _MoveRes_default_instance_; | extern MoveResDefaultTypeInternal _MoveRes_default_instance_; | ||||
| class MsgRes; | |||||
| struct MsgResDefaultTypeInternal; | |||||
| extern MsgResDefaultTypeInternal _MsgRes_default_instance_; | |||||
| } // namespace protobuf | } // namespace protobuf | ||||
| PROTOBUF_NAMESPACE_OPEN | PROTOBUF_NAMESPACE_OPEN | ||||
| template<> | template<> | ||||
| @@ -103,6 +106,8 @@ template<> | |||||
| ::protobuf::MessageToClient* Arena::CreateMaybeMessage<::protobuf::MessageToClient>(Arena*); | ::protobuf::MessageToClient* Arena::CreateMaybeMessage<::protobuf::MessageToClient>(Arena*); | ||||
| template<> | template<> | ||||
| ::protobuf::MoveRes* Arena::CreateMaybeMessage<::protobuf::MoveRes>(Arena*); | ::protobuf::MoveRes* Arena::CreateMaybeMessage<::protobuf::MoveRes>(Arena*); | ||||
| template<> | |||||
| ::protobuf::MsgRes* Arena::CreateMaybeMessage<::protobuf::MsgRes>(Arena*); | |||||
| PROTOBUF_NAMESPACE_CLOSE | PROTOBUF_NAMESPACE_CLOSE | ||||
| namespace protobuf | namespace protobuf | ||||
| { | { | ||||
| @@ -1006,6 +1011,8 @@ namespace protobuf | |||||
| kYFieldNumber = 3, | kYFieldNumber = 3, | ||||
| kPlaceFieldNumber = 6, | kPlaceFieldNumber = 6, | ||||
| kGuidFieldNumber = 5, | kGuidFieldNumber = 5, | ||||
| kSizeFieldNumber = 7, | |||||
| kIsMovingFieldNumber = 8, | |||||
| }; | }; | ||||
| // .protobuf.PropType type = 1; | // .protobuf.PropType type = 1; | ||||
| void clear_type(); | void clear_type(); | ||||
| @@ -1066,6 +1073,26 @@ namespace protobuf | |||||
| int64_t _internal_guid() const; | int64_t _internal_guid() const; | ||||
| void _internal_set_guid(int64_t value); | void _internal_set_guid(int64_t value); | ||||
| public: | |||||
| // int32 size = 7; | |||||
| void clear_size(); | |||||
| int32_t size() const; | |||||
| void set_size(int32_t value); | |||||
| private: | |||||
| int32_t _internal_size() const; | |||||
| void _internal_set_size(int32_t value); | |||||
| public: | |||||
| // bool is_moving = 8; | |||||
| void clear_is_moving(); | |||||
| bool is_moving() const; | |||||
| void set_is_moving(bool value); | |||||
| private: | |||||
| bool _internal_is_moving() const; | |||||
| void _internal_set_is_moving(bool value); | |||||
| public: | public: | ||||
| // @@protoc_insertion_point(class_scope:protobuf.MessageOfProp) | // @@protoc_insertion_point(class_scope:protobuf.MessageOfProp) | ||||
| @@ -1082,6 +1109,8 @@ namespace protobuf | |||||
| int32_t y_; | int32_t y_; | ||||
| int place_; | int place_; | ||||
| int64_t guid_; | int64_t guid_; | ||||
| int32_t size_; | |||||
| bool is_moving_; | |||||
| mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; | mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; | ||||
| friend struct ::TableStruct_Message2Clients_2eproto; | friend struct ::TableStruct_Message2Clients_2eproto; | ||||
| }; | }; | ||||
| @@ -2372,6 +2401,221 @@ namespace protobuf | |||||
| mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; | mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; | ||||
| friend struct ::TableStruct_Message2Clients_2eproto; | friend struct ::TableStruct_Message2Clients_2eproto; | ||||
| }; | }; | ||||
| // ------------------------------------------------------------------- | |||||
| class MsgRes final : | |||||
| public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:protobuf.MsgRes) */ | |||||
| { | |||||
| public: | |||||
| inline MsgRes() : | |||||
| MsgRes(nullptr) | |||||
| { | |||||
| } | |||||
| ~MsgRes() override; | |||||
| explicit constexpr MsgRes(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); | |||||
| MsgRes(const MsgRes& from); | |||||
| MsgRes(MsgRes&& from) noexcept | |||||
| : | |||||
| MsgRes() | |||||
| { | |||||
| *this = ::std::move(from); | |||||
| } | |||||
| inline MsgRes& operator=(const MsgRes& from) | |||||
| { | |||||
| CopyFrom(from); | |||||
| return *this; | |||||
| } | |||||
| inline MsgRes& operator=(MsgRes&& from) noexcept | |||||
| { | |||||
| if (this == &from) | |||||
| return *this; | |||||
| if (GetOwningArena() == from.GetOwningArena() | |||||
| #ifdef PROTOBUF_FORCE_COPY_IN_MOVE | |||||
| && GetOwningArena() != nullptr | |||||
| #endif // !PROTOBUF_FORCE_COPY_IN_MOVE | |||||
| ) | |||||
| { | |||||
| InternalSwap(&from); | |||||
| } | |||||
| else | |||||
| { | |||||
| CopyFrom(from); | |||||
| } | |||||
| return *this; | |||||
| } | |||||
| static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() | |||||
| { | |||||
| return GetDescriptor(); | |||||
| } | |||||
| static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() | |||||
| { | |||||
| return default_instance().GetMetadata().descriptor; | |||||
| } | |||||
| static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() | |||||
| { | |||||
| return default_instance().GetMetadata().reflection; | |||||
| } | |||||
| static const MsgRes& default_instance() | |||||
| { | |||||
| return *internal_default_instance(); | |||||
| } | |||||
| static inline const MsgRes* internal_default_instance() | |||||
| { | |||||
| return reinterpret_cast<const MsgRes*>( | |||||
| &_MsgRes_default_instance_ | |||||
| ); | |||||
| } | |||||
| static constexpr int kIndexInFileMessages = | |||||
| 9; | |||||
| friend void swap(MsgRes& a, MsgRes& b) | |||||
| { | |||||
| a.Swap(&b); | |||||
| } | |||||
| inline void Swap(MsgRes* other) | |||||
| { | |||||
| if (other == this) | |||||
| return; | |||||
| #ifdef PROTOBUF_FORCE_COPY_IN_SWAP | |||||
| if (GetOwningArena() != nullptr && | |||||
| GetOwningArena() == other->GetOwningArena()) | |||||
| { | |||||
| #else // PROTOBUF_FORCE_COPY_IN_SWAP | |||||
| if (GetOwningArena() == other->GetOwningArena()) | |||||
| { | |||||
| #endif // !PROTOBUF_FORCE_COPY_IN_SWAP | |||||
| InternalSwap(other); | |||||
| } | |||||
| else | |||||
| { | |||||
| ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); | |||||
| } | |||||
| } | |||||
| void UnsafeArenaSwap(MsgRes* other) | |||||
| { | |||||
| if (other == this) | |||||
| return; | |||||
| GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); | |||||
| InternalSwap(other); | |||||
| } | |||||
| // implements Message ---------------------------------------------- | |||||
| MsgRes* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final | |||||
| { | |||||
| return CreateMaybeMessage<MsgRes>(arena); | |||||
| } | |||||
| using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; | |||||
| void CopyFrom(const MsgRes& from); | |||||
| using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; | |||||
| void MergeFrom(const MsgRes& from); | |||||
| private: | |||||
| static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); | |||||
| public: | |||||
| PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; | |||||
| bool IsInitialized() const final; | |||||
| size_t ByteSizeLong() const final; | |||||
| const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; | |||||
| uint8_t* _InternalSerialize( | |||||
| uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream | |||||
| ) const final; | |||||
| int GetCachedSize() const final | |||||
| { | |||||
| return _cached_size_.Get(); | |||||
| } | |||||
| private: | |||||
| void SharedCtor(); | |||||
| void SharedDtor(); | |||||
| void SetCachedSize(int size) const final; | |||||
| void InternalSwap(MsgRes* other); | |||||
| private: | |||||
| friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; | |||||
| static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() | |||||
| { | |||||
| return "protobuf.MsgRes"; | |||||
| } | |||||
| protected: | |||||
| explicit MsgRes(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned = false); | |||||
| private: | |||||
| static void ArenaDtor(void* object); | |||||
| inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); | |||||
| public: | |||||
| static const ClassData _class_data_; | |||||
| const ::PROTOBUF_NAMESPACE_ID::Message::ClassData* GetClassData() const final; | |||||
| ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; | |||||
| // nested types ---------------------------------------------------- | |||||
| // accessors ------------------------------------------------------- | |||||
| enum : int | |||||
| { | |||||
| kMessageReceivedFieldNumber = 3, | |||||
| kFromPlayerIdFieldNumber = 2, | |||||
| kHaveMessageFieldNumber = 1, | |||||
| }; | |||||
| // string message_received = 3; | |||||
| void clear_message_received(); | |||||
| const std::string& message_received() const; | |||||
| template<typename ArgT0 = const std::string&, typename... ArgT> | |||||
| void set_message_received(ArgT0&& arg0, ArgT... args); | |||||
| std::string* mutable_message_received(); | |||||
| PROTOBUF_NODISCARD std::string* release_message_received(); | |||||
| void set_allocated_message_received(std::string* message_received); | |||||
| private: | |||||
| const std::string& _internal_message_received() const; | |||||
| inline PROTOBUF_ALWAYS_INLINE void _internal_set_message_received(const std::string& value); | |||||
| std::string* _internal_mutable_message_received(); | |||||
| public: | |||||
| // int64 from_player_id = 2; | |||||
| void clear_from_player_id(); | |||||
| int64_t from_player_id() const; | |||||
| void set_from_player_id(int64_t value); | |||||
| private: | |||||
| int64_t _internal_from_player_id() const; | |||||
| void _internal_set_from_player_id(int64_t value); | |||||
| public: | |||||
| // bool have_message = 1; | |||||
| void clear_have_message(); | |||||
| bool have_message() const; | |||||
| void set_have_message(bool value); | |||||
| private: | |||||
| bool _internal_have_message() const; | |||||
| void _internal_set_have_message(bool value); | |||||
| public: | |||||
| // @@protoc_insertion_point(class_scope:protobuf.MsgRes) | |||||
| private: | |||||
| class _Internal; | |||||
| template<typename T> | |||||
| friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; | |||||
| typedef void InternalArenaConstructable_; | |||||
| typedef void DestructorSkippable_; | |||||
| ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr message_received_; | |||||
| int64_t from_player_id_; | |||||
| bool have_message_; | |||||
| mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; | |||||
| friend struct ::TableStruct_Message2Clients_2eproto; | |||||
| }; | |||||
| // =================================================================== | // =================================================================== | ||||
| // =================================================================== | // =================================================================== | ||||
| @@ -3314,6 +3558,54 @@ namespace protobuf | |||||
| // @@protoc_insertion_point(field_set:protobuf.MessageOfProp.place) | // @@protoc_insertion_point(field_set:protobuf.MessageOfProp.place) | ||||
| } | } | ||||
| // int32 size = 7; | |||||
| inline void MessageOfProp::clear_size() | |||||
| { | |||||
| size_ = 0; | |||||
| } | |||||
| inline int32_t MessageOfProp::_internal_size() const | |||||
| { | |||||
| return size_; | |||||
| } | |||||
| inline int32_t MessageOfProp::size() const | |||||
| { | |||||
| // @@protoc_insertion_point(field_get:protobuf.MessageOfProp.size) | |||||
| return _internal_size(); | |||||
| } | |||||
| inline void MessageOfProp::_internal_set_size(int32_t value) | |||||
| { | |||||
| size_ = value; | |||||
| } | |||||
| inline void MessageOfProp::set_size(int32_t value) | |||||
| { | |||||
| _internal_set_size(value); | |||||
| // @@protoc_insertion_point(field_set:protobuf.MessageOfProp.size) | |||||
| } | |||||
| // bool is_moving = 8; | |||||
| inline void MessageOfProp::clear_is_moving() | |||||
| { | |||||
| is_moving_ = false; | |||||
| } | |||||
| inline bool MessageOfProp::_internal_is_moving() const | |||||
| { | |||||
| return is_moving_; | |||||
| } | |||||
| inline bool MessageOfProp::is_moving() const | |||||
| { | |||||
| // @@protoc_insertion_point(field_get:protobuf.MessageOfProp.is_moving) | |||||
| return _internal_is_moving(); | |||||
| } | |||||
| inline void MessageOfProp::_internal_set_is_moving(bool value) | |||||
| { | |||||
| is_moving_ = value; | |||||
| } | |||||
| inline void MessageOfProp::set_is_moving(bool value) | |||||
| { | |||||
| _internal_set_is_moving(value); | |||||
| // @@protoc_insertion_point(field_set:protobuf.MessageOfProp.is_moving) | |||||
| } | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // MessageOfPickedProp | // MessageOfPickedProp | ||||
| @@ -3895,6 +4187,115 @@ namespace protobuf | |||||
| // @@protoc_insertion_point(field_set:protobuf.BoolRes.act_success) | // @@protoc_insertion_point(field_set:protobuf.BoolRes.act_success) | ||||
| } | } | ||||
| // ------------------------------------------------------------------- | |||||
| // MsgRes | |||||
| // bool have_message = 1; | |||||
| inline void MsgRes::clear_have_message() | |||||
| { | |||||
| have_message_ = false; | |||||
| } | |||||
| inline bool MsgRes::_internal_have_message() const | |||||
| { | |||||
| return have_message_; | |||||
| } | |||||
| inline bool MsgRes::have_message() const | |||||
| { | |||||
| // @@protoc_insertion_point(field_get:protobuf.MsgRes.have_message) | |||||
| return _internal_have_message(); | |||||
| } | |||||
| inline void MsgRes::_internal_set_have_message(bool value) | |||||
| { | |||||
| have_message_ = value; | |||||
| } | |||||
| inline void MsgRes::set_have_message(bool value) | |||||
| { | |||||
| _internal_set_have_message(value); | |||||
| // @@protoc_insertion_point(field_set:protobuf.MsgRes.have_message) | |||||
| } | |||||
| // int64 from_player_id = 2; | |||||
| inline void MsgRes::clear_from_player_id() | |||||
| { | |||||
| from_player_id_ = int64_t{0}; | |||||
| } | |||||
| inline int64_t MsgRes::_internal_from_player_id() const | |||||
| { | |||||
| return from_player_id_; | |||||
| } | |||||
| inline int64_t MsgRes::from_player_id() const | |||||
| { | |||||
| // @@protoc_insertion_point(field_get:protobuf.MsgRes.from_player_id) | |||||
| return _internal_from_player_id(); | |||||
| } | |||||
| inline void MsgRes::_internal_set_from_player_id(int64_t value) | |||||
| { | |||||
| from_player_id_ = value; | |||||
| } | |||||
| inline void MsgRes::set_from_player_id(int64_t value) | |||||
| { | |||||
| _internal_set_from_player_id(value); | |||||
| // @@protoc_insertion_point(field_set:protobuf.MsgRes.from_player_id) | |||||
| } | |||||
| // string message_received = 3; | |||||
| inline void MsgRes::clear_message_received() | |||||
| { | |||||
| message_received_.ClearToEmpty(); | |||||
| } | |||||
| inline const std::string& MsgRes::message_received() const | |||||
| { | |||||
| // @@protoc_insertion_point(field_get:protobuf.MsgRes.message_received) | |||||
| return _internal_message_received(); | |||||
| } | |||||
| template<typename ArgT0, typename... ArgT> | |||||
| inline PROTOBUF_ALWAYS_INLINE void MsgRes::set_message_received(ArgT0&& arg0, ArgT... args) | |||||
| { | |||||
| message_received_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0&&>(arg0), args..., GetArenaForAllocation()); | |||||
| // @@protoc_insertion_point(field_set:protobuf.MsgRes.message_received) | |||||
| } | |||||
| inline std::string* MsgRes::mutable_message_received() | |||||
| { | |||||
| std::string* _s = _internal_mutable_message_received(); | |||||
| // @@protoc_insertion_point(field_mutable:protobuf.MsgRes.message_received) | |||||
| return _s; | |||||
| } | |||||
| inline const std::string& MsgRes::_internal_message_received() const | |||||
| { | |||||
| return message_received_.Get(); | |||||
| } | |||||
| inline void MsgRes::_internal_set_message_received(const std::string& value) | |||||
| { | |||||
| message_received_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); | |||||
| } | |||||
| inline std::string* MsgRes::_internal_mutable_message_received() | |||||
| { | |||||
| return message_received_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); | |||||
| } | |||||
| inline std::string* MsgRes::release_message_received() | |||||
| { | |||||
| // @@protoc_insertion_point(field_release:protobuf.MsgRes.message_received) | |||||
| return message_received_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); | |||||
| } | |||||
| inline void MsgRes::set_allocated_message_received(std::string* message_received) | |||||
| { | |||||
| if (message_received != nullptr) | |||||
| { | |||||
| } | |||||
| else | |||||
| { | |||||
| } | |||||
| message_received_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), message_received, GetArenaForAllocation()); | |||||
| #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING | |||||
| if (message_received_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) | |||||
| { | |||||
| message_received_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); | |||||
| } | |||||
| #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING | |||||
| // @@protoc_insertion_point(field_set_allocated:protobuf.MsgRes.message_received) | |||||
| } | |||||
| #ifdef __GNUC__ | #ifdef __GNUC__ | ||||
| #pragma GCC diagnostic pop | #pragma GCC diagnostic pop | ||||
| #endif // __GNUC__ | #endif // __GNUC__ | ||||
| @@ -3914,6 +4315,8 @@ namespace protobuf | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // ------------------------------------------------------------------- | |||||
| // @@protoc_insertion_point(namespace_scope) | // @@protoc_insertion_point(namespace_scope) | ||||
| } // namespace protobuf | } // namespace protobuf | ||||
| @@ -136,7 +136,7 @@ namespace protobuf | |||||
| constexpr IDMsg::IDMsg( | constexpr IDMsg::IDMsg( | ||||
| ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized | ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized | ||||
| ) : | ) : | ||||
| playerid_(int64_t{0}) | |||||
| player_id_(int64_t{0}) | |||||
| { | { | ||||
| } | } | ||||
| struct IDMsgDefaultTypeInternal | struct IDMsgDefaultTypeInternal | ||||
| @@ -211,7 +211,7 @@ const uint32_t TableStruct_Message2Server_2eproto::offsets[] PROTOBUF_SECTION_VA | |||||
| ~0u, // no _oneof_case_ | ~0u, // no _oneof_case_ | ||||
| ~0u, // no _weak_field_map_ | ~0u, // no _weak_field_map_ | ||||
| ~0u, // no _inlined_string_donated_ | ~0u, // no _inlined_string_donated_ | ||||
| PROTOBUF_FIELD_OFFSET(::protobuf::IDMsg, playerid_), | |||||
| PROTOBUF_FIELD_OFFSET(::protobuf::IDMsg, player_id_), | |||||
| }; | }; | ||||
| static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { | static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { | ||||
| {0, -1, -1, sizeof(::protobuf::PlayerMsg)}, | {0, -1, -1, sizeof(::protobuf::PlayerMsg)}, | ||||
| @@ -244,8 +244,8 @@ const char descriptor_table_protodef_Message2Server_2eproto[] PROTOBUF_SECTION_V | |||||
| "obuf.PropType\"C\n\007SendMsg\022\021\n\tplayer_id\030\001 " | "obuf.PropType\"C\n\007SendMsg\022\021\n\tplayer_id\030\001 " | ||||
| "\001(\003\022\024\n\014to_player_id\030\002 \001(\003\022\017\n\007message\030\003 \001" | "\001(\003\022\024\n\014to_player_id\030\002 \001(\003\022\017\n\007message\030\003 \001" | ||||
| "(\t\"-\n\tAttackMsg\022\021\n\tplayer_id\030\001 \001(\003\022\r\n\005an" | "(\t\"-\n\tAttackMsg\022\021\n\tplayer_id\030\001 \001(\003\022\r\n\005an" | ||||
| "gle\030\002 \001(\001\"\031\n\005IDMsg\022\020\n\010playerID\030\001 \001(\003b\006pr" | |||||
| "oto3"; | |||||
| "gle\030\002 \001(\001\"\032\n\005IDMsg\022\021\n\tplayer_id\030\001 \001(\003b\006p" | |||||
| "roto3"; | |||||
| static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable* const descriptor_table_Message2Server_2eproto_deps[1] = { | static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable* const descriptor_table_Message2Server_2eproto_deps[1] = { | ||||
| &::descriptor_table_MessageType_2eproto, | &::descriptor_table_MessageType_2eproto, | ||||
| }; | }; | ||||
| @@ -253,7 +253,7 @@ static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_Message2Ser | |||||
| const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_Message2Server_2eproto = { | const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_Message2Server_2eproto = { | ||||
| false, | false, | ||||
| false, | false, | ||||
| 524, | |||||
| 525, | |||||
| descriptor_table_protodef_Message2Server_2eproto, | descriptor_table_protodef_Message2Server_2eproto, | ||||
| "Message2Server.proto", | "Message2Server.proto", | ||||
| &descriptor_table_Message2Server_2eproto_once, | &descriptor_table_Message2Server_2eproto_once, | ||||
| @@ -1773,13 +1773,13 @@ namespace protobuf | |||||
| ::PROTOBUF_NAMESPACE_ID::Message() | ::PROTOBUF_NAMESPACE_ID::Message() | ||||
| { | { | ||||
| _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); | _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); | ||||
| playerid_ = from.playerid_; | |||||
| player_id_ = from.player_id_; | |||||
| // @@protoc_insertion_point(copy_constructor:protobuf.IDMsg) | // @@protoc_insertion_point(copy_constructor:protobuf.IDMsg) | ||||
| } | } | ||||
| inline void IDMsg::SharedCtor() | inline void IDMsg::SharedCtor() | ||||
| { | { | ||||
| playerid_ = int64_t{0}; | |||||
| player_id_ = int64_t{0}; | |||||
| } | } | ||||
| IDMsg::~IDMsg() | IDMsg::~IDMsg() | ||||
| @@ -1816,7 +1816,7 @@ namespace protobuf | |||||
| // Prevent compiler warnings about cached_has_bits being unused | // Prevent compiler warnings about cached_has_bits being unused | ||||
| (void)cached_has_bits; | (void)cached_has_bits; | ||||
| playerid_ = int64_t{0}; | |||||
| player_id_ = int64_t{0}; | |||||
| _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); | _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); | ||||
| } | } | ||||
| @@ -1831,11 +1831,11 @@ namespace protobuf | |||||
| ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); | ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); | ||||
| switch (tag >> 3) | switch (tag >> 3) | ||||
| { | { | ||||
| // int64 playerID = 1; | |||||
| // int64 player_id = 1; | |||||
| case 1: | case 1: | ||||
| if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) | if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) | ||||
| { | { | ||||
| playerid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); | |||||
| player_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); | |||||
| CHK_(ptr); | CHK_(ptr); | ||||
| } | } | ||||
| else | else | ||||
| @@ -1875,11 +1875,11 @@ namespace protobuf | |||||
| uint32_t cached_has_bits = 0; | uint32_t cached_has_bits = 0; | ||||
| (void)cached_has_bits; | (void)cached_has_bits; | ||||
| // int64 playerID = 1; | |||||
| if (this->_internal_playerid() != 0) | |||||
| // int64 player_id = 1; | |||||
| if (this->_internal_player_id() != 0) | |||||
| { | { | ||||
| target = stream->EnsureSpace(target); | target = stream->EnsureSpace(target); | ||||
| target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(1, this->_internal_playerid(), target); | |||||
| target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(1, this->_internal_player_id(), target); | |||||
| } | } | ||||
| if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) | if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) | ||||
| @@ -1901,10 +1901,10 @@ namespace protobuf | |||||
| // Prevent compiler warnings about cached_has_bits being unused | // Prevent compiler warnings about cached_has_bits being unused | ||||
| (void)cached_has_bits; | (void)cached_has_bits; | ||||
| // int64 playerID = 1; | |||||
| if (this->_internal_playerid() != 0) | |||||
| // int64 player_id = 1; | |||||
| if (this->_internal_player_id() != 0) | |||||
| { | { | ||||
| total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_playerid()); | |||||
| total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_player_id()); | |||||
| } | } | ||||
| return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); | return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); | ||||
| @@ -1932,9 +1932,9 @@ namespace protobuf | |||||
| uint32_t cached_has_bits = 0; | uint32_t cached_has_bits = 0; | ||||
| (void)cached_has_bits; | (void)cached_has_bits; | ||||
| if (from._internal_playerid() != 0) | |||||
| if (from._internal_player_id() != 0) | |||||
| { | { | ||||
| _internal_set_playerid(from._internal_playerid()); | |||||
| _internal_set_player_id(from._internal_player_id()); | |||||
| } | } | ||||
| _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); | _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); | ||||
| } | } | ||||
| @@ -1957,7 +1957,7 @@ namespace protobuf | |||||
| { | { | ||||
| using std::swap; | using std::swap; | ||||
| _internal_metadata_.InternalSwap(&other->_internal_metadata_); | _internal_metadata_.InternalSwap(&other->_internal_metadata_); | ||||
| swap(playerid_, other->playerid_); | |||||
| swap(player_id_, other->player_id_); | |||||
| } | } | ||||
| ::PROTOBUF_NAMESPACE_ID::Metadata IDMsg::GetMetadata() const | ::PROTOBUF_NAMESPACE_ID::Metadata IDMsg::GetMetadata() const | ||||
| @@ -1331,16 +1331,16 @@ namespace protobuf | |||||
| enum : int | enum : int | ||||
| { | { | ||||
| kPlayerIDFieldNumber = 1, | |||||
| kPlayerIdFieldNumber = 1, | |||||
| }; | }; | ||||
| // int64 playerID = 1; | |||||
| void clear_playerid(); | |||||
| int64_t playerid() const; | |||||
| void set_playerid(int64_t value); | |||||
| // int64 player_id = 1; | |||||
| void clear_player_id(); | |||||
| int64_t player_id() const; | |||||
| void set_player_id(int64_t value); | |||||
| private: | private: | ||||
| int64_t _internal_playerid() const; | |||||
| void _internal_set_playerid(int64_t value); | |||||
| int64_t _internal_player_id() const; | |||||
| void _internal_set_player_id(int64_t value); | |||||
| public: | public: | ||||
| // @@protoc_insertion_point(class_scope:protobuf.IDMsg) | // @@protoc_insertion_point(class_scope:protobuf.IDMsg) | ||||
| @@ -1352,7 +1352,7 @@ namespace protobuf | |||||
| friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; | friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; | ||||
| typedef void InternalArenaConstructable_; | typedef void InternalArenaConstructable_; | ||||
| typedef void DestructorSkippable_; | typedef void DestructorSkippable_; | ||||
| int64_t playerid_; | |||||
| int64_t player_id_; | |||||
| mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; | mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; | ||||
| friend struct ::TableStruct_Message2Server_2eproto; | friend struct ::TableStruct_Message2Server_2eproto; | ||||
| }; | }; | ||||
| @@ -1817,28 +1817,28 @@ namespace protobuf | |||||
| // IDMsg | // IDMsg | ||||
| // int64 playerID = 1; | |||||
| inline void IDMsg::clear_playerid() | |||||
| // int64 player_id = 1; | |||||
| inline void IDMsg::clear_player_id() | |||||
| { | { | ||||
| playerid_ = int64_t{0}; | |||||
| player_id_ = int64_t{0}; | |||||
| } | } | ||||
| inline int64_t IDMsg::_internal_playerid() const | |||||
| inline int64_t IDMsg::_internal_player_id() const | |||||
| { | { | ||||
| return playerid_; | |||||
| return player_id_; | |||||
| } | } | ||||
| inline int64_t IDMsg::playerid() const | |||||
| inline int64_t IDMsg::player_id() const | |||||
| { | { | ||||
| // @@protoc_insertion_point(field_get:protobuf.IDMsg.playerID) | |||||
| return _internal_playerid(); | |||||
| // @@protoc_insertion_point(field_get:protobuf.IDMsg.player_id) | |||||
| return _internal_player_id(); | |||||
| } | } | ||||
| inline void IDMsg::_internal_set_playerid(int64_t value) | |||||
| inline void IDMsg::_internal_set_player_id(int64_t value) | |||||
| { | { | ||||
| playerid_ = value; | |||||
| player_id_ = value; | |||||
| } | } | ||||
| inline void IDMsg::set_playerid(int64_t value) | |||||
| inline void IDMsg::set_player_id(int64_t value) | |||||
| { | { | ||||
| _internal_set_playerid(value); | |||||
| // @@protoc_insertion_point(field_set:protobuf.IDMsg.playerID) | |||||
| _internal_set_player_id(value); | |||||
| // @@protoc_insertion_point(field_set:protobuf.IDMsg.player_id) | |||||
| } | } | ||||
| #ifdef __GNUC__ | #ifdef __GNUC__ | ||||
| @@ -51,6 +51,8 @@ message MessageOfProp // 可拾取道具的信息 | |||||
| double facing_direction = 4; | double facing_direction = 4; | ||||
| int64 guid = 5; | int64 guid = 5; | ||||
| PlaceType place = 6; | PlaceType place = 6; | ||||
| int32 size = 7; | |||||
| bool is_moving = 8; | |||||
| } | } | ||||
| message MessageOfPickedProp //for Unity,直接继承自THUAI5 | message MessageOfPickedProp //for Unity,直接继承自THUAI5 | ||||
| @@ -90,8 +92,17 @@ message BoolRes // 用于只需要判断执行操作是否成功的行为,如 | |||||
| bool act_success = 1; | bool act_success = 1; | ||||
| } | } | ||||
| message MsgRes // 用于获取队友发来的消息 | |||||
| { | |||||
| bool have_message = 1; // 是否有待接收的消息 | |||||
| int64 from_player_id = 2; | |||||
| string message_received = 3; | |||||
| } | |||||
| service AvailableService | service AvailableService | ||||
| { | { | ||||
| rpc TryConnection(IDMsg) returns(BoolRes); | |||||
| // 游戏开局调用一次的服务 | // 游戏开局调用一次的服务 | ||||
| rpc AddPlayer(PlayerMsg) returns(stream MessageToClient); // 连接上后等待游戏开始,server会定时通过该服务向所有client发送消息。 | rpc AddPlayer(PlayerMsg) returns(stream MessageToClient); // 连接上后等待游戏开始,server会定时通过该服务向所有client发送消息。 | ||||
| @@ -101,6 +112,8 @@ service AvailableService | |||||
| rpc UseProp(IDMsg) returns (BoolRes); | rpc UseProp(IDMsg) returns (BoolRes); | ||||
| rpc UseSkill(IDMsg) returns (BoolRes); | rpc UseSkill(IDMsg) returns (BoolRes); | ||||
| rpc SendMessage(SendMsg) returns (BoolRes); | rpc SendMessage(SendMsg) returns (BoolRes); | ||||
| rpc HaveMessage(IDMsg) returns (BoolRes); | |||||
| rpc GetMessage(IDMsg) returns (MsgRes); | |||||
| rpc FixMachine(stream IDMsg) returns (stream BoolRes); // 若正常修复且未被打断则返回修复成功,位置错误/被打断则返回修复失败,下同 | rpc FixMachine(stream IDMsg) returns (stream BoolRes); // 若正常修复且未被打断则返回修复成功,位置错误/被打断则返回修复失败,下同 | ||||
| rpc SaveHuman(stream IDMsg) returns (stream BoolRes); | rpc SaveHuman(stream IDMsg) returns (stream BoolRes); | ||||
| rpc Attack (AttackMsg) returns (BoolRes); | rpc Attack (AttackMsg) returns (BoolRes); | ||||
| @@ -108,5 +121,5 @@ service AvailableService | |||||
| rpc ReleaseHuman (IDMsg) returns (BoolRes); | rpc ReleaseHuman (IDMsg) returns (BoolRes); | ||||
| rpc HangHuman (IDMsg) returns (BoolRes); | rpc HangHuman (IDMsg) returns (BoolRes); | ||||
| rpc Escape (IDMsg) returns (BoolRes); | rpc Escape (IDMsg) returns (BoolRes); | ||||
| } | } | ||||
| @@ -43,7 +43,7 @@ message AttackMsg | |||||
| message IDMsg | message IDMsg | ||||
| { | { | ||||
| int64 playerID = 1; | |||||
| int64 player_id = 1; | |||||
| } | } | ||||
| // 基本继承于THUAI5,为了使发送的信息尽可能不被浪费,暂定不发这类大包。 | // 基本继承于THUAI5,为了使发送的信息尽可能不被浪费,暂定不发这类大包。 | ||||
| @@ -0,0 +1,77 @@ | |||||
| using Preparation.Utility; | |||||
| namespace Preparation.GameData | |||||
| { | |||||
| public static class GameData | |||||
| { | |||||
| #region 基本常数与常方法 | |||||
| public const int numOfPosGridPerCell = 1000; // 每格的【坐标单位】数 | |||||
| public const int numOfStepPerSecond = 20; // 每秒行走的步数 | |||||
| public const int lengthOfMap = 50000; // 地图长度 | |||||
| public const int rows = 50; // 行数 | |||||
| public const int cols = 50; // 列数 | |||||
| public const long gameDuration = 600000; // 游戏时长600000ms = 10min | |||||
| public const long frameDuration = 50; // 每帧时长 | |||||
| public const int MinSpeed = 1; // 最小速度 | |||||
| public const int MaxSpeed = int.MaxValue; // 最大速度 | |||||
| public static XYPosition GetCellCenterPos(int x, int y) // 求格子的中心坐标 | |||||
| { | |||||
| XYPosition ret = new((x * numOfPosGridPerCell) + (numOfPosGridPerCell / 2), (y * numOfPosGridPerCell) + (numOfPosGridPerCell / 2)); | |||||
| return ret; | |||||
| } | |||||
| public static int PosGridToCellX(XYPosition pos) // 求坐标所在的格子的x坐标 | |||||
| { | |||||
| return pos.x / numOfPosGridPerCell; | |||||
| } | |||||
| public static int PosGridToCellY(XYPosition pos) // 求坐标所在的格子的y坐标 | |||||
| { | |||||
| return pos.y / numOfPosGridPerCell; | |||||
| } | |||||
| public static bool IsInTheSameCell(XYPosition pos1, XYPosition pos2) | |||||
| { | |||||
| return PosGridToCellX(pos1) == PosGridToCellX(pos2) && PosGridToCellY(pos1) == PosGridToCellY(pos2); | |||||
| } | |||||
| #endregion | |||||
| #region 角色相关 | |||||
| /// <summary> | |||||
| /// 玩家相关 | |||||
| /// </summary> | |||||
| public const int characterRadius = numOfPosGridPerCell / 2; // 人物半径 | |||||
| public const int basicAp = 3000; // 初始攻击力 | |||||
| public const int basicHp = 6000; // 初始血量 | |||||
| public const int basicCD = 3000; // 初始子弹冷却 | |||||
| public const int basicBulletNum = 3; // 基本初始子弹量 | |||||
| public const int MinAP = 0; // 最小攻击力 | |||||
| public const int MaxAP = int.MaxValue; // 最大攻击力 | |||||
| public const double basicAttackRange = 9000; // 基本攻击范围 | |||||
| public const double basicBulletBombRange = 3000; // 基本子弹爆炸范围 | |||||
| public const int basicMoveSpeed = 3000; // 基本移动速度,单位:s-1 | |||||
| public const int basicBulletMoveSpeed = 3000; // 基本子弹移动速度,单位:s-1 | |||||
| public const int characterMaxSpeed = 12000; // 最大速度 | |||||
| public const int addScoreWhenKillOneLevelPlayer = 30; // 击杀一级角色获得的加分 | |||||
| public const int commonSkillCD = 30000; // 普通技能标准冷却时间 | |||||
| public const int commonSkillTime = 10000; // 普通技能标准持续时间 | |||||
| public const int bulletRadius = 200; // 默认子弹半径 | |||||
| public const int reviveTime = 30000; // 复活时间 | |||||
| public const int shieldTimeAtBirth = 3000; // 复活时的护盾时间 | |||||
| public const int gemToScore = 4; // 一个宝石的标准加分 | |||||
| /// <summary> | |||||
| /// 道具相关 | |||||
| /// </summary> | |||||
| public const int MinPropTypeNum = 1; | |||||
| public const int MaxPropTypeNum = 10; | |||||
| public const int PropRadius = numOfPosGridPerCell / 2; | |||||
| public const int PropMoveSpeed = 3000; | |||||
| public const int PropMaxMoveDistance = 15 * numOfPosGridPerCell; | |||||
| public const int MaxGemSize = 5; // 随机生成的宝石最大size | |||||
| public const long GemProduceTime = 10000; | |||||
| public const long PropProduceTime = 10000; | |||||
| public const int PropDuration = 10000; | |||||
| #endregion | |||||
| #region 游戏帧相关 | |||||
| public const long checkInterval = 50; // 检查位置标志、补充子弹的帧时长 | |||||
| #endregion | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,11 @@ | |||||
| using System; | |||||
| using Preparation.Utility; | |||||
| namespace Preparation.Interface | |||||
| { | |||||
| public interface ICharacter : IGameObj | |||||
| { | |||||
| public long TeamID { get; } | |||||
| public int HP { get; set; } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,20 @@ | |||||
| using Preparation.Utility; | |||||
| namespace Preparation.Interface | |||||
| { | |||||
| public interface IGameObj | |||||
| { | |||||
| public GameObjType Type { get; set; } | |||||
| public long ID { get; } | |||||
| public XYPosition Position { get; } // if Square, Pos equals the center | |||||
| public double FacingDirection { get; } | |||||
| public bool IsRigid { get; } | |||||
| public ShapeType Shape { get; } | |||||
| public bool CanMove { get; set; } | |||||
| public bool IsMoving { get; set; } | |||||
| public bool IsResetting { get; set; } // reviving | |||||
| public bool IsAvailable { get; } | |||||
| public int Radius { get; } // if Square, Radius equals half length of one side | |||||
| public PlaceType Place { get; set; } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,18 @@ | |||||
| using System.Collections.Generic; | |||||
| using System.Threading; | |||||
| using Preparation.Utility; | |||||
| namespace Preparation.Interface | |||||
| { | |||||
| public interface IMap | |||||
| { | |||||
| ITimer Timer { get; } | |||||
| // the two dicts must have same keys | |||||
| Dictionary<GameObjIdx, IList<IGameObj>> GameObjDict { get; } | |||||
| Dictionary<GameObjIdx, ReaderWriterLockSlim> GameObjLockDict { get; } | |||||
| public bool IsOutOfBound(IGameObj obj); | |||||
| public IOutOfBound GetOutOfBound(XYPosition pos); // 返回新建的一个OutOfBound对象 | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,37 @@ | |||||
| using System; | |||||
| using Preparation.Utility; | |||||
| namespace Preparation.Interface | |||||
| { | |||||
| public interface IMoveable : IGameObj | |||||
| { | |||||
| object MoveLock { get; } | |||||
| public int MoveSpeed { get; } | |||||
| public long Move(Vector moveVec); | |||||
| protected bool IgnoreCollide(IGameObj targetObj); // 忽略碰撞,在具体类中实现 | |||||
| public bool WillCollideWith(IGameObj? targetObj, XYPosition nextPos) // 检查下一位置是否会和目标物碰撞 | |||||
| { | |||||
| if (targetObj == null) | |||||
| return false; | |||||
| // 会移动的只有子弹和人物,都是Circle | |||||
| if (!targetObj.IsRigid || targetObj.ID == ID) | |||||
| return false; | |||||
| if (IgnoreCollide(targetObj)) | |||||
| return false; | |||||
| if (targetObj.Shape == ShapeType.Circle) | |||||
| { | |||||
| return XYPosition.Distance(nextPos, targetObj.Position) < targetObj.Radius + Radius; | |||||
| } | |||||
| else // Square | |||||
| { | |||||
| long deltaX = Math.Abs(nextPos.x - targetObj.Position.x), deltaY = Math.Abs(nextPos.y - targetObj.Position.y); | |||||
| if (deltaX >= targetObj.Radius + Radius || deltaY >= targetObj.Radius + Radius) | |||||
| return false; | |||||
| if (deltaX < targetObj.Radius || deltaY < targetObj.Radius) | |||||
| return true; | |||||
| else | |||||
| return ((long)(deltaX - targetObj.Radius) * (deltaX - targetObj.Radius)) + ((long)(deltaY - targetObj.Radius) * (deltaY - targetObj.Radius)) <= (long)Radius * (long)Radius; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,9 @@ | |||||
| using System; | |||||
| namespace Preparation.Interface | |||||
| { | |||||
| public interface IObjOfCharacter : IGameObj | |||||
| { | |||||
| ICharacter? Parent { get; set; } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,9 @@ | |||||
| | |||||
| namespace Preparation.Interface | |||||
| { | |||||
| public interface ITimer | |||||
| { | |||||
| bool IsGaming { get; } | |||||
| public bool StartGame(int timeInMilliseconds); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,14 @@ | |||||
| using System; | |||||
| namespace Preparation.Utility | |||||
| { | |||||
| public class Debugger | |||||
| { | |||||
| static public void Output(object current, string str) | |||||
| { | |||||
| #if DEBUG | |||||
| Console.WriteLine(current.GetType() + " " + current.ToString() + " " + str); | |||||
| #endif | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,96 @@ | |||||
| | |||||
| namespace Preparation.Utility | |||||
| { | |||||
| /// <summary> | |||||
| /// 存放所有用到的枚举类型 | |||||
| /// </summary> | |||||
| public enum GameObjType | |||||
| { | |||||
| Null = 0, | |||||
| Character = 1, | |||||
| Prop = 2, | |||||
| PickedProp = 3, | |||||
| Bullet = 4, | |||||
| BombedBullet = 5, | |||||
| Wall = 6, | |||||
| Grass = 7, | |||||
| Generator = 8, // 发电机 | |||||
| BirthPoint = 9, | |||||
| Exit = 10, | |||||
| EmergencyExit = 11, | |||||
| OutOfBoundBlock = 12, // 范围外 | |||||
| } | |||||
| public enum ShapeType | |||||
| { | |||||
| Null = 0, | |||||
| Circle = 1, // 子弹和人物为圆形,格子为方形 | |||||
| Square = 2 | |||||
| } | |||||
| public enum PlaceType // 位置标志,包括陆地(一般默认为陆地,如墙体等),草丛。游戏中每一帧都要刷新各个物体的该属性 | |||||
| { | |||||
| Null = 0, | |||||
| Land = 1, | |||||
| Grass1 = 2, | |||||
| Grass2 = 3, | |||||
| Grass3 = 4, | |||||
| Grass4 = 5, | |||||
| Grass5 = 6, | |||||
| } | |||||
| public enum BulletType // 子弹类型 | |||||
| { | |||||
| Null = 0, | |||||
| OrdinaryBullet = 1, // 普通子弹 | |||||
| AtomBomb = 2, // 原子弹 | |||||
| FastBullet = 3, // 快速子弹 | |||||
| LineBullet = 4 // 直线子弹 | |||||
| } | |||||
| public enum PropType // 道具类型 | |||||
| { | |||||
| Null = 0, | |||||
| addSpeed = 1, | |||||
| addLIFE = 2, | |||||
| Shield = 3, | |||||
| Spear = 4, | |||||
| Gem = 5, // 新增:宝石 | |||||
| } | |||||
| public enum PassiveSkillType // 被动技能 | |||||
| { | |||||
| Null = 0, | |||||
| RecoverAfterBattle = 1, | |||||
| SpeedUpWhenLeavingGrass = 2, | |||||
| Vampire = 3, | |||||
| PSkill3 = 4, | |||||
| PSkill4 = 5, | |||||
| PSkill5 = 6 | |||||
| } | |||||
| public enum ActiveSkillType // 主动技能 | |||||
| { | |||||
| Null = 0, | |||||
| BecomeVampire = 1, | |||||
| BecomeAssassin = 2, | |||||
| NuclearWeapon = 3, | |||||
| SuperFast = 4, | |||||
| ASkill4 = 5, | |||||
| ASkill5 = 6 | |||||
| } | |||||
| public enum BuffType // buff | |||||
| { | |||||
| Null = 0, | |||||
| AddSpeed = 1, | |||||
| AddLIFE = 2, | |||||
| Shield = 3, | |||||
| Spear = 4 | |||||
| } | |||||
| public enum GameObjIdx | |||||
| { | |||||
| None = 0, | |||||
| Player = 1, | |||||
| Bullet = 2, | |||||
| Prop = 3, | |||||
| Gem = 4, | |||||
| Map = 5, | |||||
| BombedBullet = 6, | |||||
| PickedProp = 7 | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,17 @@ | |||||
| using System; | |||||
| namespace Preparation.Utility | |||||
| { | |||||
| public class MapEncoder | |||||
| { | |||||
| static public char Dec2Hex(int d) | |||||
| { | |||||
| return char.Parse(d.ToString("X")); | |||||
| } | |||||
| static public int Hex2Dec(char h) | |||||
| { | |||||
| string hexabet = "0123456789ABCDEF"; | |||||
| return hexabet.IndexOf(h); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,20 @@ | |||||
| using System; | |||||
| namespace Preparation.Utility | |||||
| { | |||||
| public static class Tools | |||||
| { | |||||
| public static double CorrectAngle(double angle) // 将幅角转化为主值0~2pi | |||||
| { | |||||
| if (double.IsNaN(angle) || double.IsInfinity(angle)) | |||||
| { | |||||
| return 0.0; | |||||
| } | |||||
| while (angle < 0) | |||||
| angle += 2 * Math.PI; | |||||
| while (angle >= 2 * Math.PI) | |||||
| angle -= 2 * Math.PI; | |||||
| return angle; | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,57 @@ | |||||
| using System; | |||||
| namespace Preparation.Utility | |||||
| { | |||||
| public struct Vector | |||||
| { | |||||
| public double angle; | |||||
| public double length; | |||||
| public static XYPosition VectorToXY(Vector v) | |||||
| { | |||||
| return new XYPosition((int)(v.length * Math.Cos(v.angle)), (int)(v.length * Math.Sin(v.angle))); | |||||
| } | |||||
| public Vector2 ToVector2() | |||||
| { | |||||
| return new Vector2((int)(this.length * Math.Cos(this.angle)), (int)(this.length * Math.Sin(this.angle))); | |||||
| } | |||||
| public static Vector XYToVector(double x, double y) | |||||
| { | |||||
| return new Vector(Math.Atan2(y, x), Math.Sqrt((x * x) + (y * y))); | |||||
| } | |||||
| public Vector(double angle, double length) | |||||
| { | |||||
| if (length < 0) | |||||
| { | |||||
| angle += Math.PI; | |||||
| length = -length; | |||||
| } | |||||
| this.angle = Tools.CorrectAngle(angle); | |||||
| this.length = length; | |||||
| } | |||||
| } | |||||
| public struct Vector2 | |||||
| { | |||||
| public double x; | |||||
| public double y; | |||||
| public Vector2(double x, double y) | |||||
| { | |||||
| this.x = x; | |||||
| this.y = y; | |||||
| } | |||||
| public static double operator*(Vector2 v1, Vector2 v2) | |||||
| { | |||||
| return (v1.x * v2.x) + (v1.y * v2.y); | |||||
| } | |||||
| public static Vector2 operator +(Vector2 v1, Vector2 v2) | |||||
| { | |||||
| return new Vector2(v1.x + v2.x, v1.y + v2.y); | |||||
| } | |||||
| public static Vector2 operator -(Vector2 v1, Vector2 v2) | |||||
| { | |||||
| return new Vector2(v1.x - v2.x, v1.y - v2.y); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,49 @@ | |||||
| using System; | |||||
| namespace Preparation.Utility | |||||
| { | |||||
| public struct XYPosition | |||||
| { | |||||
| public int x; | |||||
| public int y; | |||||
| public XYPosition(int x, int y) | |||||
| { | |||||
| this.x = x; | |||||
| this.y = y; | |||||
| } | |||||
| public override string ToString() | |||||
| { | |||||
| return "(" + x.ToString() + "," + y.ToString() + ")"; | |||||
| } | |||||
| public static XYPosition operator +(XYPosition p1, XYPosition p2) | |||||
| { | |||||
| return new XYPosition(p1.x + p2.x, p1.y + p2.y); | |||||
| } | |||||
| public static XYPosition operator -(XYPosition p1, XYPosition p2) | |||||
| { | |||||
| return new XYPosition(p1.x - p2.x, p1.y - p2.y); | |||||
| } | |||||
| public static double Distance(XYPosition p1, XYPosition p2) | |||||
| { | |||||
| return Math.Sqrt(((long)(p1.x - p2.x) * (p1.x - p2.x)) + ((long)(p1.y - p2.y) * (p1.y - p2.y))); | |||||
| } | |||||
| /*public static XYPosition[] GetSquareRange(uint edgeLen) // 从THUAI4的BULLET.CS移植而来,不知还有用否 | |||||
| { | |||||
| XYPosition[] range = new XYPosition[edgeLen * edgeLen]; | |||||
| int offset = (int)(edgeLen >> 1); | |||||
| for (int i = 0; i < (int)edgeLen; ++i) | |||||
| { | |||||
| for (int j = 0; j < (int)edgeLen; ++j) | |||||
| { | |||||
| range[i * edgeLen + j].x = i - offset; | |||||
| range[i * edgeLen + j].y = j - offset; | |||||
| } | |||||
| } | |||||
| return range; | |||||
| }*/ | |||||
| public Vector2 ToVector2() | |||||
| { | |||||
| return new Vector2(this.x, this.y); | |||||
| } | |||||
| } | |||||
| } | |||||