Bundle.js 52 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065
  1. /*eslint-disable block-scoped-var, no-redeclare, no-control-regex, no-prototype-builtins*/
  2. (function(global, factory) { /* global define, require, module */
  3. /* AMD */ if (typeof define === 'function' && define.amd)
  4. define(["protobufjs/minimal"], factory);
  5. /* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports)
  6. module.exports = factory(require("protobufjs/minimal"));
  7. })(this, function($protobuf) {
  8. "use strict";
  9. // Common aliases
  10. var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
  11. // Exported root namespace
  12. var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});
  13. $root.tutorial = (function() {
  14. /**
  15. * Namespace tutorial.
  16. * @exports tutorial
  17. * @namespace
  18. */
  19. var tutorial = {};
  20. tutorial.Message = (function() {
  21. /**
  22. * Properties of a Message.
  23. * @memberof tutorial
  24. * @interface IMessage
  25. * @property {tutorial.Message.Type|null} [type] Message type
  26. * @property {tutorial.Message.IDataMessage|null} [dataMessage] Message dataMessage
  27. * @property {tutorial.Message.INotificationMessage|null} [notificationMessage] Message notificationMessage
  28. * @property {tutorial.Message.IRoleOptMessage|null} [roleOptMessage] Message roleOptMessage
  29. * @property {string|null} [msg] Message msg
  30. */
  31. /**
  32. * Constructs a new Message.
  33. * @memberof tutorial
  34. * @classdesc Represents a Message.
  35. * @implements IMessage
  36. * @constructor
  37. * @param {tutorial.IMessage=} [properties] Properties to set
  38. */
  39. function Message(properties) {
  40. if (properties)
  41. for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
  42. if (properties[keys[i]] != null)
  43. this[keys[i]] = properties[keys[i]];
  44. }
  45. /**
  46. * Message type.
  47. * @member {tutorial.Message.Type} type
  48. * @memberof tutorial.Message
  49. * @instance
  50. */
  51. Message.prototype.type = 0;
  52. /**
  53. * Message dataMessage.
  54. * @member {tutorial.Message.IDataMessage|null|undefined} dataMessage
  55. * @memberof tutorial.Message
  56. * @instance
  57. */
  58. Message.prototype.dataMessage = null;
  59. /**
  60. * Message notificationMessage.
  61. * @member {tutorial.Message.INotificationMessage|null|undefined} notificationMessage
  62. * @memberof tutorial.Message
  63. * @instance
  64. */
  65. Message.prototype.notificationMessage = null;
  66. /**
  67. * Message roleOptMessage.
  68. * @member {tutorial.Message.IRoleOptMessage|null|undefined} roleOptMessage
  69. * @memberof tutorial.Message
  70. * @instance
  71. */
  72. Message.prototype.roleOptMessage = null;
  73. /**
  74. * Message msg.
  75. * @member {string} msg
  76. * @memberof tutorial.Message
  77. * @instance
  78. */
  79. Message.prototype.msg = "";
  80. /**
  81. * Creates a new Message instance using the specified properties.
  82. * @function create
  83. * @memberof tutorial.Message
  84. * @static
  85. * @param {tutorial.IMessage=} [properties] Properties to set
  86. * @returns {tutorial.Message} Message instance
  87. */
  88. Message.create = function create(properties) {
  89. return new Message(properties);
  90. };
  91. /**
  92. * Encodes the specified Message message. Does not implicitly {@link tutorial.Message.verify|verify} messages.
  93. * @function encode
  94. * @memberof tutorial.Message
  95. * @static
  96. * @param {tutorial.IMessage} message Message message or plain object to encode
  97. * @param {$protobuf.Writer} [writer] Writer to encode to
  98. * @returns {$protobuf.Writer} Writer
  99. */
  100. Message.encode = function encode(message, writer) {
  101. if (!writer)
  102. writer = $Writer.create();
  103. if (message.type != null && message.hasOwnProperty("type"))
  104. writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type);
  105. if (message.dataMessage != null && message.hasOwnProperty("dataMessage"))
  106. $root.tutorial.Message.DataMessage.encode(message.dataMessage, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
  107. if (message.notificationMessage != null && message.hasOwnProperty("notificationMessage"))
  108. $root.tutorial.Message.NotificationMessage.encode(message.notificationMessage, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
  109. if (message.roleOptMessage != null && message.hasOwnProperty("roleOptMessage"))
  110. $root.tutorial.Message.RoleOptMessage.encode(message.roleOptMessage, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim();
  111. if (message.msg != null && message.hasOwnProperty("msg"))
  112. writer.uint32(/* id 6, wireType 2 =*/50).string(message.msg);
  113. return writer;
  114. };
  115. /**
  116. * Encodes the specified Message message, length delimited. Does not implicitly {@link tutorial.Message.verify|verify} messages.
  117. * @function encodeDelimited
  118. * @memberof tutorial.Message
  119. * @static
  120. * @param {tutorial.IMessage} message Message message or plain object to encode
  121. * @param {$protobuf.Writer} [writer] Writer to encode to
  122. * @returns {$protobuf.Writer} Writer
  123. */
  124. Message.encodeDelimited = function encodeDelimited(message, writer) {
  125. return this.encode(message, writer).ldelim();
  126. };
  127. /**
  128. * Decodes a Message message from the specified reader or buffer.
  129. * @function decode
  130. * @memberof tutorial.Message
  131. * @static
  132. * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
  133. * @param {number} [length] Message length if known beforehand
  134. * @returns {tutorial.Message} Message
  135. * @throws {Error} If the payload is not a reader or valid buffer
  136. * @throws {$protobuf.util.ProtocolError} If required fields are missing
  137. */
  138. Message.decode = function decode(reader, length) {
  139. if (!(reader instanceof $Reader))
  140. reader = $Reader.create(reader);
  141. var end = length === undefined ? reader.len : reader.pos + length, message = new $root.tutorial.Message();
  142. while (reader.pos < end) {
  143. var tag = reader.uint32();
  144. switch (tag >>> 3) {
  145. case 1:
  146. message.type = reader.int32();
  147. break;
  148. case 2:
  149. message.dataMessage = $root.tutorial.Message.DataMessage.decode(reader, reader.uint32());
  150. break;
  151. case 3:
  152. message.notificationMessage = $root.tutorial.Message.NotificationMessage.decode(reader, reader.uint32());
  153. break;
  154. case 4:
  155. message.roleOptMessage = $root.tutorial.Message.RoleOptMessage.decode(reader, reader.uint32());
  156. break;
  157. case 6:
  158. message.msg = reader.string();
  159. break;
  160. default:
  161. reader.skipType(tag & 7);
  162. break;
  163. }
  164. }
  165. return message;
  166. };
  167. /**
  168. * Decodes a Message message from the specified reader or buffer, length delimited.
  169. * @function decodeDelimited
  170. * @memberof tutorial.Message
  171. * @static
  172. * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
  173. * @returns {tutorial.Message} Message
  174. * @throws {Error} If the payload is not a reader or valid buffer
  175. * @throws {$protobuf.util.ProtocolError} If required fields are missing
  176. */
  177. Message.decodeDelimited = function decodeDelimited(reader) {
  178. if (!(reader instanceof $Reader))
  179. reader = new $Reader(reader);
  180. return this.decode(reader, reader.uint32());
  181. };
  182. /**
  183. * Verifies a Message message.
  184. * @function verify
  185. * @memberof tutorial.Message
  186. * @static
  187. * @param {Object.<string,*>} message Plain object to verify
  188. * @returns {string|null} `null` if valid, otherwise the reason why it is not
  189. */
  190. Message.verify = function verify(message) {
  191. if (typeof message !== "object" || message === null)
  192. return "object expected";
  193. if (message.type != null && message.hasOwnProperty("type"))
  194. switch (message.type) {
  195. default:
  196. return "type: enum value expected";
  197. case 0:
  198. case 1:
  199. case 2:
  200. case 3:
  201. break;
  202. }
  203. if (message.dataMessage != null && message.hasOwnProperty("dataMessage")) {
  204. var error = $root.tutorial.Message.DataMessage.verify(message.dataMessage);
  205. if (error)
  206. return "dataMessage." + error;
  207. }
  208. if (message.notificationMessage != null && message.hasOwnProperty("notificationMessage")) {
  209. var error = $root.tutorial.Message.NotificationMessage.verify(message.notificationMessage);
  210. if (error)
  211. return "notificationMessage." + error;
  212. }
  213. if (message.roleOptMessage != null && message.hasOwnProperty("roleOptMessage")) {
  214. var error = $root.tutorial.Message.RoleOptMessage.verify(message.roleOptMessage);
  215. if (error)
  216. return "roleOptMessage." + error;
  217. }
  218. if (message.msg != null && message.hasOwnProperty("msg"))
  219. if (!$util.isString(message.msg))
  220. return "msg: string expected";
  221. return null;
  222. };
  223. /**
  224. * Creates a Message message from a plain object. Also converts values to their respective internal types.
  225. * @function fromObject
  226. * @memberof tutorial.Message
  227. * @static
  228. * @param {Object.<string,*>} object Plain object
  229. * @returns {tutorial.Message} Message
  230. */
  231. Message.fromObject = function fromObject(object) {
  232. if (object instanceof $root.tutorial.Message)
  233. return object;
  234. var message = new $root.tutorial.Message();
  235. switch (object.type) {
  236. case "SELF":
  237. case 0:
  238. message.type = 0;
  239. break;
  240. case "DATA":
  241. case 1:
  242. message.type = 1;
  243. break;
  244. case "NOTIFY":
  245. case 2:
  246. message.type = 2;
  247. break;
  248. case "ROLEOPT":
  249. case 3:
  250. message.type = 3;
  251. break;
  252. }
  253. if (object.dataMessage != null) {
  254. if (typeof object.dataMessage !== "object")
  255. throw TypeError(".tutorial.Message.dataMessage: object expected");
  256. message.dataMessage = $root.tutorial.Message.DataMessage.fromObject(object.dataMessage);
  257. }
  258. if (object.notificationMessage != null) {
  259. if (typeof object.notificationMessage !== "object")
  260. throw TypeError(".tutorial.Message.notificationMessage: object expected");
  261. message.notificationMessage = $root.tutorial.Message.NotificationMessage.fromObject(object.notificationMessage);
  262. }
  263. if (object.roleOptMessage != null) {
  264. if (typeof object.roleOptMessage !== "object")
  265. throw TypeError(".tutorial.Message.roleOptMessage: object expected");
  266. message.roleOptMessage = $root.tutorial.Message.RoleOptMessage.fromObject(object.roleOptMessage);
  267. }
  268. if (object.msg != null)
  269. message.msg = String(object.msg);
  270. return message;
  271. };
  272. /**
  273. * Creates a plain object from a Message message. Also converts values to other types if specified.
  274. * @function toObject
  275. * @memberof tutorial.Message
  276. * @static
  277. * @param {tutorial.Message} message Message
  278. * @param {$protobuf.IConversionOptions} [options] Conversion options
  279. * @returns {Object.<string,*>} Plain object
  280. */
  281. Message.toObject = function toObject(message, options) {
  282. if (!options)
  283. options = {};
  284. var object = {};
  285. if (options.defaults) {
  286. object.type = options.enums === String ? "SELF" : 0;
  287. object.dataMessage = null;
  288. object.notificationMessage = null;
  289. object.roleOptMessage = null;
  290. object.msg = "";
  291. }
  292. if (message.type != null && message.hasOwnProperty("type"))
  293. object.type = options.enums === String ? $root.tutorial.Message.Type[message.type] : message.type;
  294. if (message.dataMessage != null && message.hasOwnProperty("dataMessage"))
  295. object.dataMessage = $root.tutorial.Message.DataMessage.toObject(message.dataMessage, options);
  296. if (message.notificationMessage != null && message.hasOwnProperty("notificationMessage"))
  297. object.notificationMessage = $root.tutorial.Message.NotificationMessage.toObject(message.notificationMessage, options);
  298. if (message.roleOptMessage != null && message.hasOwnProperty("roleOptMessage"))
  299. object.roleOptMessage = $root.tutorial.Message.RoleOptMessage.toObject(message.roleOptMessage, options);
  300. if (message.msg != null && message.hasOwnProperty("msg"))
  301. object.msg = message.msg;
  302. return object;
  303. };
  304. /**
  305. * Converts this Message to JSON.
  306. * @function toJSON
  307. * @memberof tutorial.Message
  308. * @instance
  309. * @returns {Object.<string,*>} JSON object
  310. */
  311. Message.prototype.toJSON = function toJSON() {
  312. return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
  313. };
  314. /**
  315. * Type enum.
  316. * @name tutorial.Message.Type
  317. * @enum {string}
  318. * @property {number} SELF=0 SELF value
  319. * @property {number} DATA=1 DATA value
  320. * @property {number} NOTIFY=2 NOTIFY value
  321. * @property {number} ROLEOPT=3 ROLEOPT value
  322. */
  323. Message.Type = (function() {
  324. var valuesById = {}, values = Object.create(valuesById);
  325. values[valuesById[0] = "SELF"] = 0;
  326. values[valuesById[1] = "DATA"] = 1;
  327. values[valuesById[2] = "NOTIFY"] = 2;
  328. values[valuesById[3] = "ROLEOPT"] = 3;
  329. return values;
  330. })();
  331. Message.DataMessage = (function() {
  332. /**
  333. * Properties of a DataMessage.
  334. * @memberof tutorial.Message
  335. * @interface IDataMessage
  336. * @property {number|null} [code] DataMessage code
  337. * @property {number|null} [result] DataMessage result
  338. * @property {string|null} [data] DataMessage data
  339. * @property {string|null} [msg] DataMessage msg
  340. */
  341. /**
  342. * Constructs a new DataMessage.
  343. * @memberof tutorial.Message
  344. * @classdesc Represents a DataMessage.
  345. * @implements IDataMessage
  346. * @constructor
  347. * @param {tutorial.Message.IDataMessage=} [properties] Properties to set
  348. */
  349. function DataMessage(properties) {
  350. if (properties)
  351. for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
  352. if (properties[keys[i]] != null)
  353. this[keys[i]] = properties[keys[i]];
  354. }
  355. /**
  356. * DataMessage code.
  357. * @member {number} code
  358. * @memberof tutorial.Message.DataMessage
  359. * @instance
  360. */
  361. DataMessage.prototype.code = 0;
  362. /**
  363. * DataMessage result.
  364. * @member {number} result
  365. * @memberof tutorial.Message.DataMessage
  366. * @instance
  367. */
  368. DataMessage.prototype.result = 0;
  369. /**
  370. * DataMessage data.
  371. * @member {string} data
  372. * @memberof tutorial.Message.DataMessage
  373. * @instance
  374. */
  375. DataMessage.prototype.data = "";
  376. /**
  377. * DataMessage msg.
  378. * @member {string} msg
  379. * @memberof tutorial.Message.DataMessage
  380. * @instance
  381. */
  382. DataMessage.prototype.msg = "";
  383. /**
  384. * Creates a new DataMessage instance using the specified properties.
  385. * @function create
  386. * @memberof tutorial.Message.DataMessage
  387. * @static
  388. * @param {tutorial.Message.IDataMessage=} [properties] Properties to set
  389. * @returns {tutorial.Message.DataMessage} DataMessage instance
  390. */
  391. DataMessage.create = function create(properties) {
  392. return new DataMessage(properties);
  393. };
  394. /**
  395. * Encodes the specified DataMessage message. Does not implicitly {@link tutorial.Message.DataMessage.verify|verify} messages.
  396. * @function encode
  397. * @memberof tutorial.Message.DataMessage
  398. * @static
  399. * @param {tutorial.Message.IDataMessage} message DataMessage message or plain object to encode
  400. * @param {$protobuf.Writer} [writer] Writer to encode to
  401. * @returns {$protobuf.Writer} Writer
  402. */
  403. DataMessage.encode = function encode(message, writer) {
  404. if (!writer)
  405. writer = $Writer.create();
  406. if (message.code != null && message.hasOwnProperty("code"))
  407. writer.uint32(/* id 1, wireType 0 =*/8).int32(message.code);
  408. if (message.result != null && message.hasOwnProperty("result"))
  409. writer.uint32(/* id 2, wireType 0 =*/16).int32(message.result);
  410. if (message.data != null && message.hasOwnProperty("data"))
  411. writer.uint32(/* id 3, wireType 2 =*/26).string(message.data);
  412. if (message.msg != null && message.hasOwnProperty("msg"))
  413. writer.uint32(/* id 4, wireType 2 =*/34).string(message.msg);
  414. return writer;
  415. };
  416. /**
  417. * Encodes the specified DataMessage message, length delimited. Does not implicitly {@link tutorial.Message.DataMessage.verify|verify} messages.
  418. * @function encodeDelimited
  419. * @memberof tutorial.Message.DataMessage
  420. * @static
  421. * @param {tutorial.Message.IDataMessage} message DataMessage message or plain object to encode
  422. * @param {$protobuf.Writer} [writer] Writer to encode to
  423. * @returns {$protobuf.Writer} Writer
  424. */
  425. DataMessage.encodeDelimited = function encodeDelimited(message, writer) {
  426. return this.encode(message, writer).ldelim();
  427. };
  428. /**
  429. * Decodes a DataMessage message from the specified reader or buffer.
  430. * @function decode
  431. * @memberof tutorial.Message.DataMessage
  432. * @static
  433. * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
  434. * @param {number} [length] Message length if known beforehand
  435. * @returns {tutorial.Message.DataMessage} DataMessage
  436. * @throws {Error} If the payload is not a reader or valid buffer
  437. * @throws {$protobuf.util.ProtocolError} If required fields are missing
  438. */
  439. DataMessage.decode = function decode(reader, length) {
  440. if (!(reader instanceof $Reader))
  441. reader = $Reader.create(reader);
  442. var end = length === undefined ? reader.len : reader.pos + length, message = new $root.tutorial.Message.DataMessage();
  443. while (reader.pos < end) {
  444. var tag = reader.uint32();
  445. switch (tag >>> 3) {
  446. case 1:
  447. message.code = reader.int32();
  448. break;
  449. case 2:
  450. message.result = reader.int32();
  451. break;
  452. case 3:
  453. message.data = reader.string();
  454. break;
  455. case 4:
  456. message.msg = reader.string();
  457. break;
  458. default:
  459. reader.skipType(tag & 7);
  460. break;
  461. }
  462. }
  463. return message;
  464. };
  465. /**
  466. * Decodes a DataMessage message from the specified reader or buffer, length delimited.
  467. * @function decodeDelimited
  468. * @memberof tutorial.Message.DataMessage
  469. * @static
  470. * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
  471. * @returns {tutorial.Message.DataMessage} DataMessage
  472. * @throws {Error} If the payload is not a reader or valid buffer
  473. * @throws {$protobuf.util.ProtocolError} If required fields are missing
  474. */
  475. DataMessage.decodeDelimited = function decodeDelimited(reader) {
  476. if (!(reader instanceof $Reader))
  477. reader = new $Reader(reader);
  478. return this.decode(reader, reader.uint32());
  479. };
  480. /**
  481. * Verifies a DataMessage message.
  482. * @function verify
  483. * @memberof tutorial.Message.DataMessage
  484. * @static
  485. * @param {Object.<string,*>} message Plain object to verify
  486. * @returns {string|null} `null` if valid, otherwise the reason why it is not
  487. */
  488. DataMessage.verify = function verify(message) {
  489. if (typeof message !== "object" || message === null)
  490. return "object expected";
  491. if (message.code != null && message.hasOwnProperty("code"))
  492. if (!$util.isInteger(message.code))
  493. return "code: integer expected";
  494. if (message.result != null && message.hasOwnProperty("result"))
  495. if (!$util.isInteger(message.result))
  496. return "result: integer expected";
  497. if (message.data != null && message.hasOwnProperty("data"))
  498. if (!$util.isString(message.data))
  499. return "data: string expected";
  500. if (message.msg != null && message.hasOwnProperty("msg"))
  501. if (!$util.isString(message.msg))
  502. return "msg: string expected";
  503. return null;
  504. };
  505. /**
  506. * Creates a DataMessage message from a plain object. Also converts values to their respective internal types.
  507. * @function fromObject
  508. * @memberof tutorial.Message.DataMessage
  509. * @static
  510. * @param {Object.<string,*>} object Plain object
  511. * @returns {tutorial.Message.DataMessage} DataMessage
  512. */
  513. DataMessage.fromObject = function fromObject(object) {
  514. if (object instanceof $root.tutorial.Message.DataMessage)
  515. return object;
  516. var message = new $root.tutorial.Message.DataMessage();
  517. if (object.code != null)
  518. message.code = object.code | 0;
  519. if (object.result != null)
  520. message.result = object.result | 0;
  521. if (object.data != null)
  522. message.data = String(object.data);
  523. if (object.msg != null)
  524. message.msg = String(object.msg);
  525. return message;
  526. };
  527. /**
  528. * Creates a plain object from a DataMessage message. Also converts values to other types if specified.
  529. * @function toObject
  530. * @memberof tutorial.Message.DataMessage
  531. * @static
  532. * @param {tutorial.Message.DataMessage} message DataMessage
  533. * @param {$protobuf.IConversionOptions} [options] Conversion options
  534. * @returns {Object.<string,*>} Plain object
  535. */
  536. DataMessage.toObject = function toObject(message, options) {
  537. if (!options)
  538. options = {};
  539. var object = {};
  540. if (options.defaults) {
  541. object.code = 0;
  542. object.result = 0;
  543. object.data = "";
  544. object.msg = "";
  545. }
  546. if (message.code != null && message.hasOwnProperty("code"))
  547. object.code = message.code;
  548. if (message.result != null && message.hasOwnProperty("result"))
  549. object.result = message.result;
  550. if (message.data != null && message.hasOwnProperty("data"))
  551. object.data = message.data;
  552. if (message.msg != null && message.hasOwnProperty("msg"))
  553. object.msg = message.msg;
  554. return object;
  555. };
  556. /**
  557. * Converts this DataMessage to JSON.
  558. * @function toJSON
  559. * @memberof tutorial.Message.DataMessage
  560. * @instance
  561. * @returns {Object.<string,*>} JSON object
  562. */
  563. DataMessage.prototype.toJSON = function toJSON() {
  564. return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
  565. };
  566. return DataMessage;
  567. })();
  568. Message.NotificationMessage = (function() {
  569. /**
  570. * Properties of a NotificationMessage.
  571. * @memberof tutorial.Message
  572. * @interface INotificationMessage
  573. * @property {number|null} [nType] NotificationMessage nType
  574. */
  575. /**
  576. * Constructs a new NotificationMessage.
  577. * @memberof tutorial.Message
  578. * @classdesc Represents a NotificationMessage.
  579. * @implements INotificationMessage
  580. * @constructor
  581. * @param {tutorial.Message.INotificationMessage=} [properties] Properties to set
  582. */
  583. function NotificationMessage(properties) {
  584. if (properties)
  585. for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
  586. if (properties[keys[i]] != null)
  587. this[keys[i]] = properties[keys[i]];
  588. }
  589. /**
  590. * NotificationMessage nType.
  591. * @member {number} nType
  592. * @memberof tutorial.Message.NotificationMessage
  593. * @instance
  594. */
  595. NotificationMessage.prototype.nType = 0;
  596. /**
  597. * Creates a new NotificationMessage instance using the specified properties.
  598. * @function create
  599. * @memberof tutorial.Message.NotificationMessage
  600. * @static
  601. * @param {tutorial.Message.INotificationMessage=} [properties] Properties to set
  602. * @returns {tutorial.Message.NotificationMessage} NotificationMessage instance
  603. */
  604. NotificationMessage.create = function create(properties) {
  605. return new NotificationMessage(properties);
  606. };
  607. /**
  608. * Encodes the specified NotificationMessage message. Does not implicitly {@link tutorial.Message.NotificationMessage.verify|verify} messages.
  609. * @function encode
  610. * @memberof tutorial.Message.NotificationMessage
  611. * @static
  612. * @param {tutorial.Message.INotificationMessage} message NotificationMessage message or plain object to encode
  613. * @param {$protobuf.Writer} [writer] Writer to encode to
  614. * @returns {$protobuf.Writer} Writer
  615. */
  616. NotificationMessage.encode = function encode(message, writer) {
  617. if (!writer)
  618. writer = $Writer.create();
  619. if (message.nType != null && message.hasOwnProperty("nType"))
  620. writer.uint32(/* id 1, wireType 0 =*/8).int32(message.nType);
  621. return writer;
  622. };
  623. /**
  624. * Encodes the specified NotificationMessage message, length delimited. Does not implicitly {@link tutorial.Message.NotificationMessage.verify|verify} messages.
  625. * @function encodeDelimited
  626. * @memberof tutorial.Message.NotificationMessage
  627. * @static
  628. * @param {tutorial.Message.INotificationMessage} message NotificationMessage message or plain object to encode
  629. * @param {$protobuf.Writer} [writer] Writer to encode to
  630. * @returns {$protobuf.Writer} Writer
  631. */
  632. NotificationMessage.encodeDelimited = function encodeDelimited(message, writer) {
  633. return this.encode(message, writer).ldelim();
  634. };
  635. /**
  636. * Decodes a NotificationMessage message from the specified reader or buffer.
  637. * @function decode
  638. * @memberof tutorial.Message.NotificationMessage
  639. * @static
  640. * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
  641. * @param {number} [length] Message length if known beforehand
  642. * @returns {tutorial.Message.NotificationMessage} NotificationMessage
  643. * @throws {Error} If the payload is not a reader or valid buffer
  644. * @throws {$protobuf.util.ProtocolError} If required fields are missing
  645. */
  646. NotificationMessage.decode = function decode(reader, length) {
  647. if (!(reader instanceof $Reader))
  648. reader = $Reader.create(reader);
  649. var end = length === undefined ? reader.len : reader.pos + length, message = new $root.tutorial.Message.NotificationMessage();
  650. while (reader.pos < end) {
  651. var tag = reader.uint32();
  652. switch (tag >>> 3) {
  653. case 1:
  654. message.nType = reader.int32();
  655. break;
  656. default:
  657. reader.skipType(tag & 7);
  658. break;
  659. }
  660. }
  661. return message;
  662. };
  663. /**
  664. * Decodes a NotificationMessage message from the specified reader or buffer, length delimited.
  665. * @function decodeDelimited
  666. * @memberof tutorial.Message.NotificationMessage
  667. * @static
  668. * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
  669. * @returns {tutorial.Message.NotificationMessage} NotificationMessage
  670. * @throws {Error} If the payload is not a reader or valid buffer
  671. * @throws {$protobuf.util.ProtocolError} If required fields are missing
  672. */
  673. NotificationMessage.decodeDelimited = function decodeDelimited(reader) {
  674. if (!(reader instanceof $Reader))
  675. reader = new $Reader(reader);
  676. return this.decode(reader, reader.uint32());
  677. };
  678. /**
  679. * Verifies a NotificationMessage message.
  680. * @function verify
  681. * @memberof tutorial.Message.NotificationMessage
  682. * @static
  683. * @param {Object.<string,*>} message Plain object to verify
  684. * @returns {string|null} `null` if valid, otherwise the reason why it is not
  685. */
  686. NotificationMessage.verify = function verify(message) {
  687. if (typeof message !== "object" || message === null)
  688. return "object expected";
  689. if (message.nType != null && message.hasOwnProperty("nType"))
  690. if (!$util.isInteger(message.nType))
  691. return "nType: integer expected";
  692. return null;
  693. };
  694. /**
  695. * Creates a NotificationMessage message from a plain object. Also converts values to their respective internal types.
  696. * @function fromObject
  697. * @memberof tutorial.Message.NotificationMessage
  698. * @static
  699. * @param {Object.<string,*>} object Plain object
  700. * @returns {tutorial.Message.NotificationMessage} NotificationMessage
  701. */
  702. NotificationMessage.fromObject = function fromObject(object) {
  703. if (object instanceof $root.tutorial.Message.NotificationMessage)
  704. return object;
  705. var message = new $root.tutorial.Message.NotificationMessage();
  706. if (object.nType != null)
  707. message.nType = object.nType | 0;
  708. return message;
  709. };
  710. /**
  711. * Creates a plain object from a NotificationMessage message. Also converts values to other types if specified.
  712. * @function toObject
  713. * @memberof tutorial.Message.NotificationMessage
  714. * @static
  715. * @param {tutorial.Message.NotificationMessage} message NotificationMessage
  716. * @param {$protobuf.IConversionOptions} [options] Conversion options
  717. * @returns {Object.<string,*>} Plain object
  718. */
  719. NotificationMessage.toObject = function toObject(message, options) {
  720. if (!options)
  721. options = {};
  722. var object = {};
  723. if (options.defaults)
  724. object.nType = 0;
  725. if (message.nType != null && message.hasOwnProperty("nType"))
  726. object.nType = message.nType;
  727. return object;
  728. };
  729. /**
  730. * Converts this NotificationMessage to JSON.
  731. * @function toJSON
  732. * @memberof tutorial.Message.NotificationMessage
  733. * @instance
  734. * @returns {Object.<string,*>} JSON object
  735. */
  736. NotificationMessage.prototype.toJSON = function toJSON() {
  737. return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
  738. };
  739. return NotificationMessage;
  740. })();
  741. Message.RoleOptMessage = (function() {
  742. /**
  743. * Properties of a RoleOptMessage.
  744. * @memberof tutorial.Message
  745. * @interface IRoleOptMessage
  746. * @property {number|Long|null} [targetUid] RoleOptMessage targetUid
  747. * @property {number|Long|null} [exBossUid] RoleOptMessage exBossUid
  748. * @property {number|null} [opt] RoleOptMessage opt
  749. */
  750. /**
  751. * Constructs a new RoleOptMessage.
  752. * @memberof tutorial.Message
  753. * @classdesc Represents a RoleOptMessage.
  754. * @implements IRoleOptMessage
  755. * @constructor
  756. * @param {tutorial.Message.IRoleOptMessage=} [properties] Properties to set
  757. */
  758. function RoleOptMessage(properties) {
  759. if (properties)
  760. for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
  761. if (properties[keys[i]] != null)
  762. this[keys[i]] = properties[keys[i]];
  763. }
  764. /**
  765. * RoleOptMessage targetUid.
  766. * @member {number|Long} targetUid
  767. * @memberof tutorial.Message.RoleOptMessage
  768. * @instance
  769. */
  770. RoleOptMessage.prototype.targetUid = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
  771. /**
  772. * RoleOptMessage exBossUid.
  773. * @member {number|Long} exBossUid
  774. * @memberof tutorial.Message.RoleOptMessage
  775. * @instance
  776. */
  777. RoleOptMessage.prototype.exBossUid = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
  778. /**
  779. * RoleOptMessage opt.
  780. * @member {number} opt
  781. * @memberof tutorial.Message.RoleOptMessage
  782. * @instance
  783. */
  784. RoleOptMessage.prototype.opt = 0;
  785. /**
  786. * Creates a new RoleOptMessage instance using the specified properties.
  787. * @function create
  788. * @memberof tutorial.Message.RoleOptMessage
  789. * @static
  790. * @param {tutorial.Message.IRoleOptMessage=} [properties] Properties to set
  791. * @returns {tutorial.Message.RoleOptMessage} RoleOptMessage instance
  792. */
  793. RoleOptMessage.create = function create(properties) {
  794. return new RoleOptMessage(properties);
  795. };
  796. /**
  797. * Encodes the specified RoleOptMessage message. Does not implicitly {@link tutorial.Message.RoleOptMessage.verify|verify} messages.
  798. * @function encode
  799. * @memberof tutorial.Message.RoleOptMessage
  800. * @static
  801. * @param {tutorial.Message.IRoleOptMessage} message RoleOptMessage message or plain object to encode
  802. * @param {$protobuf.Writer} [writer] Writer to encode to
  803. * @returns {$protobuf.Writer} Writer
  804. */
  805. RoleOptMessage.encode = function encode(message, writer) {
  806. if (!writer)
  807. writer = $Writer.create();
  808. if (message.targetUid != null && message.hasOwnProperty("targetUid"))
  809. writer.uint32(/* id 1, wireType 0 =*/8).int64(message.targetUid);
  810. if (message.exBossUid != null && message.hasOwnProperty("exBossUid"))
  811. writer.uint32(/* id 2, wireType 0 =*/16).int64(message.exBossUid);
  812. if (message.opt != null && message.hasOwnProperty("opt"))
  813. writer.uint32(/* id 3, wireType 0 =*/24).int32(message.opt);
  814. return writer;
  815. };
  816. /**
  817. * Encodes the specified RoleOptMessage message, length delimited. Does not implicitly {@link tutorial.Message.RoleOptMessage.verify|verify} messages.
  818. * @function encodeDelimited
  819. * @memberof tutorial.Message.RoleOptMessage
  820. * @static
  821. * @param {tutorial.Message.IRoleOptMessage} message RoleOptMessage message or plain object to encode
  822. * @param {$protobuf.Writer} [writer] Writer to encode to
  823. * @returns {$protobuf.Writer} Writer
  824. */
  825. RoleOptMessage.encodeDelimited = function encodeDelimited(message, writer) {
  826. return this.encode(message, writer).ldelim();
  827. };
  828. /**
  829. * Decodes a RoleOptMessage message from the specified reader or buffer.
  830. * @function decode
  831. * @memberof tutorial.Message.RoleOptMessage
  832. * @static
  833. * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
  834. * @param {number} [length] Message length if known beforehand
  835. * @returns {tutorial.Message.RoleOptMessage} RoleOptMessage
  836. * @throws {Error} If the payload is not a reader or valid buffer
  837. * @throws {$protobuf.util.ProtocolError} If required fields are missing
  838. */
  839. RoleOptMessage.decode = function decode(reader, length) {
  840. if (!(reader instanceof $Reader))
  841. reader = $Reader.create(reader);
  842. var end = length === undefined ? reader.len : reader.pos + length, message = new $root.tutorial.Message.RoleOptMessage();
  843. while (reader.pos < end) {
  844. var tag = reader.uint32();
  845. switch (tag >>> 3) {
  846. case 1:
  847. message.targetUid = reader.int64();
  848. break;
  849. case 2:
  850. message.exBossUid = reader.int64();
  851. break;
  852. case 3:
  853. message.opt = reader.int32();
  854. break;
  855. default:
  856. reader.skipType(tag & 7);
  857. break;
  858. }
  859. }
  860. return message;
  861. };
  862. /**
  863. * Decodes a RoleOptMessage message from the specified reader or buffer, length delimited.
  864. * @function decodeDelimited
  865. * @memberof tutorial.Message.RoleOptMessage
  866. * @static
  867. * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
  868. * @returns {tutorial.Message.RoleOptMessage} RoleOptMessage
  869. * @throws {Error} If the payload is not a reader or valid buffer
  870. * @throws {$protobuf.util.ProtocolError} If required fields are missing
  871. */
  872. RoleOptMessage.decodeDelimited = function decodeDelimited(reader) {
  873. if (!(reader instanceof $Reader))
  874. reader = new $Reader(reader);
  875. return this.decode(reader, reader.uint32());
  876. };
  877. /**
  878. * Verifies a RoleOptMessage message.
  879. * @function verify
  880. * @memberof tutorial.Message.RoleOptMessage
  881. * @static
  882. * @param {Object.<string,*>} message Plain object to verify
  883. * @returns {string|null} `null` if valid, otherwise the reason why it is not
  884. */
  885. RoleOptMessage.verify = function verify(message) {
  886. if (typeof message !== "object" || message === null)
  887. return "object expected";
  888. if (message.targetUid != null && message.hasOwnProperty("targetUid"))
  889. if (!$util.isInteger(message.targetUid) && !(message.targetUid && $util.isInteger(message.targetUid.low) && $util.isInteger(message.targetUid.high)))
  890. return "targetUid: integer|Long expected";
  891. if (message.exBossUid != null && message.hasOwnProperty("exBossUid"))
  892. if (!$util.isInteger(message.exBossUid) && !(message.exBossUid && $util.isInteger(message.exBossUid.low) && $util.isInteger(message.exBossUid.high)))
  893. return "exBossUid: integer|Long expected";
  894. if (message.opt != null && message.hasOwnProperty("opt"))
  895. if (!$util.isInteger(message.opt))
  896. return "opt: integer expected";
  897. return null;
  898. };
  899. /**
  900. * Creates a RoleOptMessage message from a plain object. Also converts values to their respective internal types.
  901. * @function fromObject
  902. * @memberof tutorial.Message.RoleOptMessage
  903. * @static
  904. * @param {Object.<string,*>} object Plain object
  905. * @returns {tutorial.Message.RoleOptMessage} RoleOptMessage
  906. */
  907. RoleOptMessage.fromObject = function fromObject(object) {
  908. if (object instanceof $root.tutorial.Message.RoleOptMessage)
  909. return object;
  910. var message = new $root.tutorial.Message.RoleOptMessage();
  911. if (object.targetUid != null)
  912. if ($util.Long)
  913. (message.targetUid = $util.Long.fromValue(object.targetUid)).unsigned = false;
  914. else if (typeof object.targetUid === "string")
  915. message.targetUid = parseInt(object.targetUid, 10);
  916. else if (typeof object.targetUid === "number")
  917. message.targetUid = object.targetUid;
  918. else if (typeof object.targetUid === "object")
  919. message.targetUid = new $util.LongBits(object.targetUid.low >>> 0, object.targetUid.high >>> 0).toNumber();
  920. if (object.exBossUid != null)
  921. if ($util.Long)
  922. (message.exBossUid = $util.Long.fromValue(object.exBossUid)).unsigned = false;
  923. else if (typeof object.exBossUid === "string")
  924. message.exBossUid = parseInt(object.exBossUid, 10);
  925. else if (typeof object.exBossUid === "number")
  926. message.exBossUid = object.exBossUid;
  927. else if (typeof object.exBossUid === "object")
  928. message.exBossUid = new $util.LongBits(object.exBossUid.low >>> 0, object.exBossUid.high >>> 0).toNumber();
  929. if (object.opt != null)
  930. message.opt = object.opt | 0;
  931. return message;
  932. };
  933. /**
  934. * Creates a plain object from a RoleOptMessage message. Also converts values to other types if specified.
  935. * @function toObject
  936. * @memberof tutorial.Message.RoleOptMessage
  937. * @static
  938. * @param {tutorial.Message.RoleOptMessage} message RoleOptMessage
  939. * @param {$protobuf.IConversionOptions} [options] Conversion options
  940. * @returns {Object.<string,*>} Plain object
  941. */
  942. RoleOptMessage.toObject = function toObject(message, options) {
  943. if (!options)
  944. options = {};
  945. var object = {};
  946. if (options.defaults) {
  947. if ($util.Long) {
  948. var long = new $util.Long(0, 0, false);
  949. object.targetUid = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
  950. } else
  951. object.targetUid = options.longs === String ? "0" : 0;
  952. if ($util.Long) {
  953. var long = new $util.Long(0, 0, false);
  954. object.exBossUid = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
  955. } else
  956. object.exBossUid = options.longs === String ? "0" : 0;
  957. object.opt = 0;
  958. }
  959. if (message.targetUid != null && message.hasOwnProperty("targetUid"))
  960. if (typeof message.targetUid === "number")
  961. object.targetUid = options.longs === String ? String(message.targetUid) : message.targetUid;
  962. else
  963. object.targetUid = options.longs === String ? $util.Long.prototype.toString.call(message.targetUid) : options.longs === Number ? new $util.LongBits(message.targetUid.low >>> 0, message.targetUid.high >>> 0).toNumber() : message.targetUid;
  964. if (message.exBossUid != null && message.hasOwnProperty("exBossUid"))
  965. if (typeof message.exBossUid === "number")
  966. object.exBossUid = options.longs === String ? String(message.exBossUid) : message.exBossUid;
  967. else
  968. object.exBossUid = options.longs === String ? $util.Long.prototype.toString.call(message.exBossUid) : options.longs === Number ? new $util.LongBits(message.exBossUid.low >>> 0, message.exBossUid.high >>> 0).toNumber() : message.exBossUid;
  969. if (message.opt != null && message.hasOwnProperty("opt"))
  970. object.opt = message.opt;
  971. return object;
  972. };
  973. /**
  974. * Converts this RoleOptMessage to JSON.
  975. * @function toJSON
  976. * @memberof tutorial.Message.RoleOptMessage
  977. * @instance
  978. * @returns {Object.<string,*>} JSON object
  979. */
  980. RoleOptMessage.prototype.toJSON = function toJSON() {
  981. return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
  982. };
  983. return RoleOptMessage;
  984. })();
  985. return Message;
  986. })();
  987. return tutorial;
  988. })();
  989. return $root;
  990. });