common.proto 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  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. //----------------------------------
  115. //用户信息
  116. message UserInfo {
  117. string UserId = 1;
  118. string m_head = 2;
  119. int32 m_coin = 3;
  120. string name = 4;
  121. int32 room_id = 5; //如果用户在某一个房间玩,他的id就一直存在,
  122. }
  123. //登录 请求
  124. message ReqLogin {
  125. string account = 1;
  126. string password = 2;
  127. }
  128. //登录 响应
  129. message ResLogin {
  130. string userId = 1;
  131. string nikeName = 2;
  132. UserInfo userInfo = 3;
  133. MsgError err_msg = 4;
  134. }
  135. //注册 请求
  136. message ReqRegister {
  137. string nikeName = 1;
  138. string account = 2;
  139. string password = 3;
  140. string m_head = 4;
  141. }
  142. //注册 响应
  143. message ResRegister {
  144. bool success = 1;
  145. MsgError err_msg = 2;
  146. }
  147. //进入大厅
  148. message EnterHall {
  149. string userId = 1;
  150. }
  151. //进入大厅响应
  152. message ResEnterHall {
  153. bool success = 1;
  154. MsgError err_msg = 2;
  155. }
  156. //离开大厅
  157. message LeaveHall {
  158. string userId = 1;
  159. }
  160. //匹配ludo
  161. message MatchLudo {
  162. roomType select_room_type = 1;
  163. int32 room_level = 2;
  164. roleType select_color = 3;
  165. }
  166. //匹配ludo 响应
  167. message ResMatchLudo {
  168. bool success = 1;
  169. MsgError err_msg = 2;
  170. RoomInfo room = 3;
  171. }
  172. //error
  173. message MsgError {
  174. int32 error_code = 1;
  175. string error_msg = 2;
  176. }
  177. message ResHeartBeat {
  178. string msg = 1;
  179. }
  180. message ReqHeartBeat {
  181. string msg = 1;
  182. }