common.proto 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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. NotifyPlayerOpt cur_color_opt_data = 12;
  59. }
  60. message RoleData {
  61. roleType m_color = 1;
  62. int32 m_seat = 2;
  63. string m_id = 3;
  64. roadType m_cur_road = 4;
  65. int32 step = 5;
  66. int32 old_setp = 6;
  67. }
  68. message ColorData {
  69. string m_id = 1;
  70. roleType m_color = 2;
  71. bool is_kick = 3;
  72. bool is_finish = 4;
  73. int32 time_out_num = 5;
  74. string m_name = 6;
  75. string m_head = 7;
  76. int32 rank_num = 8;
  77. int32 m_coin = 9;
  78. }
  79. message MoveStepData {
  80. string m_id = 1;
  81. int32 step = 2;
  82. int32 old_setp = 3;
  83. }
  84. message SendColorSz {
  85. roleType color = 1; //
  86. }
  87. message SendRoleMove {
  88. roleType color = 1; //
  89. string roleId = 2;
  90. }
  91. message NotifyPlayerSzNumber {
  92. roleType color = 1; //
  93. int32 szNumber = 2; //
  94. MsgError err_msg = 3;
  95. }
  96. message NotifyPlayerMove {
  97. roleType color = 1; //
  98. MoveStepData step = 2; //
  99. repeated RoleData kick = 3;
  100. }
  101. message NotifyPlayerOpt {
  102. roleType color = 1; //
  103. OptType opt = 2; //
  104. repeated RoleData canMoveRoles = 3;
  105. }
  106. message NotifyPlayerStatus {
  107. roleType color = 1; //
  108. playerStatus status = 2;
  109. repeated ColorData colors = 3;
  110. }
  111. message NotifySettlement {
  112. roleType color = 1; //
  113. repeated ColorData finish_colors = 2;
  114. }
  115. message NotifyUpdateRoomInfo {
  116. RoomInfo room_info = 1; //
  117. }
  118. //----------------------------------
  119. //用户信息
  120. message UserInfo {
  121. string UserId = 1;
  122. string m_head = 2;
  123. int32 m_coin = 3;
  124. string name = 4;
  125. int32 room_id = 5; //如果用户在某一个房间玩,他的id就一直存在,
  126. }
  127. //登录 请求
  128. message ReqLogin {
  129. string account = 1;
  130. string password = 2;
  131. }
  132. //登录 响应
  133. message ResLogin {
  134. string userId = 1;
  135. string nikeName = 2;
  136. UserInfo userInfo = 3;
  137. MsgError err_msg = 4;
  138. }
  139. //注册 请求
  140. message ReqRegister {
  141. string nikeName = 1;
  142. string account = 2;
  143. string password = 3;
  144. string m_head = 4;
  145. }
  146. //注册 响应
  147. message ResRegister {
  148. bool success = 1;
  149. MsgError err_msg = 2;
  150. }
  151. //进入大厅
  152. message EnterHall {
  153. string userId = 1;
  154. }
  155. //进入大厅响应
  156. message ResEnterHall {
  157. bool success = 1;
  158. MsgError err_msg = 2;
  159. RoomInfo reconnect_room_info = 3;
  160. }
  161. //离开大厅
  162. message LeaveHall {
  163. string userId = 1;
  164. }
  165. //匹配ludo
  166. message MatchLudo {
  167. roomType select_room_type = 1;
  168. int32 room_level = 2;
  169. roleType select_color = 3;
  170. }
  171. //匹配ludo 响应
  172. message ResMatchLudo {
  173. bool success = 1;
  174. MsgError err_msg = 2;
  175. RoomInfo room = 3;
  176. }
  177. //error
  178. message MsgError {
  179. int32 error_code = 1;
  180. string error_msg = 2;
  181. }
  182. message ResHeartBeat {
  183. string msg = 1;
  184. }
  185. message ReqHeartBeat {
  186. string msg = 1;
  187. }