game.proto 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. syntax = "proto3"; //指定版本,必须要写(proto3、proto2)
  2. option go_package="./;gameproto";
  3. package gameproto;
  4. import "google/protobuf/any.proto";
  5. enum NotifyTypeEnum {
  6. NotifyTypePing = 0;
  7. NotifyTypeJoinRoom = 1;
  8. NotifyTypeLeaveRoom = 2;
  9. NotifyTypeCreateRoom = 3;
  10. NotifyTypeConnect = 4;
  11. NotifyTypeDisconnect = 5;
  12. NotifyTypeReady = 6;
  13. NotifyTypeUnReady = 7;
  14. NotifyTypeStart = 8;
  15. NotifyTypeChooseMaster = 9;
  16. NotifyTypeChooseMasterFinish = 10;
  17. NotifyTypeChooseMul = 11;
  18. NotifyTypeChooseMulFinish = 12;
  19. NotifyTypeGameInit = 13;
  20. NotifyTypeOpen = 14;
  21. NotifyTypeOpenFinish = 15;
  22. NotifyTypeMsgResp = 16; //简单的返回
  23. NotifyTypeWaitReady = 17;
  24. NotifyTypeRoomInfo = 18;
  25. }
  26. enum DataType {
  27. DataTypeNormal = 0; //0x00000000
  28. DataTypeGZip = 2; //0x00000010
  29. DataTypeEnc = 4; //0x00000100
  30. }
  31. enum RoomType {
  32. RoomTypeFree = 0;
  33. RoomTypeNormal = 1;
  34. }
  35. enum RespStatus {
  36. RespStatusSucc = 0;
  37. RespStatusFailed = 1;
  38. }
  39. //Ping
  40. message Ping {
  41. }
  42. message MsgResp {
  43. string once = 1;
  44. RespStatus status = 2;
  45. string msg = 3;
  46. google.protobuf.Any data = 4;
  47. }
  48. message Room {
  49. uint32 ID = 1;
  50. string Name = 2;
  51. bool needPwd = 10;
  52. RoomType RoomType = 3;
  53. double BaseAmount = 4;
  54. uint32 ChairUserID1 = 5;
  55. uint32 ChairUserID2 = 6;
  56. uint32 ChairUserID3 = 7;
  57. uint32 ChairUserID4 = 8;
  58. uint32 ChairUserID5 = 9;
  59. uint32 Status = 11;
  60. }
  61. message TableInfo {
  62. repeated Room roomList = 1;
  63. repeated User userList = 2;
  64. }
  65. message RoomDetail {
  66. uint32 ID = 1;
  67. string Name = 2;
  68. bool needPwd = 10;
  69. RoomType RoomType = 3;
  70. double BaseAmount = 4;
  71. uint32 ChairUserID1 = 5;
  72. uint32 ChairUserID2 = 6;
  73. uint32 ChairUserID3 = 7;
  74. uint32 ChairUserID4 = 8;
  75. uint32 ChairUserID5 = 9;
  76. uint32 Status = 11;
  77. int64 StatusStartTime = 13;
  78. repeated RoomUser RoomUserList = 12;
  79. int64 TimeNow = 14;
  80. }
  81. message RoomUser {
  82. uint32 UserID = 1;
  83. repeated uint32 CardList = 2;
  84. float WinAmount = 3;
  85. bool IsMaster = 4;
  86. uint32 MasterMul = 5;
  87. uint32 Mul = 6;
  88. uint32 Status = 7;
  89. double Balance = 8;
  90. double Credits = 9;
  91. }
  92. message Game {
  93. Room Room = 1; //房间信息
  94. repeated RoomUser RoomUserList = 2;
  95. }
  96. message User {
  97. uint32 UserID = 1;
  98. string Name = 2;
  99. string Img = 3;
  100. }
  101. message Connect {
  102. uint32 UserID = 1;
  103. int64 LogID = 2;
  104. string Name = 3;
  105. string Img = 4;
  106. double Balance = 5;
  107. Game Game = 6;
  108. repeated Room RoomList = 7;
  109. repeated User UserList = 8;
  110. RoomDetail RoomDetail = 9; //用户当前房间的详情
  111. double Credits = 10;
  112. }
  113. message Disconnect {
  114. uint32 UserID = 1;
  115. }
  116. message JoinRoom {
  117. uint32 RoomID = 1;
  118. uint32 ChairID = 2;
  119. uint32 UserID = 3;
  120. uint32 GameStatus = 4;
  121. User User = 5;
  122. RoomDetail RoomDetail = 6;
  123. }
  124. message LeaveRoom {
  125. uint32 RoomID = 1;
  126. uint32 ChairID = 2;
  127. uint32 UserID = 3;
  128. User User = 5;
  129. }
  130. message CreateRoom {
  131. uint32 ID = 1;
  132. uint32 CreatorID = 11;
  133. string Name = 2;
  134. bool needPwd = 10;
  135. RoomType RoomType = 3;
  136. double BaseAmount = 4;
  137. uint32 ChairUserID1 = 5;
  138. uint32 ChairUserID2 = 6;
  139. uint32 ChairUserID3 = 7;
  140. uint32 ChairUserID4 = 8;
  141. uint32 ChairUserID5 = 9;
  142. }
  143. message Ready {
  144. uint32 RoomID = 1;
  145. uint32 UserID = 3;
  146. }
  147. message UnReady {
  148. uint32 RoomID = 1;
  149. uint32 UserID = 3;
  150. }
  151. //开始等待其他人准备
  152. message WaitReady {
  153. uint32 RoomID = 1;
  154. string Issue = 2;
  155. }
  156. //准备人数够,开始游戏
  157. message Start {
  158. uint32 RoomID = 1;
  159. repeated uint32 ChooseMasterMulList = 2; //抢庄倍数列表
  160. string issue = 3;
  161. repeated uint32 CardList = 4; //牌型列表
  162. }
  163. //选庄
  164. message ChooseMaster {
  165. uint32 UserID = 1;
  166. uint32 Mul = 2; //0,1,2,3 - 0表示不抢
  167. uint32 RoomID = 3;
  168. }
  169. //选倍数
  170. message ChooseMul {
  171. uint32 UserID = 1;
  172. uint32 Mul = 2; //1,2,3 - 倍数
  173. uint32 RoomID = 3;
  174. repeated uint32 CardList = 4; //牌型列表
  175. }
  176. //选庄完成
  177. message ChooseMasterFinish {
  178. uint32 MasterUserID = 1; //庄家的ID
  179. repeated uint32 MulList = 2; //倍数列表
  180. uint32 RoomID = 3;
  181. }
  182. //选倍数完成
  183. message ChooseMulFinish {
  184. uint32 RoomID = 3;
  185. }
  186. message PayoutInfo {
  187. uint32 UserID = 1;
  188. double Balance = 2;
  189. string winAmount = 3;
  190. bool isMaster = 4;
  191. double Credits = 5;
  192. }
  193. //选倍数完成
  194. message OpenFinish {
  195. uint32 RoomID = 1;
  196. repeated PayoutInfo PayoutInfoList = 2;
  197. }
  198. //开牌
  199. message Open {
  200. uint32 RoomID = 1;
  201. uint32 UserID = 2;
  202. repeated uint32 CardList = 3; //牌型列表
  203. }
  204. //游戏初始化
  205. message GameInit {
  206. uint32 RoomID = 1;
  207. }
  208. message GameRecordItem {
  209. int64 CreatedAt = 1;
  210. int64 RoomID = 2;
  211. int32 RoomType = 3;
  212. string Issue = 4;
  213. string OpenNumber = 5;
  214. string BaseAmount = 6;
  215. int32 IsDraw = 7;
  216. int64 DrawTime = 8;
  217. int32 IsMaster = 9;
  218. int32 MasterMul = 10;
  219. int32 Mul = 11;
  220. int32 IsWin = 12;
  221. string WinAmount = 13;
  222. }
  223. message GameRecordResp {
  224. int32 Total = 1;
  225. repeated GameRecordItem RecordList = 2;
  226. }
  227. message GameOpenRecordItem {
  228. int64 RoomID = 1;
  229. int32 RoomType = 2;
  230. string Issue = 3;
  231. string OpenNumber1 = 4;
  232. string OpenNumber2 = 5;
  233. string OpenNumber3 = 6;
  234. string OpenNumber4 = 7;
  235. string OpenNumber5 = 8;
  236. int64 OpenTime = 9;
  237. string Hash = 10;
  238. }
  239. message GameOpenRecordResp {
  240. int32 Total = 1;
  241. repeated GameOpenRecordItem OpenRecordList = 2;
  242. }