common.proto 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  1. syntax = "proto3";
  2. package common_pack;
  3. option go_package = "./msg";
  4. enum roleType {
  5. ROLE_TYPE_UNKNOWN = 0;
  6. RED = 1; // 无操作
  7. BLUE = 4;
  8. YELLOW = 3;
  9. GREEN = 2;
  10. }
  11. enum OptType {
  12. OPT_TYPE_UNKNOWN = 0;
  13. ZHI_SHAI_ZI = 1;
  14. SELECT_ROLE = 2;
  15. }
  16. enum roomType {
  17. ROOM_TYPE_UNKNOWN = 0;
  18. SHUANG_REN = 1;
  19. SIREN_REN = 2;
  20. }
  21. enum roomMode {
  22. ROOM_MODE_UNKNOWN = 0;
  23. REN_JI = 1;
  24. WAN_JIA = 2;
  25. }
  26. enum roadType {
  27. ROAD_TYPE_UNKNOWN = 0;
  28. HOME =1;
  29. }
  30. enum playerStatus {
  31. PLAYER_STATUS_UNKNOWN = 0;
  32. SZ_ANIMATION =1;
  33. COLOR_FINISH = 2;
  34. COLOR_KICK = 3;
  35. COLOR_TIME_OUT = 4;
  36. }
  37. enum roomStatus {
  38. AWAIT = 0;
  39. START = 1;
  40. END = 2;
  41. }
  42. message round {
  43. roleType m_color = 1;
  44. string m_road = 2;
  45. OptType opt = 3;
  46. int32 szNumber = 4;
  47. }
  48. message RoomInfo {
  49. repeated RoleData roles = 1;
  50. repeated ColorData colors = 2;
  51. roomType room_type = 3;
  52. roomMode room_mode = 4;
  53. roleType cur_round_color = 5; //当前那个阵营的回合
  54. repeated round rounds = 6;
  55. repeated ColorData finish_colors = 7;
  56. repeated ColorData kict_colors = 8;
  57. int32 id = 9;
  58. int32 room_level = 10; //房间的每个等级都对应着不同的奖励和消耗
  59. roomStatus room_status = 11;
  60. NotifyPlayerOpt cur_color_opt_data = 12; //当前阵营操作的类型
  61. int32 opt_time = 13; //玩家当前剩余操作时间
  62. }
  63. message RoleData {
  64. roleType m_color = 1;
  65. int32 m_seat = 2;
  66. string m_id = 3;
  67. roadType m_cur_road = 4;
  68. int32 step = 5;
  69. int32 old_setp = 6;
  70. }
  71. message ColorData {
  72. string m_id = 1;
  73. roleType m_color = 2;
  74. bool is_kick = 3;
  75. bool is_finish = 4;
  76. int32 time_out_num = 5;
  77. string m_name = 6;
  78. string m_head = 7;
  79. int32 rank_num = 8;
  80. int32 m_coin = 9;
  81. int32 m_reward_coin = 10;
  82. }
  83. message MoveStepData {
  84. string m_id = 1;
  85. int32 step = 2;
  86. int32 old_setp = 3;
  87. }
  88. message SendColorSz {
  89. roleType color = 1; //
  90. }
  91. message SendRoleMove {
  92. roleType color = 1; //
  93. string roleId = 2;
  94. }
  95. message SendQuitRoom {
  96. roleType color = 1; //
  97. }
  98. message NotifyPlayerSzNumber {
  99. roleType color = 1; //
  100. int32 szNumber = 2; //
  101. MsgError err_msg = 3;
  102. }
  103. message NotifyPlayerMove {
  104. roleType color = 1; //
  105. MoveStepData step = 2; //
  106. repeated RoleData kick = 3;
  107. }
  108. message NotifyPlayerOpt {
  109. roleType color = 1; //
  110. OptType opt = 2; //
  111. repeated RoleData canMoveRoles = 3;
  112. int32 opt_time = 4;
  113. }
  114. message NotifyPlayerStatus {
  115. roleType color = 1; //
  116. playerStatus status = 2;
  117. repeated ColorData colors = 3;
  118. ColorData time_out_color = 4;
  119. }
  120. message NotifySettlement {
  121. roleType color = 1; //
  122. repeated ColorData finish_colors = 2;
  123. }
  124. message NotifyUpdateRoomInfo {
  125. RoomInfo room_info = 1; //
  126. }
  127. //----------------------------------
  128. //用户信息
  129. message UserInfo {
  130. string UserId = 1;
  131. string m_head = 2;
  132. int32 m_coin = 3;
  133. string name = 4;
  134. int32 room_id = 5; //如果用户在某一个房间玩,他的id就一直存在,
  135. int32 online_status = 6;//在线=1 离线等0
  136. }
  137. //登录 请求
  138. message ReqLogin {
  139. string account = 1;
  140. string password = 2;
  141. }
  142. //登录 响应
  143. message ResLogin {
  144. string userId = 1;
  145. string nikeName = 2;
  146. UserInfo userInfo = 3;
  147. MsgError err_msg = 4;
  148. }
  149. //注册 请求
  150. message ReqRegister {
  151. string nikeName = 1;
  152. string account = 2;
  153. string password = 3;
  154. string m_head = 4;
  155. }
  156. //注册 响应
  157. message ResRegister {
  158. bool success = 1;
  159. MsgError err_msg = 2;
  160. }
  161. //进入大厅
  162. message EnterHall {
  163. string userId = 1;
  164. }
  165. //进入大厅响应
  166. message ResEnterHall {
  167. bool success = 1;
  168. MsgError err_msg = 2;
  169. RoomInfo reconnect_room_info = 3;
  170. }
  171. //离开大厅
  172. message LeaveHall {
  173. string userId = 1;
  174. }
  175. //匹配ludo
  176. message MatchLudo {
  177. roomType select_room_type = 1;
  178. int32 room_level = 2;
  179. roleType select_color = 3;
  180. }
  181. //匹配ludo 响应
  182. message ResMatchLudo {
  183. bool success = 1;
  184. MsgError err_msg = 2;
  185. RoomInfo room = 3;
  186. }
  187. //error
  188. message MsgError {
  189. int32 error_code = 1;
  190. string error_msg = 2;
  191. }
  192. // 更新用户信息
  193. message UpdateUserInfo {
  194. UserInfo info = 1;
  195. }
  196. message ResHeartBeat {
  197. string msg = 1;
  198. }
  199. message ReqHeartBeat {
  200. string msg = 1;
  201. }
  202. message ShopItem{
  203. string name = 1;
  204. string id = 2;
  205. int32 price = 3;
  206. int32 num = 4;
  207. }
  208. //被踢登陆
  209. message BeKickLogin {
  210. MsgError err_msg = 1;
  211. }
  212. // 请求商城
  213. message ReqShop {
  214. int32 shopType = 1;
  215. }
  216. // 响应商城
  217. message ResShop {
  218. bool success = 1;
  219. MsgError err_msg = 2;
  220. repeated ShopItem list = 3;
  221. }
  222. message HistoryRecord{
  223. int32 id = 1;
  224. int32 room_id = 2;
  225. string user_id = 3;
  226. string time = 4;
  227. }
  228. message ReqLudoHistory{
  229. string user_id = 1;
  230. }
  231. message ResLudoHistory{
  232. bool success = 1;
  233. MsgError err_msg = 2;
  234. repeated HistoryRecord list = 3;
  235. }
  236. message ReqLudoRoomInfo{
  237. int64 room_id = 1;
  238. }
  239. message ResLudoRoomInfo{
  240. bool success = 1;
  241. MsgError err_msg = 2;
  242. RoomInfo info = 3;
  243. }
  244. message BuyShopItem{
  245. string id = 1;
  246. }
  247. //好友请求的结构
  248. message RequestAddFriendItem{
  249. int32 id = 1;
  250. string RequestID = 2; //请求id
  251. string FromUserID = 3;
  252. string ToUserID = 4;
  253. int32 Status = 5; //状态
  254. string Message = 6;
  255. }
  256. //请求好友列表
  257. message ReqFriendList{
  258. string user_id = 1;
  259. }
  260. //响应好友列表请求,暂时没做分页
  261. message ResFriendList{
  262. bool success = 1;
  263. MsgError err_msg = 2;
  264. repeated UserInfo list = 3;
  265. }
  266. //请求好友申请单个数据
  267. message FriendRequestItem{
  268. UserInfo info = 1;
  269. string request_msg = 2;
  270. string create_time = 3;
  271. int32 status = 4;
  272. }
  273. //请求好友申请列表
  274. message ReqFriendRequestList{
  275. string user_id = 1;
  276. }
  277. //响应好友申请列表请求,暂时没做分页
  278. message ResFriendRequestList{
  279. bool success = 1;
  280. MsgError err_msg = 2;
  281. repeated FriendRequestItem list = 3;
  282. }
  283. //请求添加好友
  284. message ReqAddFriend{
  285. string ToUserID = 1;
  286. string msg = 2;
  287. }
  288. //客户端接收到请求消息
  289. message RecvAddFriendRequest{
  290. UserInfo info = 1;
  291. }
  292. //接收到的玩家对消息进行操作
  293. message OptAddFriendRequest{
  294. RequestAddFriendItem info = 1;
  295. }
  296. //通知请求的玩家,对方的操作结果
  297. message NotifyOptFriend{
  298. RequestAddFriendItem info = 1;
  299. }
  300. //根据玩家id搜索玩家
  301. message SearchUser{
  302. string user_id = 1;
  303. }
  304. //响应搜索结果
  305. message ResSearchUser{
  306. bool success = 1;
  307. MsgError err_msg = 2;
  308. UserInfo info = 3;
  309. }
  310. //删除好友
  311. message ReqDeleteFriend{
  312. string ToUserID = 1;
  313. }
  314. //删除好友响应
  315. message ResDeleteFriend{
  316. bool success = 1;
  317. MsgError err_msg = 2;
  318. }
  319. //好友上线/下线响应
  320. message ResFriendOnLineStatus{
  321. bool success = 1;
  322. MsgError err_msg = 2;
  323. UserInfo info = 3;
  324. }
  325. //聊天消息
  326. message ChatMessage{
  327. int32 id = 1;
  328. string session_id = 2;
  329. string sender_id = 3;
  330. string content = 4;
  331. string created_at = 5;
  332. string content_type = 6;
  333. }
  334. //发送聊天内容
  335. message ReqSendChatMsg{
  336. string content_type = 1; //消息类型
  337. string to_userid = 2; //发送给谁
  338. string content = 3; //消息内容
  339. }
  340. message ResSendChatMsg{
  341. bool success = 1;
  342. MsgError err_msg = 2;
  343. }
  344. //接收聊天内容
  345. message RecvChatMsg{
  346. ChatMessage info = 1;
  347. }
  348. //请求获取聊天历史
  349. message ReqChatHistory{
  350. string to_userid = 1;
  351. int32 last_msgid = 2;
  352. }
  353. //响应获取聊天历史
  354. message ResChatHistory{
  355. bool success = 1;
  356. MsgError err_msg = 2;
  357. repeated ChatMessage list = 3;
  358. }