Files
Gen_Hack-and-Slash-Roguelit…/Tools/ProtoBuf/proto/message.proto

105 lines
2.0 KiB
Protocol Buffer
Raw Normal View History

2025-07-07 22:39:28 +08:00
syntax = "proto3";
package protocol;
// Define services
service GeneralService {
// Get server info from server.
//
// This parameter actually doesn't accept any arguments,
// but it is still required owing to Protobuf grammar.
rpc GetServerInfo(Empty) returns (ServerInfo);
}
service GameService {
rpc Login(LoginRequest) returns (LoginResponse);
rpc Signup(SignupRequest) returns (SignupResponse);
}
// Define messages
enum RequestResult {
Success = 0;
Fail = 1;
}
message Empty {}
message ServerInfo {
string Lang = 1;
string ver = 2;
}
message LoginRequest {
string Username = 1;
string Password = 2;
}
message LoginResponse {
RequestResult result = 1;
string message = 2;
}
message SignupRequest {
string Username = 1;
string Password = 2;
}
message SignupResponse {
RequestResult result = 1;
string message = 2;
}
// 定义 FilePack 消息
message FilePack {
string filePath = 1;
bytes content = 2;
}
// 定义 DataPackListPack 消息
message DataPackListPack {
repeated Pair packIDAndVersion = 1;
// 定义内部的 Pair 消息(用于替代 Tuple<string, string>
message Pair {
string key = 1;
string value = 2;
}
}
// 定义 TileMapTablePack 消息
message TileMapTablePack {
map<int32, string> tileMapKey = 1; // 使用 int32 替代 int
}
// 定义 MapDataPack 消息
message MapDataPack {
Vector2 position = 1;
Vector2 size = 2;
repeated int32 tileMapType = 3; // 使用 int32 替代 int
}
// 定义 MonsterAttributes 消息
message MonsterAttributes {
int32 health = 1;
int32 moveSpeed = 2;
int32 attack = 3;
int32 defense = 4;
int32 attackSpeed = 5;
int32 attackRange = 6;
int32 attackTargetCount = 7;
}
// 定义 MonsterPack 消息
message MonsterPack {
int32 monsterID = 1;
Vector2 position = 2;
MonsterAttributes attributes = 3;
}
// 定义 Vector2 消息
message Vector2 {
float x = 1;
float y = 2;
}