common.proto 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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. COLOR_TIME_OUT = 4;
  35. }
  36. enum roomStatus {
  37. AWAIT = 0;
  38. START = 1;
  39. END = 2;
  40. }
  41. message round {
  42. roleType m_color = 1;
  43. string m_road = 2;
  44. OptType opt = 3;
  45. int32 szNumber = 4;
  46. }
  47. message RoomInfo {
  48. repeated RoleData roles = 1;
  49. repeated ColorData colors = 2;
  50. roomType room_type = 3;
  51. roomMode room_mode = 4;
  52. roleType cur_round_color = 5; //当前那个阵营的回合
  53. repeated round rounds = 6;
  54. repeated ColorData finish_colors = 7;
  55. repeated ColorData kict_colors = 8;
  56. int32 id = 9;
  57. int32 room_level = 10; //房间的每个等级都对应着不同的奖励和消耗
  58. roomStatus room_status = 11;
  59. NotifyPlayerOpt cur_color_opt_data = 12; //当前阵营操作的类型
  60. int32 opt_time = 13; //玩家当前剩余操作时间
  61. }
  62. message RoleData {
  63. roleType m_color = 1;
  64. int32 m_seat = 2;
  65. string m_id = 3;
  66. roadType m_cur_road = 4;
  67. int32 step = 5;
  68. int32 old_setp = 6;
  69. }
  70. message ColorData {
  71. string m_id = 1;
  72. roleType m_color = 2;
  73. bool is_kick = 3;
  74. bool is_finish = 4;
  75. int32 time_out_num = 5;
  76. string m_name = 6;
  77. string m_head = 7;
  78. int32 rank_num = 8;
  79. int32 m_coin = 9;
  80. }
  81. message MoveStepData {
  82. string m_id = 1;
  83. int32 step = 2;
  84. int32 old_setp = 3;
  85. }
  86. message SendColorSz {
  87. roleType color = 1; //
  88. }
  89. message SendRoleMove {
  90. roleType color = 1; //
  91. string roleId = 2;
  92. }
  93. message NotifyPlayerSzNumber {
  94. roleType color = 1; //
  95. int32 szNumber = 2; //
  96. MsgError err_msg = 3;
  97. }
  98. message NotifyPlayerMove {
  99. roleType color = 1; //
  100. MoveStepData step = 2; //
  101. repeated RoleData kick = 3;
  102. }
  103. message NotifyPlayerOpt {
  104. roleType color = 1; //
  105. OptType opt = 2; //
  106. repeated RoleData canMoveRoles = 3;
  107. int32 opt_time = 4;
  108. }
  109. message NotifyPlayerStatus {
  110. roleType color = 1; //
  111. playerStatus status = 2;
  112. repeated ColorData colors = 3;
  113. ColorData time_out_color = 4;
  114. }
  115. message NotifySettlement {
  116. roleType color = 1; //
  117. repeated ColorData finish_colors = 2;
  118. }
  119. message NotifyUpdateRoomInfo {
  120. RoomInfo room_info = 1; //
  121. }
  122. //----------------------------------
  123. //用户信息
  124. message UserInfo {
  125. string UserId = 1;
  126. string m_head = 2;
  127. int32 m_coin = 3;
  128. string name = 4;
  129. int32 room_id = 5; //如果用户在某一个房间玩,他的id就一直存在,
  130. }
  131. //登录 请求
  132. message ReqLogin {
  133. string account = 1;
  134. string password = 2;
  135. }
  136. //登录 响应
  137. message ResLogin {
  138. string userId = 1;
  139. string nikeName = 2;
  140. UserInfo userInfo = 3;
  141. MsgError err_msg = 4;
  142. }
  143. //注册 请求
  144. message ReqRegister {
  145. string nikeName = 1;
  146. string account = 2;
  147. string password = 3;
  148. string m_head = 4;
  149. }
  150. //注册 响应
  151. message ResRegister {
  152. bool success = 1;
  153. MsgError err_msg = 2;
  154. }
  155. //进入大厅
  156. message EnterHall {
  157. string userId = 1;
  158. }
  159. //进入大厅响应
  160. message ResEnterHall {
  161. bool success = 1;
  162. MsgError err_msg = 2;
  163. RoomInfo reconnect_room_info = 3;
  164. }
  165. //离开大厅
  166. message LeaveHall {
  167. string userId = 1;
  168. }
  169. //匹配ludo
  170. message MatchLudo {
  171. roomType select_room_type = 1;
  172. int32 room_level = 2;
  173. roleType select_color = 3;
  174. }
  175. //匹配ludo 响应
  176. message ResMatchLudo {
  177. bool success = 1;
  178. MsgError err_msg = 2;
  179. RoomInfo room = 3;
  180. }
  181. //被踢登陆
  182. message BeKickLogin {
  183. MsgError err_msg = 1;
  184. }
  185. //error
  186. message MsgError {
  187. int32 error_code = 1;
  188. string error_msg = 2;
  189. }
  190. message ResHeartBeat {
  191. string msg = 1;
  192. }
  193. message ReqHeartBeat {
  194. string msg = 1;
  195. }