[common] use proto types

This commit is contained in:
2020-05-28 20:42:41 +03:00
parent b7b1ac3871
commit fec7680eee
36 changed files with 514 additions and 377 deletions

View File

@@ -4,27 +4,62 @@ import "core.proto";
package ru.m.puzzlez.proto.game;
message PartProto {
enum BoundType {
NONE = 0;
OUT = 1;
IN = 2;
}
message GridProto {
int32 width = 1;
int32 height = 2;
message PartBound {
BoundType spike = 1;
BoundType side = 2;
}
message GamePresetProto {
message PartBounds {
PartBound left = 1;
PartBound right = 2;
PartBound top = 3;
PartBound bottom = 4;
}
enum PartLocation {
TABLE = 0;
HAND = 1;
IMAGE = 2;
}
message Part {
int32 id = 1;
ru.m.puzzlez.proto.core.IntPoint point = 2;
PartBounds bounds = 3;
ru.m.puzzlez.proto.core.Point position = 4;
PartLocation location = 5;
ru.m.puzzlez.proto.core.Rectangle rect = 6;
string playerId = 7;
}
message GamePreset {
string imageId = 1;
GridProto grid = 2;
ru.m.puzzlez.proto.core.IntPoint grid = 2;
ru.m.puzzlez.proto.core.Rectangle tableRect = 3;
ru.m.puzzlez.proto.core.Rectangle imageRect = 4;
}
message GameStateProto {
enum GameStatus {
READY = 0;
STARTED = 1;
COMPLETE = 2;
}
message GameState {
string id = 1;
GamePresetProto preset = 2;
repeated PartProto parts = 3;
GameStatus status = 2;
GamePreset preset = 3;
repeated Part parts = 4;
bool online = 5;
}
message GameProto {
GameStateProto state = 2;
repeated ru.m.puzzlez.proto.core.UserProto users = 3;
message GameItem {
GameState state = 2;
repeated ru.m.puzzlez.proto.core.User users = 3;
}