common.proto 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. syntax = "proto3";
  2. option go_package = "./msg";
  3. enum roleType {
  4. ROLE_TYPE_UNKNOWN = 0;
  5. RED = 1; // 无操作
  6. BLUE = 4;
  7. YELLOW = 3;
  8. GREEN = 2;
  9. }
  10. enum OptType {
  11. OPT_TYPE_UNKNOWN = 0;
  12. ZHI_SHAI_ZI = 1;
  13. SELECT_ROLE = 2;
  14. }
  15. enum roomType {
  16. ROOM_TYPE_UNKNOWN = 0;
  17. SHUANG_REN = 1;
  18. SIREN_REN = 2;
  19. }
  20. enum roomMode {
  21. ROOM_MODE_UNKNOWN = 0;
  22. REN_JI = 1;
  23. WAN_JIA = 2;
  24. }
  25. enum roadType {
  26. ROAD_TYPE_UNKNOWN = 0;
  27. HOME =1;
  28. }
  29. enum playerStatus {
  30. PLAYER_STATUS_UNKNOWN = 0;
  31. SZ_ANIMATION =1;
  32. COLOR_FINISH = 2;
  33. COLOR_KICK = 3;
  34. }
  35. enum roomStatus {
  36. AWAIT = 0;
  37. START = 1;
  38. END = 2;
  39. }
  40. message round {
  41. roleType m_color = 1;
  42. string m_road = 2;
  43. OptType opt = 3;
  44. int32 szNumber = 4;
  45. }
  46. message RoomInfo {
  47. repeated RoleData roles = 1;
  48. repeated ColorData colors = 2;
  49. roomType room_type = 3;
  50. roomMode room_mode = 4;
  51. roleType cur_round_color = 5;
  52. repeated round rounds = 6;
  53. repeated ColorData finish_colors = 7;
  54. repeated ColorData kict_colors = 8;
  55. int32 id = 9;
  56. int32 room_level = 10; //房间的每个等级都对应着不同的奖励和消耗
  57. roomStatus room_status = 11;
  58. }
  59. message RoleData {
  60. roleType m_color = 1;
  61. int32 m_seat = 2;
  62. string m_id = 3;
  63. roadType m_cur_road = 4;
  64. int32 step = 5;
  65. int32 old_setp = 6;
  66. }
  67. message ColorData {
  68. string m_id = 1;
  69. roleType m_color = 2;
  70. bool is_kick = 3;
  71. bool is_finish = 4;
  72. int32 time_out_num = 5;
  73. string m_name = 6;
  74. string m_head = 7;
  75. int32 rank_num = 8;
  76. int32 m_coin = 9;
  77. }
  78. message MoveStepData {
  79. string m_id = 1;
  80. int32 step = 2;
  81. int32 old_setp = 3;
  82. }
  83. message SendColorSz {
  84. roleType color = 1; //
  85. }
  86. message SendRoleMove {
  87. roleType color = 1; //
  88. string roleId = 2;
  89. }
  90. message NotifyPlayerSzNumber {
  91. roleType color = 1; //
  92. int32 szNumber = 2; //
  93. MsgError err_msg = 3;
  94. }
  95. message NotifyPlayerMove {
  96. roleType color = 1; //
  97. MoveStepData step = 2; //
  98. repeated RoleData kick = 3;
  99. }
  100. message NotifyPlayerOpt {
  101. roleType color = 1; //
  102. OptType opt = 2; //
  103. repeated RoleData canMoveRoles = 3;
  104. }
  105. message NotifyPlayerStatus {
  106. roleType color = 1; //
  107. playerStatus status = 2;
  108. repeated ColorData colors = 3;
  109. }
  110. message NotifySettlement {
  111. roleType color = 1; //
  112. repeated ColorData finish_colors = 2;
  113. }
  114. message NotifyUpdateRoomInfo {
  115. RoomInfo room_info = 1; //
  116. }
  117. //----------------------------------
  118. //用户信息
  119. message UserInfo {
  120. string UserId = 1;
  121. string m_head = 2;
  122. int32 m_coin = 3;
  123. string name = 4;
  124. int32 room_id = 5; //如果用户在某一个房间玩,他的id就一直存在,
  125. }
  126. //登录 请求
  127. message ReqLogin {
  128. string account = 1;
  129. string password = 2;
  130. }
  131. //登录 响应
  132. message ResLogin {
  133. string userId = 1;
  134. string nikeName = 2;
  135. UserInfo userInfo = 3;
  136. MsgError err_msg = 4;
  137. }
  138. //注册 请求
  139. message ReqRegister {
  140. string nikeName = 1;
  141. string account = 2;
  142. string password = 3;
  143. string m_head = 4;
  144. }
  145. //注册 响应
  146. message ResRegister {
  147. bool success = 1;
  148. MsgError err_msg = 2;
  149. }
  150. //进入大厅
  151. message EnterHall {
  152. string userId = 1;
  153. }
  154. //进入大厅响应
  155. message ResEnterHall {
  156. bool success = 1;
  157. MsgError err_msg = 2;
  158. RoomInfo reconnect_room_info = 3;
  159. }
  160. //离开大厅
  161. message LeaveHall {
  162. string userId = 1;
  163. }
  164. //匹配ludo
  165. message MatchLudo {
  166. roomType select_room_type = 1;
  167. int32 room_level = 2;
  168. roleType select_color = 3;
  169. }
  170. //匹配ludo 响应
  171. message ResMatchLudo {
  172. bool success = 1;
  173. MsgError err_msg = 2;
  174. RoomInfo room = 3;
  175. }
  176. //error
  177. message MsgError {
  178. int32 error_code = 1;
  179. string error_msg = 2;
  180. }
  181. message ResHeartBeat {
  182. string msg = 1;
  183. }
  184. message ReqHeartBeat {
  185. string msg = 1;
  186. }