common.proto 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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. int32 m_reward_coin = 10;
  81. }
  82. message MoveStepData {
  83. string m_id = 1;
  84. int32 step = 2;
  85. int32 old_setp = 3;
  86. }
  87. message SendColorSz {
  88. roleType color = 1; //
  89. }
  90. message SendRoleMove {
  91. roleType color = 1; //
  92. string roleId = 2;
  93. }
  94. message NotifyPlayerSzNumber {
  95. roleType color = 1; //
  96. int32 szNumber = 2; //
  97. MsgError err_msg = 3;
  98. }
  99. message NotifyPlayerMove {
  100. roleType color = 1; //
  101. MoveStepData step = 2; //
  102. repeated RoleData kick = 3;
  103. }
  104. message NotifyPlayerOpt {
  105. roleType color = 1; //
  106. OptType opt = 2; //
  107. repeated RoleData canMoveRoles = 3;
  108. int32 opt_time = 4;
  109. }
  110. message NotifyPlayerStatus {
  111. roleType color = 1; //
  112. playerStatus status = 2;
  113. repeated ColorData colors = 3;
  114. ColorData time_out_color = 4;
  115. }
  116. message NotifySettlement {
  117. roleType color = 1; //
  118. repeated ColorData finish_colors = 2;
  119. }
  120. message NotifyUpdateRoomInfo {
  121. RoomInfo room_info = 1; //
  122. }
  123. //----------------------------------
  124. //用户信息
  125. message UserInfo {
  126. string UserId = 1;
  127. string m_head = 2;
  128. int32 m_coin = 3;
  129. string name = 4;
  130. int32 room_id = 5; //如果用户在某一个房间玩,他的id就一直存在,
  131. }
  132. //登录 请求
  133. message ReqLogin {
  134. string account = 1;
  135. string password = 2;
  136. }
  137. //登录 响应
  138. message ResLogin {
  139. string userId = 1;
  140. string nikeName = 2;
  141. UserInfo userInfo = 3;
  142. MsgError err_msg = 4;
  143. }
  144. //注册 请求
  145. message ReqRegister {
  146. string nikeName = 1;
  147. string account = 2;
  148. string password = 3;
  149. string m_head = 4;
  150. }
  151. //注册 响应
  152. message ResRegister {
  153. bool success = 1;
  154. MsgError err_msg = 2;
  155. }
  156. //进入大厅
  157. message EnterHall {
  158. string userId = 1;
  159. }
  160. //进入大厅响应
  161. message ResEnterHall {
  162. bool success = 1;
  163. MsgError err_msg = 2;
  164. RoomInfo reconnect_room_info = 3;
  165. }
  166. //离开大厅
  167. message LeaveHall {
  168. string userId = 1;
  169. }
  170. //匹配ludo
  171. message MatchLudo {
  172. roomType select_room_type = 1;
  173. int32 room_level = 2;
  174. roleType select_color = 3;
  175. }
  176. //匹配ludo 响应
  177. message ResMatchLudo {
  178. bool success = 1;
  179. MsgError err_msg = 2;
  180. RoomInfo room = 3;
  181. }
  182. //error
  183. message MsgError {
  184. int32 error_code = 1;
  185. string error_msg = 2;
  186. }
  187. // 更新用户信息
  188. message UpdateUserInfo {
  189. UserInfo info = 1;
  190. }
  191. message ResHeartBeat {
  192. string msg = 1;
  193. }
  194. message ReqHeartBeat {
  195. string msg = 1;
  196. }
  197. message ShopItem{
  198. string name = 1;
  199. string id = 2;
  200. int32 price = 3;
  201. }
  202. //被踢登陆
  203. message BeKickLogin {
  204. MsgError err_msg = 1;
  205. }
  206. // 请求商城
  207. message ReqShop {
  208. int32 shopType = 1;
  209. }
  210. // 响应商城
  211. message ResShop {
  212. bool success = 1;
  213. MsgError err_msg = 2;
  214. repeated ShopItem list = 3;
  215. }