game.proto 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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. NotifyTypeChooseMulinish = 12;
  19. NotifyTypeGameInit = 13;
  20. NotifyTypeOpen = 14;
  21. NotifyTypeOpenFinish = 15;
  22. NotifyTypeMsgResp = 16; //简单的返回
  23. }
  24. enum DataType {
  25. DataTypeNormal = 0; //0x00000000
  26. DataTypeGZip = 2; //0x00000010
  27. DataTypeEnc = 4; //0x00000100
  28. }
  29. enum RoomType {
  30. RoomTypeFree = 0;
  31. RoomTypeNormal = 1;
  32. }
  33. enum RespStatus {
  34. RespStatusSucc = 0;
  35. RespStatusFailed = 1;
  36. }
  37. //Ping
  38. message Ping {
  39. }
  40. message MsgResp {
  41. string once = 1;
  42. RespStatus status = 2;
  43. string msg = 3;
  44. google.protobuf.Any data = 4;
  45. }
  46. message Room {
  47. uint32 ID = 1;
  48. string Name = 2;
  49. bool needPwd = 10;
  50. RoomType RoomType = 3;
  51. double BaseAmount = 4;
  52. uint32 ChairUserID1 = 5;
  53. uint32 ChairUserID2 = 6;
  54. uint32 ChairUserID3 = 7;
  55. uint32 ChairUserID4 = 8;
  56. uint32 ChairUserID5 = 9;
  57. }
  58. message Connect {
  59. uint32 UserID = 1;
  60. int64 LogID = 2;
  61. string Name = 3;
  62. string Img = 4;
  63. double Balance = 5;
  64. repeated Room RoomList = 6;
  65. }
  66. message Disconnect {
  67. uint32 UserID = 1;
  68. }
  69. message JoinRoom {
  70. uint32 RoomID = 1;
  71. uint32 ChairID = 2;
  72. uint32 UserID = 3;
  73. uint32 GameStatus = 4;
  74. }
  75. message LeaveRoom {
  76. uint32 RoomID = 1;
  77. uint32 ChairID = 2;
  78. uint32 UserID = 3;
  79. }
  80. message CreateRoom {
  81. uint32 ID = 1;
  82. string Name = 2;
  83. bool needPwd = 10;
  84. RoomType RoomType = 3;
  85. double BaseAmount = 4;
  86. uint32 ChairUserID1 = 5;
  87. uint32 ChairUserID2 = 6;
  88. uint32 ChairUserID3 = 7;
  89. uint32 ChairUserID4 = 8;
  90. uint32 ChairUserID5 = 9;
  91. }
  92. message Ready {
  93. uint32 RoomID = 1;
  94. uint32 UserID = 3;
  95. }
  96. message UnReady {
  97. uint32 RoomID = 1;
  98. uint32 UserID = 3;
  99. }
  100. //准备人数够,开始游戏
  101. message Start {
  102. uint32 RoomID = 1;
  103. repeated uint32 ChooseMasterMulList = 2; //抢庄倍数列表
  104. string issue = 3;
  105. }
  106. //选庄
  107. message ChooseMaster {
  108. uint32 UserID = 1;
  109. uint32 Mul = 2; //0,1,2,3 - 0表示不抢
  110. uint32 RoomID = 3;
  111. }
  112. //选倍数
  113. message ChooseMul {
  114. uint32 UserID = 1;
  115. uint32 Mul = 2; //1,2,3 - 倍数
  116. uint32 RoomID = 3;
  117. }
  118. //选庄完成
  119. message ChooseMasterFinish {
  120. uint32 MasterUserID = 1; //庄家的ID
  121. repeated uint32 MulList = 2; //倍数列表
  122. uint32 RoomID = 3;
  123. }
  124. //选倍数完成
  125. message ChooseMulFinish {
  126. uint32 RoomID = 3;
  127. }
  128. message PayoutInfo {
  129. uint32 UserID = 1;
  130. float winAmount = 2;
  131. bool isMaster = 3;
  132. }
  133. //选倍数完成
  134. message OpenFinish {
  135. uint32 RoomID = 1;
  136. repeated PayoutInfo PayoutInfoList = 2;
  137. }
  138. //开牌
  139. message Open {
  140. uint32 RoomID = 1;
  141. uint32 UserID = 2;
  142. repeated uint32 CardList = 3; //牌型列表
  143. }
  144. //游戏初始化
  145. message GameInit {
  146. uint32 RoomID = 1;
  147. }