[proto] add rooms and slots
This commit is contained in:
@@ -7,23 +7,9 @@ message UserProto {
|
||||
string name = 2;
|
||||
}
|
||||
|
||||
enum GameStateProto {
|
||||
READY = 0;
|
||||
STARTED = 1;
|
||||
ENDED = 2;
|
||||
}
|
||||
|
||||
message PlayerProto {
|
||||
UserProto user = 1;
|
||||
string team = 2;
|
||||
int32 index = 3;
|
||||
}
|
||||
|
||||
message GameProto {
|
||||
int32 id = 1;
|
||||
string type = 2;
|
||||
int32 level = 3;
|
||||
UserProto creator = 4;
|
||||
repeated PlayerProto players = 5;
|
||||
GameStateProto state = 6;
|
||||
bool started = 4;
|
||||
}
|
||||
|
||||
@@ -1,28 +1,3 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package ru.m.tankz.proto.game;
|
||||
|
||||
|
||||
enum GameActionTypeProto {
|
||||
MOVE = 0;
|
||||
SHOT = 1;
|
||||
STOP = 2;
|
||||
}
|
||||
|
||||
enum GameChangeTypeProto {
|
||||
MOVED = 0;
|
||||
DESTROED = 1;
|
||||
MODIFIED = 2;
|
||||
APPEND = 3;
|
||||
DIRECTION = 4;
|
||||
}
|
||||
|
||||
message GameChangeProto {
|
||||
GameChangeTypeProto type = 1;
|
||||
string entityType = 2;
|
||||
int32 entityId = 3;
|
||||
float x = 4;
|
||||
float y = 5;
|
||||
int32 directionX = 6;
|
||||
int32 directionY = 7;
|
||||
}
|
||||
@@ -2,16 +2,15 @@ syntax = "proto3";
|
||||
|
||||
import "core.proto";
|
||||
import "game.proto";
|
||||
import "room.proto";
|
||||
|
||||
package ru.m.tankz.proto.pack;
|
||||
|
||||
|
||||
message ErrorResponse {
|
||||
int32 code = 1;
|
||||
string message = 2;
|
||||
}
|
||||
|
||||
// Login
|
||||
message LoginRequest {
|
||||
string uuid = 1;
|
||||
string name = 2;
|
||||
@@ -21,56 +20,10 @@ message LoginResponse {
|
||||
ru.m.tankz.proto.core.UserProto user = 1;
|
||||
}
|
||||
|
||||
// Logout
|
||||
message LogoutRequest {}
|
||||
|
||||
message LogoutResponse {}
|
||||
|
||||
// List Game
|
||||
message ListGameRequest {}
|
||||
|
||||
message ListGameResponse {
|
||||
repeated ru.m.tankz.proto.core.GameProto games = 1;
|
||||
}
|
||||
|
||||
// Create Game
|
||||
message CreateGameRequest {
|
||||
string type = 1;
|
||||
int32 level = 2;
|
||||
}
|
||||
|
||||
message CreateGameResponse {
|
||||
ru.m.tankz.proto.core.GameProto game = 1;
|
||||
}
|
||||
|
||||
// Join Game
|
||||
message JoinGameRequest {
|
||||
int32 game_id = 1;
|
||||
bool restore = 2;
|
||||
}
|
||||
|
||||
message JoinGameResponse {
|
||||
ru.m.tankz.proto.core.GameProto game = 1;
|
||||
ru.m.tankz.proto.core.UserProto user = 2;
|
||||
repeated string events = 3;
|
||||
}
|
||||
|
||||
// Leave Game
|
||||
message LeaveGameRequest {}
|
||||
|
||||
message LeaveGameResponse {
|
||||
ru.m.tankz.proto.core.GameProto game = 1;
|
||||
ru.m.tankz.proto.core.UserProto user = 2;
|
||||
}
|
||||
|
||||
// Start Game
|
||||
message StartGameRequest {}
|
||||
|
||||
message StartGameResponse {
|
||||
ru.m.tankz.proto.core.GameProto game = 1;
|
||||
}
|
||||
|
||||
// Game
|
||||
message GameEventRequest {
|
||||
int32 time = 1;
|
||||
string event = 2;
|
||||
@@ -81,31 +34,23 @@ message GameEventResponse {
|
||||
string event = 2;
|
||||
}
|
||||
|
||||
// Request
|
||||
message Request {
|
||||
oneof content {
|
||||
LoginRequest login = 1;
|
||||
LogoutRequest logout = 2;
|
||||
ListGameRequest listGame = 3;
|
||||
CreateGameRequest createGame = 4;
|
||||
JoinGameRequest joinGame = 5;
|
||||
LeaveGameRequest leaveGame = 6;
|
||||
StartGameRequest startGame = 7;
|
||||
GameEventRequest gameEvent = 8;
|
||||
ru.m.tankz.proto.room.RoomRequest room = 3;
|
||||
ru.m.tankz.proto.room.RoomListRequest roomList = 4;
|
||||
GameEventRequest gameEvent = 6;
|
||||
}
|
||||
}
|
||||
|
||||
// Response
|
||||
message Response {
|
||||
oneof content {
|
||||
LoginResponse login = 1;
|
||||
LogoutResponse logout = 2;
|
||||
ListGameResponse listGame = 3;
|
||||
CreateGameResponse createGame = 4;
|
||||
JoinGameResponse joinGame = 5;
|
||||
LeaveGameResponse leaveGame = 6;
|
||||
StartGameResponse startGame = 7;
|
||||
GameEventResponse gameEvent = 8;
|
||||
ru.m.tankz.proto.room.RoomResponse room = 3;
|
||||
ru.m.tankz.proto.room.RoomListResponse roomList = 4;
|
||||
GameEventResponse gameEvent = 6;
|
||||
|
||||
ErrorResponse error = 999;
|
||||
}
|
||||
|
||||
63
src/common/proto/room.proto
Normal file
63
src/common/proto/room.proto
Normal file
@@ -0,0 +1,63 @@
|
||||
syntax = "proto3";
|
||||
|
||||
import "core.proto";
|
||||
|
||||
package ru.m.tankz.proto.room;
|
||||
|
||||
message SlotProto {
|
||||
string team = 3;
|
||||
int32 index = 4;
|
||||
}
|
||||
|
||||
message RoomSlotProto {
|
||||
SlotProto slot = 1;
|
||||
ru.m.tankz.proto.core.UserProto user = 2;
|
||||
}
|
||||
|
||||
message RoomProto {
|
||||
ru.m.tankz.proto.core.GameProto game = 1;
|
||||
ru.m.tankz.proto.core.UserProto creator = 2;
|
||||
repeated ru.m.tankz.proto.core.UserProto users = 3;
|
||||
repeated RoomSlotProto slots = 4;
|
||||
}
|
||||
|
||||
message CreateRequest {
|
||||
string type = 2;
|
||||
int32 level = 3;
|
||||
}
|
||||
|
||||
message JoinRequest {
|
||||
int32 gameId = 1;
|
||||
}
|
||||
|
||||
message LeaveRequest {
|
||||
}
|
||||
|
||||
message SlotRequest {
|
||||
SlotProto slot = 3;
|
||||
}
|
||||
|
||||
message StartRequest {
|
||||
}
|
||||
|
||||
message RoomRequest {
|
||||
oneof content {
|
||||
CreateRequest create = 1;
|
||||
JoinRequest join = 2;
|
||||
LeaveRequest leave = 3;
|
||||
SlotRequest slot = 4;
|
||||
StartRequest start = 5;
|
||||
}
|
||||
}
|
||||
|
||||
message RoomResponse {
|
||||
RoomProto room = 1;
|
||||
}
|
||||
|
||||
message RoomListRequest {
|
||||
bool subscribe = 1;
|
||||
}
|
||||
|
||||
message RoomListResponse {
|
||||
repeated RoomProto rooms = 1;
|
||||
}
|
||||
Reference in New Issue
Block a user