123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065 |
- /*eslint-disable block-scoped-var, no-redeclare, no-control-regex, no-prototype-builtins*/
- (function(global, factory) { /* global define, require, module */
- /* AMD */ if (typeof define === 'function' && define.amd)
- define(["protobufjs/minimal"], factory);
- /* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports)
- module.exports = factory(require("protobufjs/minimal"));
- })(this, function($protobuf) {
- "use strict";
- // Common aliases
- var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
-
- // Exported root namespace
- var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});
-
- $root.tutorial = (function() {
-
- /**
- * Namespace tutorial.
- * @exports tutorial
- * @namespace
- */
- var tutorial = {};
-
- tutorial.Message = (function() {
-
- /**
- * Properties of a Message.
- * @memberof tutorial
- * @interface IMessage
- * @property {tutorial.Message.Type|null} [type] Message type
- * @property {tutorial.Message.IDataMessage|null} [dataMessage] Message dataMessage
- * @property {tutorial.Message.INotificationMessage|null} [notificationMessage] Message notificationMessage
- * @property {tutorial.Message.IRoleOptMessage|null} [roleOptMessage] Message roleOptMessage
- * @property {string|null} [msg] Message msg
- */
-
- /**
- * Constructs a new Message.
- * @memberof tutorial
- * @classdesc Represents a Message.
- * @implements IMessage
- * @constructor
- * @param {tutorial.IMessage=} [properties] Properties to set
- */
- function Message(properties) {
- if (properties)
- for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
- if (properties[keys[i]] != null)
- this[keys[i]] = properties[keys[i]];
- }
-
- /**
- * Message type.
- * @member {tutorial.Message.Type} type
- * @memberof tutorial.Message
- * @instance
- */
- Message.prototype.type = 0;
-
- /**
- * Message dataMessage.
- * @member {tutorial.Message.IDataMessage|null|undefined} dataMessage
- * @memberof tutorial.Message
- * @instance
- */
- Message.prototype.dataMessage = null;
-
- /**
- * Message notificationMessage.
- * @member {tutorial.Message.INotificationMessage|null|undefined} notificationMessage
- * @memberof tutorial.Message
- * @instance
- */
- Message.prototype.notificationMessage = null;
-
- /**
- * Message roleOptMessage.
- * @member {tutorial.Message.IRoleOptMessage|null|undefined} roleOptMessage
- * @memberof tutorial.Message
- * @instance
- */
- Message.prototype.roleOptMessage = null;
-
- /**
- * Message msg.
- * @member {string} msg
- * @memberof tutorial.Message
- * @instance
- */
- Message.prototype.msg = "";
-
- /**
- * Creates a new Message instance using the specified properties.
- * @function create
- * @memberof tutorial.Message
- * @static
- * @param {tutorial.IMessage=} [properties] Properties to set
- * @returns {tutorial.Message} Message instance
- */
- Message.create = function create(properties) {
- return new Message(properties);
- };
-
- /**
- * Encodes the specified Message message. Does not implicitly {@link tutorial.Message.verify|verify} messages.
- * @function encode
- * @memberof tutorial.Message
- * @static
- * @param {tutorial.IMessage} message Message message or plain object to encode
- * @param {$protobuf.Writer} [writer] Writer to encode to
- * @returns {$protobuf.Writer} Writer
- */
- Message.encode = function encode(message, writer) {
- if (!writer)
- writer = $Writer.create();
- if (message.type != null && message.hasOwnProperty("type"))
- writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type);
- if (message.dataMessage != null && message.hasOwnProperty("dataMessage"))
- $root.tutorial.Message.DataMessage.encode(message.dataMessage, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
- if (message.notificationMessage != null && message.hasOwnProperty("notificationMessage"))
- $root.tutorial.Message.NotificationMessage.encode(message.notificationMessage, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
- if (message.roleOptMessage != null && message.hasOwnProperty("roleOptMessage"))
- $root.tutorial.Message.RoleOptMessage.encode(message.roleOptMessage, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim();
- if (message.msg != null && message.hasOwnProperty("msg"))
- writer.uint32(/* id 6, wireType 2 =*/50).string(message.msg);
- return writer;
- };
-
- /**
- * Encodes the specified Message message, length delimited. Does not implicitly {@link tutorial.Message.verify|verify} messages.
- * @function encodeDelimited
- * @memberof tutorial.Message
- * @static
- * @param {tutorial.IMessage} message Message message or plain object to encode
- * @param {$protobuf.Writer} [writer] Writer to encode to
- * @returns {$protobuf.Writer} Writer
- */
- Message.encodeDelimited = function encodeDelimited(message, writer) {
- return this.encode(message, writer).ldelim();
- };
-
- /**
- * Decodes a Message message from the specified reader or buffer.
- * @function decode
- * @memberof tutorial.Message
- * @static
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
- * @param {number} [length] Message length if known beforehand
- * @returns {tutorial.Message} Message
- * @throws {Error} If the payload is not a reader or valid buffer
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
- */
- Message.decode = function decode(reader, length) {
- if (!(reader instanceof $Reader))
- reader = $Reader.create(reader);
- var end = length === undefined ? reader.len : reader.pos + length, message = new $root.tutorial.Message();
- while (reader.pos < end) {
- var tag = reader.uint32();
- switch (tag >>> 3) {
- case 1:
- message.type = reader.int32();
- break;
- case 2:
- message.dataMessage = $root.tutorial.Message.DataMessage.decode(reader, reader.uint32());
- break;
- case 3:
- message.notificationMessage = $root.tutorial.Message.NotificationMessage.decode(reader, reader.uint32());
- break;
- case 4:
- message.roleOptMessage = $root.tutorial.Message.RoleOptMessage.decode(reader, reader.uint32());
- break;
- case 6:
- message.msg = reader.string();
- break;
- default:
- reader.skipType(tag & 7);
- break;
- }
- }
- return message;
- };
-
- /**
- * Decodes a Message message from the specified reader or buffer, length delimited.
- * @function decodeDelimited
- * @memberof tutorial.Message
- * @static
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
- * @returns {tutorial.Message} Message
- * @throws {Error} If the payload is not a reader or valid buffer
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
- */
- Message.decodeDelimited = function decodeDelimited(reader) {
- if (!(reader instanceof $Reader))
- reader = new $Reader(reader);
- return this.decode(reader, reader.uint32());
- };
-
- /**
- * Verifies a Message message.
- * @function verify
- * @memberof tutorial.Message
- * @static
- * @param {Object.<string,*>} message Plain object to verify
- * @returns {string|null} `null` if valid, otherwise the reason why it is not
- */
- Message.verify = function verify(message) {
- if (typeof message !== "object" || message === null)
- return "object expected";
- if (message.type != null && message.hasOwnProperty("type"))
- switch (message.type) {
- default:
- return "type: enum value expected";
- case 0:
- case 1:
- case 2:
- case 3:
- break;
- }
- if (message.dataMessage != null && message.hasOwnProperty("dataMessage")) {
- var error = $root.tutorial.Message.DataMessage.verify(message.dataMessage);
- if (error)
- return "dataMessage." + error;
- }
- if (message.notificationMessage != null && message.hasOwnProperty("notificationMessage")) {
- var error = $root.tutorial.Message.NotificationMessage.verify(message.notificationMessage);
- if (error)
- return "notificationMessage." + error;
- }
- if (message.roleOptMessage != null && message.hasOwnProperty("roleOptMessage")) {
- var error = $root.tutorial.Message.RoleOptMessage.verify(message.roleOptMessage);
- if (error)
- return "roleOptMessage." + error;
- }
- if (message.msg != null && message.hasOwnProperty("msg"))
- if (!$util.isString(message.msg))
- return "msg: string expected";
- return null;
- };
-
- /**
- * Creates a Message message from a plain object. Also converts values to their respective internal types.
- * @function fromObject
- * @memberof tutorial.Message
- * @static
- * @param {Object.<string,*>} object Plain object
- * @returns {tutorial.Message} Message
- */
- Message.fromObject = function fromObject(object) {
- if (object instanceof $root.tutorial.Message)
- return object;
- var message = new $root.tutorial.Message();
- switch (object.type) {
- case "SELF":
- case 0:
- message.type = 0;
- break;
- case "DATA":
- case 1:
- message.type = 1;
- break;
- case "NOTIFY":
- case 2:
- message.type = 2;
- break;
- case "ROLEOPT":
- case 3:
- message.type = 3;
- break;
- }
- if (object.dataMessage != null) {
- if (typeof object.dataMessage !== "object")
- throw TypeError(".tutorial.Message.dataMessage: object expected");
- message.dataMessage = $root.tutorial.Message.DataMessage.fromObject(object.dataMessage);
- }
- if (object.notificationMessage != null) {
- if (typeof object.notificationMessage !== "object")
- throw TypeError(".tutorial.Message.notificationMessage: object expected");
- message.notificationMessage = $root.tutorial.Message.NotificationMessage.fromObject(object.notificationMessage);
- }
- if (object.roleOptMessage != null) {
- if (typeof object.roleOptMessage !== "object")
- throw TypeError(".tutorial.Message.roleOptMessage: object expected");
- message.roleOptMessage = $root.tutorial.Message.RoleOptMessage.fromObject(object.roleOptMessage);
- }
- if (object.msg != null)
- message.msg = String(object.msg);
- return message;
- };
-
- /**
- * Creates a plain object from a Message message. Also converts values to other types if specified.
- * @function toObject
- * @memberof tutorial.Message
- * @static
- * @param {tutorial.Message} message Message
- * @param {$protobuf.IConversionOptions} [options] Conversion options
- * @returns {Object.<string,*>} Plain object
- */
- Message.toObject = function toObject(message, options) {
- if (!options)
- options = {};
- var object = {};
- if (options.defaults) {
- object.type = options.enums === String ? "SELF" : 0;
- object.dataMessage = null;
- object.notificationMessage = null;
- object.roleOptMessage = null;
- object.msg = "";
- }
- if (message.type != null && message.hasOwnProperty("type"))
- object.type = options.enums === String ? $root.tutorial.Message.Type[message.type] : message.type;
- if (message.dataMessage != null && message.hasOwnProperty("dataMessage"))
- object.dataMessage = $root.tutorial.Message.DataMessage.toObject(message.dataMessage, options);
- if (message.notificationMessage != null && message.hasOwnProperty("notificationMessage"))
- object.notificationMessage = $root.tutorial.Message.NotificationMessage.toObject(message.notificationMessage, options);
- if (message.roleOptMessage != null && message.hasOwnProperty("roleOptMessage"))
- object.roleOptMessage = $root.tutorial.Message.RoleOptMessage.toObject(message.roleOptMessage, options);
- if (message.msg != null && message.hasOwnProperty("msg"))
- object.msg = message.msg;
- return object;
- };
-
- /**
- * Converts this Message to JSON.
- * @function toJSON
- * @memberof tutorial.Message
- * @instance
- * @returns {Object.<string,*>} JSON object
- */
- Message.prototype.toJSON = function toJSON() {
- return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
- };
-
- /**
- * Type enum.
- * @name tutorial.Message.Type
- * @enum {string}
- * @property {number} SELF=0 SELF value
- * @property {number} DATA=1 DATA value
- * @property {number} NOTIFY=2 NOTIFY value
- * @property {number} ROLEOPT=3 ROLEOPT value
- */
- Message.Type = (function() {
- var valuesById = {}, values = Object.create(valuesById);
- values[valuesById[0] = "SELF"] = 0;
- values[valuesById[1] = "DATA"] = 1;
- values[valuesById[2] = "NOTIFY"] = 2;
- values[valuesById[3] = "ROLEOPT"] = 3;
- return values;
- })();
-
- Message.DataMessage = (function() {
-
- /**
- * Properties of a DataMessage.
- * @memberof tutorial.Message
- * @interface IDataMessage
- * @property {number|null} [code] DataMessage code
- * @property {number|null} [result] DataMessage result
- * @property {string|null} [data] DataMessage data
- * @property {string|null} [msg] DataMessage msg
- */
-
- /**
- * Constructs a new DataMessage.
- * @memberof tutorial.Message
- * @classdesc Represents a DataMessage.
- * @implements IDataMessage
- * @constructor
- * @param {tutorial.Message.IDataMessage=} [properties] Properties to set
- */
- function DataMessage(properties) {
- if (properties)
- for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
- if (properties[keys[i]] != null)
- this[keys[i]] = properties[keys[i]];
- }
-
- /**
- * DataMessage code.
- * @member {number} code
- * @memberof tutorial.Message.DataMessage
- * @instance
- */
- DataMessage.prototype.code = 0;
-
- /**
- * DataMessage result.
- * @member {number} result
- * @memberof tutorial.Message.DataMessage
- * @instance
- */
- DataMessage.prototype.result = 0;
-
- /**
- * DataMessage data.
- * @member {string} data
- * @memberof tutorial.Message.DataMessage
- * @instance
- */
- DataMessage.prototype.data = "";
-
- /**
- * DataMessage msg.
- * @member {string} msg
- * @memberof tutorial.Message.DataMessage
- * @instance
- */
- DataMessage.prototype.msg = "";
-
- /**
- * Creates a new DataMessage instance using the specified properties.
- * @function create
- * @memberof tutorial.Message.DataMessage
- * @static
- * @param {tutorial.Message.IDataMessage=} [properties] Properties to set
- * @returns {tutorial.Message.DataMessage} DataMessage instance
- */
- DataMessage.create = function create(properties) {
- return new DataMessage(properties);
- };
-
- /**
- * Encodes the specified DataMessage message. Does not implicitly {@link tutorial.Message.DataMessage.verify|verify} messages.
- * @function encode
- * @memberof tutorial.Message.DataMessage
- * @static
- * @param {tutorial.Message.IDataMessage} message DataMessage message or plain object to encode
- * @param {$protobuf.Writer} [writer] Writer to encode to
- * @returns {$protobuf.Writer} Writer
- */
- DataMessage.encode = function encode(message, writer) {
- if (!writer)
- writer = $Writer.create();
- if (message.code != null && message.hasOwnProperty("code"))
- writer.uint32(/* id 1, wireType 0 =*/8).int32(message.code);
- if (message.result != null && message.hasOwnProperty("result"))
- writer.uint32(/* id 2, wireType 0 =*/16).int32(message.result);
- if (message.data != null && message.hasOwnProperty("data"))
- writer.uint32(/* id 3, wireType 2 =*/26).string(message.data);
- if (message.msg != null && message.hasOwnProperty("msg"))
- writer.uint32(/* id 4, wireType 2 =*/34).string(message.msg);
- return writer;
- };
-
- /**
- * Encodes the specified DataMessage message, length delimited. Does not implicitly {@link tutorial.Message.DataMessage.verify|verify} messages.
- * @function encodeDelimited
- * @memberof tutorial.Message.DataMessage
- * @static
- * @param {tutorial.Message.IDataMessage} message DataMessage message or plain object to encode
- * @param {$protobuf.Writer} [writer] Writer to encode to
- * @returns {$protobuf.Writer} Writer
- */
- DataMessage.encodeDelimited = function encodeDelimited(message, writer) {
- return this.encode(message, writer).ldelim();
- };
-
- /**
- * Decodes a DataMessage message from the specified reader or buffer.
- * @function decode
- * @memberof tutorial.Message.DataMessage
- * @static
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
- * @param {number} [length] Message length if known beforehand
- * @returns {tutorial.Message.DataMessage} DataMessage
- * @throws {Error} If the payload is not a reader or valid buffer
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
- */
- DataMessage.decode = function decode(reader, length) {
- if (!(reader instanceof $Reader))
- reader = $Reader.create(reader);
- var end = length === undefined ? reader.len : reader.pos + length, message = new $root.tutorial.Message.DataMessage();
- while (reader.pos < end) {
- var tag = reader.uint32();
- switch (tag >>> 3) {
- case 1:
- message.code = reader.int32();
- break;
- case 2:
- message.result = reader.int32();
- break;
- case 3:
- message.data = reader.string();
- break;
- case 4:
- message.msg = reader.string();
- break;
- default:
- reader.skipType(tag & 7);
- break;
- }
- }
- return message;
- };
-
- /**
- * Decodes a DataMessage message from the specified reader or buffer, length delimited.
- * @function decodeDelimited
- * @memberof tutorial.Message.DataMessage
- * @static
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
- * @returns {tutorial.Message.DataMessage} DataMessage
- * @throws {Error} If the payload is not a reader or valid buffer
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
- */
- DataMessage.decodeDelimited = function decodeDelimited(reader) {
- if (!(reader instanceof $Reader))
- reader = new $Reader(reader);
- return this.decode(reader, reader.uint32());
- };
-
- /**
- * Verifies a DataMessage message.
- * @function verify
- * @memberof tutorial.Message.DataMessage
- * @static
- * @param {Object.<string,*>} message Plain object to verify
- * @returns {string|null} `null` if valid, otherwise the reason why it is not
- */
- DataMessage.verify = function verify(message) {
- if (typeof message !== "object" || message === null)
- return "object expected";
- if (message.code != null && message.hasOwnProperty("code"))
- if (!$util.isInteger(message.code))
- return "code: integer expected";
- if (message.result != null && message.hasOwnProperty("result"))
- if (!$util.isInteger(message.result))
- return "result: integer expected";
- if (message.data != null && message.hasOwnProperty("data"))
- if (!$util.isString(message.data))
- return "data: string expected";
- if (message.msg != null && message.hasOwnProperty("msg"))
- if (!$util.isString(message.msg))
- return "msg: string expected";
- return null;
- };
-
- /**
- * Creates a DataMessage message from a plain object. Also converts values to their respective internal types.
- * @function fromObject
- * @memberof tutorial.Message.DataMessage
- * @static
- * @param {Object.<string,*>} object Plain object
- * @returns {tutorial.Message.DataMessage} DataMessage
- */
- DataMessage.fromObject = function fromObject(object) {
- if (object instanceof $root.tutorial.Message.DataMessage)
- return object;
- var message = new $root.tutorial.Message.DataMessage();
- if (object.code != null)
- message.code = object.code | 0;
- if (object.result != null)
- message.result = object.result | 0;
- if (object.data != null)
- message.data = String(object.data);
- if (object.msg != null)
- message.msg = String(object.msg);
- return message;
- };
-
- /**
- * Creates a plain object from a DataMessage message. Also converts values to other types if specified.
- * @function toObject
- * @memberof tutorial.Message.DataMessage
- * @static
- * @param {tutorial.Message.DataMessage} message DataMessage
- * @param {$protobuf.IConversionOptions} [options] Conversion options
- * @returns {Object.<string,*>} Plain object
- */
- DataMessage.toObject = function toObject(message, options) {
- if (!options)
- options = {};
- var object = {};
- if (options.defaults) {
- object.code = 0;
- object.result = 0;
- object.data = "";
- object.msg = "";
- }
- if (message.code != null && message.hasOwnProperty("code"))
- object.code = message.code;
- if (message.result != null && message.hasOwnProperty("result"))
- object.result = message.result;
- if (message.data != null && message.hasOwnProperty("data"))
- object.data = message.data;
- if (message.msg != null && message.hasOwnProperty("msg"))
- object.msg = message.msg;
- return object;
- };
-
- /**
- * Converts this DataMessage to JSON.
- * @function toJSON
- * @memberof tutorial.Message.DataMessage
- * @instance
- * @returns {Object.<string,*>} JSON object
- */
- DataMessage.prototype.toJSON = function toJSON() {
- return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
- };
-
- return DataMessage;
- })();
-
- Message.NotificationMessage = (function() {
-
- /**
- * Properties of a NotificationMessage.
- * @memberof tutorial.Message
- * @interface INotificationMessage
- * @property {number|null} [nType] NotificationMessage nType
- */
-
- /**
- * Constructs a new NotificationMessage.
- * @memberof tutorial.Message
- * @classdesc Represents a NotificationMessage.
- * @implements INotificationMessage
- * @constructor
- * @param {tutorial.Message.INotificationMessage=} [properties] Properties to set
- */
- function NotificationMessage(properties) {
- if (properties)
- for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
- if (properties[keys[i]] != null)
- this[keys[i]] = properties[keys[i]];
- }
-
- /**
- * NotificationMessage nType.
- * @member {number} nType
- * @memberof tutorial.Message.NotificationMessage
- * @instance
- */
- NotificationMessage.prototype.nType = 0;
-
- /**
- * Creates a new NotificationMessage instance using the specified properties.
- * @function create
- * @memberof tutorial.Message.NotificationMessage
- * @static
- * @param {tutorial.Message.INotificationMessage=} [properties] Properties to set
- * @returns {tutorial.Message.NotificationMessage} NotificationMessage instance
- */
- NotificationMessage.create = function create(properties) {
- return new NotificationMessage(properties);
- };
-
- /**
- * Encodes the specified NotificationMessage message. Does not implicitly {@link tutorial.Message.NotificationMessage.verify|verify} messages.
- * @function encode
- * @memberof tutorial.Message.NotificationMessage
- * @static
- * @param {tutorial.Message.INotificationMessage} message NotificationMessage message or plain object to encode
- * @param {$protobuf.Writer} [writer] Writer to encode to
- * @returns {$protobuf.Writer} Writer
- */
- NotificationMessage.encode = function encode(message, writer) {
- if (!writer)
- writer = $Writer.create();
- if (message.nType != null && message.hasOwnProperty("nType"))
- writer.uint32(/* id 1, wireType 0 =*/8).int32(message.nType);
- return writer;
- };
-
- /**
- * Encodes the specified NotificationMessage message, length delimited. Does not implicitly {@link tutorial.Message.NotificationMessage.verify|verify} messages.
- * @function encodeDelimited
- * @memberof tutorial.Message.NotificationMessage
- * @static
- * @param {tutorial.Message.INotificationMessage} message NotificationMessage message or plain object to encode
- * @param {$protobuf.Writer} [writer] Writer to encode to
- * @returns {$protobuf.Writer} Writer
- */
- NotificationMessage.encodeDelimited = function encodeDelimited(message, writer) {
- return this.encode(message, writer).ldelim();
- };
-
- /**
- * Decodes a NotificationMessage message from the specified reader or buffer.
- * @function decode
- * @memberof tutorial.Message.NotificationMessage
- * @static
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
- * @param {number} [length] Message length if known beforehand
- * @returns {tutorial.Message.NotificationMessage} NotificationMessage
- * @throws {Error} If the payload is not a reader or valid buffer
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
- */
- NotificationMessage.decode = function decode(reader, length) {
- if (!(reader instanceof $Reader))
- reader = $Reader.create(reader);
- var end = length === undefined ? reader.len : reader.pos + length, message = new $root.tutorial.Message.NotificationMessage();
- while (reader.pos < end) {
- var tag = reader.uint32();
- switch (tag >>> 3) {
- case 1:
- message.nType = reader.int32();
- break;
- default:
- reader.skipType(tag & 7);
- break;
- }
- }
- return message;
- };
-
- /**
- * Decodes a NotificationMessage message from the specified reader or buffer, length delimited.
- * @function decodeDelimited
- * @memberof tutorial.Message.NotificationMessage
- * @static
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
- * @returns {tutorial.Message.NotificationMessage} NotificationMessage
- * @throws {Error} If the payload is not a reader or valid buffer
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
- */
- NotificationMessage.decodeDelimited = function decodeDelimited(reader) {
- if (!(reader instanceof $Reader))
- reader = new $Reader(reader);
- return this.decode(reader, reader.uint32());
- };
-
- /**
- * Verifies a NotificationMessage message.
- * @function verify
- * @memberof tutorial.Message.NotificationMessage
- * @static
- * @param {Object.<string,*>} message Plain object to verify
- * @returns {string|null} `null` if valid, otherwise the reason why it is not
- */
- NotificationMessage.verify = function verify(message) {
- if (typeof message !== "object" || message === null)
- return "object expected";
- if (message.nType != null && message.hasOwnProperty("nType"))
- if (!$util.isInteger(message.nType))
- return "nType: integer expected";
- return null;
- };
-
- /**
- * Creates a NotificationMessage message from a plain object. Also converts values to their respective internal types.
- * @function fromObject
- * @memberof tutorial.Message.NotificationMessage
- * @static
- * @param {Object.<string,*>} object Plain object
- * @returns {tutorial.Message.NotificationMessage} NotificationMessage
- */
- NotificationMessage.fromObject = function fromObject(object) {
- if (object instanceof $root.tutorial.Message.NotificationMessage)
- return object;
- var message = new $root.tutorial.Message.NotificationMessage();
- if (object.nType != null)
- message.nType = object.nType | 0;
- return message;
- };
-
- /**
- * Creates a plain object from a NotificationMessage message. Also converts values to other types if specified.
- * @function toObject
- * @memberof tutorial.Message.NotificationMessage
- * @static
- * @param {tutorial.Message.NotificationMessage} message NotificationMessage
- * @param {$protobuf.IConversionOptions} [options] Conversion options
- * @returns {Object.<string,*>} Plain object
- */
- NotificationMessage.toObject = function toObject(message, options) {
- if (!options)
- options = {};
- var object = {};
- if (options.defaults)
- object.nType = 0;
- if (message.nType != null && message.hasOwnProperty("nType"))
- object.nType = message.nType;
- return object;
- };
-
- /**
- * Converts this NotificationMessage to JSON.
- * @function toJSON
- * @memberof tutorial.Message.NotificationMessage
- * @instance
- * @returns {Object.<string,*>} JSON object
- */
- NotificationMessage.prototype.toJSON = function toJSON() {
- return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
- };
-
- return NotificationMessage;
- })();
-
- Message.RoleOptMessage = (function() {
-
- /**
- * Properties of a RoleOptMessage.
- * @memberof tutorial.Message
- * @interface IRoleOptMessage
- * @property {number|Long|null} [targetUid] RoleOptMessage targetUid
- * @property {number|Long|null} [exBossUid] RoleOptMessage exBossUid
- * @property {number|null} [opt] RoleOptMessage opt
- */
-
- /**
- * Constructs a new RoleOptMessage.
- * @memberof tutorial.Message
- * @classdesc Represents a RoleOptMessage.
- * @implements IRoleOptMessage
- * @constructor
- * @param {tutorial.Message.IRoleOptMessage=} [properties] Properties to set
- */
- function RoleOptMessage(properties) {
- if (properties)
- for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
- if (properties[keys[i]] != null)
- this[keys[i]] = properties[keys[i]];
- }
-
- /**
- * RoleOptMessage targetUid.
- * @member {number|Long} targetUid
- * @memberof tutorial.Message.RoleOptMessage
- * @instance
- */
- RoleOptMessage.prototype.targetUid = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
-
- /**
- * RoleOptMessage exBossUid.
- * @member {number|Long} exBossUid
- * @memberof tutorial.Message.RoleOptMessage
- * @instance
- */
- RoleOptMessage.prototype.exBossUid = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
-
- /**
- * RoleOptMessage opt.
- * @member {number} opt
- * @memberof tutorial.Message.RoleOptMessage
- * @instance
- */
- RoleOptMessage.prototype.opt = 0;
-
- /**
- * Creates a new RoleOptMessage instance using the specified properties.
- * @function create
- * @memberof tutorial.Message.RoleOptMessage
- * @static
- * @param {tutorial.Message.IRoleOptMessage=} [properties] Properties to set
- * @returns {tutorial.Message.RoleOptMessage} RoleOptMessage instance
- */
- RoleOptMessage.create = function create(properties) {
- return new RoleOptMessage(properties);
- };
-
- /**
- * Encodes the specified RoleOptMessage message. Does not implicitly {@link tutorial.Message.RoleOptMessage.verify|verify} messages.
- * @function encode
- * @memberof tutorial.Message.RoleOptMessage
- * @static
- * @param {tutorial.Message.IRoleOptMessage} message RoleOptMessage message or plain object to encode
- * @param {$protobuf.Writer} [writer] Writer to encode to
- * @returns {$protobuf.Writer} Writer
- */
- RoleOptMessage.encode = function encode(message, writer) {
- if (!writer)
- writer = $Writer.create();
- if (message.targetUid != null && message.hasOwnProperty("targetUid"))
- writer.uint32(/* id 1, wireType 0 =*/8).int64(message.targetUid);
- if (message.exBossUid != null && message.hasOwnProperty("exBossUid"))
- writer.uint32(/* id 2, wireType 0 =*/16).int64(message.exBossUid);
- if (message.opt != null && message.hasOwnProperty("opt"))
- writer.uint32(/* id 3, wireType 0 =*/24).int32(message.opt);
- return writer;
- };
-
- /**
- * Encodes the specified RoleOptMessage message, length delimited. Does not implicitly {@link tutorial.Message.RoleOptMessage.verify|verify} messages.
- * @function encodeDelimited
- * @memberof tutorial.Message.RoleOptMessage
- * @static
- * @param {tutorial.Message.IRoleOptMessage} message RoleOptMessage message or plain object to encode
- * @param {$protobuf.Writer} [writer] Writer to encode to
- * @returns {$protobuf.Writer} Writer
- */
- RoleOptMessage.encodeDelimited = function encodeDelimited(message, writer) {
- return this.encode(message, writer).ldelim();
- };
-
- /**
- * Decodes a RoleOptMessage message from the specified reader or buffer.
- * @function decode
- * @memberof tutorial.Message.RoleOptMessage
- * @static
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
- * @param {number} [length] Message length if known beforehand
- * @returns {tutorial.Message.RoleOptMessage} RoleOptMessage
- * @throws {Error} If the payload is not a reader or valid buffer
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
- */
- RoleOptMessage.decode = function decode(reader, length) {
- if (!(reader instanceof $Reader))
- reader = $Reader.create(reader);
- var end = length === undefined ? reader.len : reader.pos + length, message = new $root.tutorial.Message.RoleOptMessage();
- while (reader.pos < end) {
- var tag = reader.uint32();
- switch (tag >>> 3) {
- case 1:
- message.targetUid = reader.int64();
- break;
- case 2:
- message.exBossUid = reader.int64();
- break;
- case 3:
- message.opt = reader.int32();
- break;
- default:
- reader.skipType(tag & 7);
- break;
- }
- }
- return message;
- };
-
- /**
- * Decodes a RoleOptMessage message from the specified reader or buffer, length delimited.
- * @function decodeDelimited
- * @memberof tutorial.Message.RoleOptMessage
- * @static
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
- * @returns {tutorial.Message.RoleOptMessage} RoleOptMessage
- * @throws {Error} If the payload is not a reader or valid buffer
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
- */
- RoleOptMessage.decodeDelimited = function decodeDelimited(reader) {
- if (!(reader instanceof $Reader))
- reader = new $Reader(reader);
- return this.decode(reader, reader.uint32());
- };
-
- /**
- * Verifies a RoleOptMessage message.
- * @function verify
- * @memberof tutorial.Message.RoleOptMessage
- * @static
- * @param {Object.<string,*>} message Plain object to verify
- * @returns {string|null} `null` if valid, otherwise the reason why it is not
- */
- RoleOptMessage.verify = function verify(message) {
- if (typeof message !== "object" || message === null)
- return "object expected";
- if (message.targetUid != null && message.hasOwnProperty("targetUid"))
- if (!$util.isInteger(message.targetUid) && !(message.targetUid && $util.isInteger(message.targetUid.low) && $util.isInteger(message.targetUid.high)))
- return "targetUid: integer|Long expected";
- if (message.exBossUid != null && message.hasOwnProperty("exBossUid"))
- if (!$util.isInteger(message.exBossUid) && !(message.exBossUid && $util.isInteger(message.exBossUid.low) && $util.isInteger(message.exBossUid.high)))
- return "exBossUid: integer|Long expected";
- if (message.opt != null && message.hasOwnProperty("opt"))
- if (!$util.isInteger(message.opt))
- return "opt: integer expected";
- return null;
- };
-
- /**
- * Creates a RoleOptMessage message from a plain object. Also converts values to their respective internal types.
- * @function fromObject
- * @memberof tutorial.Message.RoleOptMessage
- * @static
- * @param {Object.<string,*>} object Plain object
- * @returns {tutorial.Message.RoleOptMessage} RoleOptMessage
- */
- RoleOptMessage.fromObject = function fromObject(object) {
- if (object instanceof $root.tutorial.Message.RoleOptMessage)
- return object;
- var message = new $root.tutorial.Message.RoleOptMessage();
- if (object.targetUid != null)
- if ($util.Long)
- (message.targetUid = $util.Long.fromValue(object.targetUid)).unsigned = false;
- else if (typeof object.targetUid === "string")
- message.targetUid = parseInt(object.targetUid, 10);
- else if (typeof object.targetUid === "number")
- message.targetUid = object.targetUid;
- else if (typeof object.targetUid === "object")
- message.targetUid = new $util.LongBits(object.targetUid.low >>> 0, object.targetUid.high >>> 0).toNumber();
- if (object.exBossUid != null)
- if ($util.Long)
- (message.exBossUid = $util.Long.fromValue(object.exBossUid)).unsigned = false;
- else if (typeof object.exBossUid === "string")
- message.exBossUid = parseInt(object.exBossUid, 10);
- else if (typeof object.exBossUid === "number")
- message.exBossUid = object.exBossUid;
- else if (typeof object.exBossUid === "object")
- message.exBossUid = new $util.LongBits(object.exBossUid.low >>> 0, object.exBossUid.high >>> 0).toNumber();
- if (object.opt != null)
- message.opt = object.opt | 0;
- return message;
- };
-
- /**
- * Creates a plain object from a RoleOptMessage message. Also converts values to other types if specified.
- * @function toObject
- * @memberof tutorial.Message.RoleOptMessage
- * @static
- * @param {tutorial.Message.RoleOptMessage} message RoleOptMessage
- * @param {$protobuf.IConversionOptions} [options] Conversion options
- * @returns {Object.<string,*>} Plain object
- */
- RoleOptMessage.toObject = function toObject(message, options) {
- if (!options)
- options = {};
- var object = {};
- if (options.defaults) {
- if ($util.Long) {
- var long = new $util.Long(0, 0, false);
- object.targetUid = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
- } else
- object.targetUid = options.longs === String ? "0" : 0;
- if ($util.Long) {
- var long = new $util.Long(0, 0, false);
- object.exBossUid = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
- } else
- object.exBossUid = options.longs === String ? "0" : 0;
- object.opt = 0;
- }
- if (message.targetUid != null && message.hasOwnProperty("targetUid"))
- if (typeof message.targetUid === "number")
- object.targetUid = options.longs === String ? String(message.targetUid) : message.targetUid;
- else
- 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;
- if (message.exBossUid != null && message.hasOwnProperty("exBossUid"))
- if (typeof message.exBossUid === "number")
- object.exBossUid = options.longs === String ? String(message.exBossUid) : message.exBossUid;
- else
- 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;
- if (message.opt != null && message.hasOwnProperty("opt"))
- object.opt = message.opt;
- return object;
- };
-
- /**
- * Converts this RoleOptMessage to JSON.
- * @function toJSON
- * @memberof tutorial.Message.RoleOptMessage
- * @instance
- * @returns {Object.<string,*>} JSON object
- */
- RoleOptMessage.prototype.toJSON = function toJSON() {
- return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
- };
-
- return RoleOptMessage;
- })();
-
- return Message;
- })();
-
- return tutorial;
- })();
- return $root;
- });
|