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

105 lines
2.4 KiB

syntax = "proto3";
import "google/protobuf/empty.proto";
option go_package = "./mahjong";
service Mahjong {
rpc PlayerOnline(google.protobuf.Empty) returns(ResPlayerOnline); // 登录后初始化玩家信
rpc PlayerOffline(google.protobuf.Empty) returns(google.protobuf.Empty); // 登
rpc LobbyView(google.protobuf.Empty) returns(Lobby);
// return tableId
rpc CreateTable(google.protobuf.Empty) returns(MjTable);
rpc JoinTable(ReqJoinTable) returns(MjTable);
rpc LeaveTable(google.protobuf.Empty) returns(google.protobuf.Empty);
rpc KickoutTable(ReqKickoutTable) returns(google.protobuf.Empty);
rpc ReadyStart(google.protobuf.Empty) returns(google.protobuf.Empty);
rpc CancelReady(google.protobuf.Empty) returns(google.protobuf.Empty);
// 解散牌桌
rpc DismissTable(google.protobuf.Empty) returns(google.protobuf.Empty);
rpc GameStart(google.protobuf.Empty) returns(google.protobuf.Empty);
rpc PlayerAction(ReqPlayerAction) returns(google.protobuf.Empty);
}
message ResPlayerOnline {
MjPlayer player = 1;
}
message ReqPlayerAction {
int32 opt = 1; // 定缺
int32 tileLack = 2; // 定缺: 0万 1条 2筒
int32 hit = 3; // 出牌
}
message ReqJoinTable {
string tableId = 1;
}
message ReqKickoutTable {
string targetUid = 1;
}
message LobbyTable {
string tableId = 1;
int32 playerCount = 2;
int32 stage = 3;
}
message Lobby {
repeated LobbyTable tables = 1;
}
message WinSettle {
int32 weight = 1;
string winTypeName = 2;
repeated string weightNames = 3;
}
message MjPlayer {
string playerId = 1;
string username = 2;
string avatar = 3;
int32 status = 4;
int32 tileLack = 5; // 缺一门
int64 coin = 6;
string tableId = 7; // 玩家当前牌桌id
repeated int32 mjHand = 8; // 手牌
int32 mjDraw = 9; // 摸牌
message Peng {
repeated int32 mj = 1;
}
repeated Peng mjPeng = 10; // 碰
message Gang{
repeated int32 mj = 1;
}
repeated Gang mjGang = 11; // 杠
repeated int32 opts = 12; // 可操作列表
repeated int32 gangTiles = 13; // 可杠牌列表
WinSettle winSettle = 18;
// 18: optional i8 direct // 0.东 1.南 2.西 3.北
}
message MjTable {
string tableId = 1;
string masterId = 2;
int32 stage = 3;
int32 gameTimes = 4;
repeated MjPlayer players = 5;
repeated int32 playerDirects = 6; // 0.东 1.南 2.西 3.北
int32 restTiles = 7;// 剩余牌张数
string hitPlayerId = 8;
repeated int32 hits = 9;
}