common.proto 4.3 KB

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