/*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 {tutorial.Message.IReportData|null} [reportData] Message reportData * @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 reportData. * @member {tutorial.Message.IReportData|null|undefined} reportData * @memberof tutorial.Message * @instance */ Message.prototype.reportData = 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.reportData != null && message.hasOwnProperty("reportData")) $root.tutorial.Message.ReportData.encode(message.reportData, writer.uint32(/* id 5, wireType 2 =*/42).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 5: message.reportData = $root.tutorial.Message.ReportData.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.} 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: case 4: 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.reportData != null && message.hasOwnProperty("reportData")) { var error = $root.tutorial.Message.ReportData.verify(message.reportData); if (error) return "reportData." + 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.} 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; case "REPORT": case 4: message.type = 4; 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.reportData != null) { if (typeof object.reportData !== "object") throw TypeError(".tutorial.Message.reportData: object expected"); message.reportData = $root.tutorial.Message.ReportData.fromObject(object.reportData); } 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.} 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.reportData = 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.reportData != null && message.hasOwnProperty("reportData")) object.reportData = $root.tutorial.Message.ReportData.toObject(message.reportData, 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.} 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 * @property {number} REPORT=4 REPORT 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; values[valuesById[4] = "REPORT"] = 4; 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.} 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.} 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.} 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.} 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.} 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.} 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.} 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.} 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.} 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.} 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.} 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.} JSON object */ RoleOptMessage.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; return RoleOptMessage; })(); Message.ReportData = (function() { /** * Properties of a ReportData. * @memberof tutorial.Message * @interface IReportData * @property {number|null} [seq] * 上报序号,每次重新获取时重置 * @property {number|Long|null} [t] 时间戳 * @property {number|null} [cmd] @see com.duowan.allstar.model.enumeration.Cmd * @property {number|Long|null} [gi] grossIncome * @property {number|Long|null} [s] @see com.duowan.allstar.model.home.UserExtra#stars * @property {Array.|null} [b] @see BuildingInfoForm * @property {Array.|null} [ub] 未解锁建筑 */ /** * Constructs a new ReportData. * @memberof tutorial.Message * @classdesc Represents a ReportData. * @implements IReportData * @constructor * @param {tutorial.Message.IReportData=} [properties] Properties to set */ function ReportData(properties) { this.b = []; this.ub = []; 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]]; } /** * * 上报序号,每次重新获取时重置 * @member {number} seq * @memberof tutorial.Message.ReportData * @instance */ ReportData.prototype.seq = 0; /** * 时间戳 * @member {number|Long} t * @memberof tutorial.Message.ReportData * @instance */ ReportData.prototype.t = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** * @see com.duowan.allstar.model.enumeration.Cmd * @member {number} cmd * @memberof tutorial.Message.ReportData * @instance */ ReportData.prototype.cmd = 0; /** * grossIncome * @member {number|Long} gi * @memberof tutorial.Message.ReportData * @instance */ ReportData.prototype.gi = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** * @see com.duowan.allstar.model.home.UserExtra#stars * @member {number|Long} s * @memberof tutorial.Message.ReportData * @instance */ ReportData.prototype.s = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** * @see BuildingInfoForm * @member {Array.} b * @memberof tutorial.Message.ReportData * @instance */ ReportData.prototype.b = $util.emptyArray; /** * 未解锁建筑 * @member {Array.} ub * @memberof tutorial.Message.ReportData * @instance */ ReportData.prototype.ub = $util.emptyArray; /** * Creates a new ReportData instance using the specified properties. * @function create * @memberof tutorial.Message.ReportData * @static * @param {tutorial.Message.IReportData=} [properties] Properties to set * @returns {tutorial.Message.ReportData} ReportData instance */ ReportData.create = function create(properties) { return new ReportData(properties); }; /** * Encodes the specified ReportData message. Does not implicitly {@link tutorial.Message.ReportData.verify|verify} messages. * @function encode * @memberof tutorial.Message.ReportData * @static * @param {tutorial.Message.IReportData} message ReportData message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ ReportData.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.seq != null && message.hasOwnProperty("seq")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.seq); if (message.t != null && message.hasOwnProperty("t")) writer.uint32(/* id 2, wireType 0 =*/16).int64(message.t); if (message.cmd != null && message.hasOwnProperty("cmd")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.cmd); if (message.gi != null && message.hasOwnProperty("gi")) writer.uint32(/* id 4, wireType 0 =*/32).int64(message.gi); if (message.s != null && message.hasOwnProperty("s")) writer.uint32(/* id 5, wireType 0 =*/40).int64(message.s); if (message.b != null && message.b.length) for (var i = 0; i < message.b.length; ++i) $root.tutorial.Message.BuildingInfo.encode(message.b[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); if (message.ub != null && message.ub.length) for (var i = 0; i < message.ub.length; ++i) $root.tutorial.Message.BuildingInfo.encode(message.ub[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); return writer; }; /** * Encodes the specified ReportData message, length delimited. Does not implicitly {@link tutorial.Message.ReportData.verify|verify} messages. * @function encodeDelimited * @memberof tutorial.Message.ReportData * @static * @param {tutorial.Message.IReportData} message ReportData message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ ReportData.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a ReportData message from the specified reader or buffer. * @function decode * @memberof tutorial.Message.ReportData * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {tutorial.Message.ReportData} ReportData * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ ReportData.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.ReportData(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: message.seq = reader.int32(); break; case 2: message.t = reader.int64(); break; case 3: message.cmd = reader.int32(); break; case 4: message.gi = reader.int64(); break; case 5: message.s = reader.int64(); break; case 6: if (!(message.b && message.b.length)) message.b = []; message.b.push($root.tutorial.Message.BuildingInfo.decode(reader, reader.uint32())); break; case 7: if (!(message.ub && message.ub.length)) message.ub = []; message.ub.push($root.tutorial.Message.BuildingInfo.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a ReportData message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof tutorial.Message.ReportData * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {tutorial.Message.ReportData} ReportData * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ ReportData.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a ReportData message. * @function verify * @memberof tutorial.Message.ReportData * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ ReportData.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.seq != null && message.hasOwnProperty("seq")) if (!$util.isInteger(message.seq)) return "seq: integer expected"; if (message.t != null && message.hasOwnProperty("t")) if (!$util.isInteger(message.t) && !(message.t && $util.isInteger(message.t.low) && $util.isInteger(message.t.high))) return "t: integer|Long expected"; if (message.cmd != null && message.hasOwnProperty("cmd")) if (!$util.isInteger(message.cmd)) return "cmd: integer expected"; if (message.gi != null && message.hasOwnProperty("gi")) if (!$util.isInteger(message.gi) && !(message.gi && $util.isInteger(message.gi.low) && $util.isInteger(message.gi.high))) return "gi: integer|Long expected"; if (message.s != null && message.hasOwnProperty("s")) if (!$util.isInteger(message.s) && !(message.s && $util.isInteger(message.s.low) && $util.isInteger(message.s.high))) return "s: integer|Long expected"; if (message.b != null && message.hasOwnProperty("b")) { if (!Array.isArray(message.b)) return "b: array expected"; for (var i = 0; i < message.b.length; ++i) { var error = $root.tutorial.Message.BuildingInfo.verify(message.b[i]); if (error) return "b." + error; } } if (message.ub != null && message.hasOwnProperty("ub")) { if (!Array.isArray(message.ub)) return "ub: array expected"; for (var i = 0; i < message.ub.length; ++i) { var error = $root.tutorial.Message.BuildingInfo.verify(message.ub[i]); if (error) return "ub." + error; } } return null; }; /** * Creates a ReportData message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof tutorial.Message.ReportData * @static * @param {Object.} object Plain object * @returns {tutorial.Message.ReportData} ReportData */ ReportData.fromObject = function fromObject(object) { if (object instanceof $root.tutorial.Message.ReportData) return object; var message = new $root.tutorial.Message.ReportData(); if (object.seq != null) message.seq = object.seq | 0; if (object.t != null) if ($util.Long) (message.t = $util.Long.fromValue(object.t)).unsigned = false; else if (typeof object.t === "string") message.t = parseInt(object.t, 10); else if (typeof object.t === "number") message.t = object.t; else if (typeof object.t === "object") message.t = new $util.LongBits(object.t.low >>> 0, object.t.high >>> 0).toNumber(); if (object.cmd != null) message.cmd = object.cmd | 0; if (object.gi != null) if ($util.Long) (message.gi = $util.Long.fromValue(object.gi)).unsigned = false; else if (typeof object.gi === "string") message.gi = parseInt(object.gi, 10); else if (typeof object.gi === "number") message.gi = object.gi; else if (typeof object.gi === "object") message.gi = new $util.LongBits(object.gi.low >>> 0, object.gi.high >>> 0).toNumber(); if (object.s != null) if ($util.Long) (message.s = $util.Long.fromValue(object.s)).unsigned = false; else if (typeof object.s === "string") message.s = parseInt(object.s, 10); else if (typeof object.s === "number") message.s = object.s; else if (typeof object.s === "object") message.s = new $util.LongBits(object.s.low >>> 0, object.s.high >>> 0).toNumber(); if (object.b) { if (!Array.isArray(object.b)) throw TypeError(".tutorial.Message.ReportData.b: array expected"); message.b = []; for (var i = 0; i < object.b.length; ++i) { if (typeof object.b[i] !== "object") throw TypeError(".tutorial.Message.ReportData.b: object expected"); message.b[i] = $root.tutorial.Message.BuildingInfo.fromObject(object.b[i]); } } if (object.ub) { if (!Array.isArray(object.ub)) throw TypeError(".tutorial.Message.ReportData.ub: array expected"); message.ub = []; for (var i = 0; i < object.ub.length; ++i) { if (typeof object.ub[i] !== "object") throw TypeError(".tutorial.Message.ReportData.ub: object expected"); message.ub[i] = $root.tutorial.Message.BuildingInfo.fromObject(object.ub[i]); } } return message; }; /** * Creates a plain object from a ReportData message. Also converts values to other types if specified. * @function toObject * @memberof tutorial.Message.ReportData * @static * @param {tutorial.Message.ReportData} message ReportData * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ ReportData.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) { object.b = []; object.ub = []; } if (options.defaults) { object.seq = 0; if ($util.Long) { var long = new $util.Long(0, 0, false); object.t = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; } else object.t = options.longs === String ? "0" : 0; object.cmd = 0; if ($util.Long) { var long = new $util.Long(0, 0, false); object.gi = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; } else object.gi = options.longs === String ? "0" : 0; if ($util.Long) { var long = new $util.Long(0, 0, false); object.s = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; } else object.s = options.longs === String ? "0" : 0; } if (message.seq != null && message.hasOwnProperty("seq")) object.seq = message.seq; if (message.t != null && message.hasOwnProperty("t")) if (typeof message.t === "number") object.t = options.longs === String ? String(message.t) : message.t; else object.t = options.longs === String ? $util.Long.prototype.toString.call(message.t) : options.longs === Number ? new $util.LongBits(message.t.low >>> 0, message.t.high >>> 0).toNumber() : message.t; if (message.cmd != null && message.hasOwnProperty("cmd")) object.cmd = message.cmd; if (message.gi != null && message.hasOwnProperty("gi")) if (typeof message.gi === "number") object.gi = options.longs === String ? String(message.gi) : message.gi; else object.gi = options.longs === String ? $util.Long.prototype.toString.call(message.gi) : options.longs === Number ? new $util.LongBits(message.gi.low >>> 0, message.gi.high >>> 0).toNumber() : message.gi; if (message.s != null && message.hasOwnProperty("s")) if (typeof message.s === "number") object.s = options.longs === String ? String(message.s) : message.s; else object.s = options.longs === String ? $util.Long.prototype.toString.call(message.s) : options.longs === Number ? new $util.LongBits(message.s.low >>> 0, message.s.high >>> 0).toNumber() : message.s; if (message.b && message.b.length) { object.b = []; for (var j = 0; j < message.b.length; ++j) object.b[j] = $root.tutorial.Message.BuildingInfo.toObject(message.b[j], options); } if (message.ub && message.ub.length) { object.ub = []; for (var j = 0; j < message.ub.length; ++j) object.ub[j] = $root.tutorial.Message.BuildingInfo.toObject(message.ub[j], options); } return object; }; /** * Converts this ReportData to JSON. * @function toJSON * @memberof tutorial.Message.ReportData * @instance * @returns {Object.} JSON object */ ReportData.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; return ReportData; })(); Message.BuildingInfo = (function() { /** * Properties of a BuildingInfo. * @memberof tutorial.Message * @interface IBuildingInfo * @property {number|Long|null} [id] BuildingInfo id * @property {number|null} [l] BuildingInfo l * @property {number|null} [cc] BuildingInfo cc */ /** * Constructs a new BuildingInfo. * @memberof tutorial.Message * @classdesc Represents a BuildingInfo. * @implements IBuildingInfo * @constructor * @param {tutorial.Message.IBuildingInfo=} [properties] Properties to set */ function BuildingInfo(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]]; } /** * BuildingInfo id. * @member {number|Long} id * @memberof tutorial.Message.BuildingInfo * @instance */ BuildingInfo.prototype.id = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** * BuildingInfo l. * @member {number} l * @memberof tutorial.Message.BuildingInfo * @instance */ BuildingInfo.prototype.l = 0; /** * BuildingInfo cc. * @member {number} cc * @memberof tutorial.Message.BuildingInfo * @instance */ BuildingInfo.prototype.cc = 0; /** * Creates a new BuildingInfo instance using the specified properties. * @function create * @memberof tutorial.Message.BuildingInfo * @static * @param {tutorial.Message.IBuildingInfo=} [properties] Properties to set * @returns {tutorial.Message.BuildingInfo} BuildingInfo instance */ BuildingInfo.create = function create(properties) { return new BuildingInfo(properties); }; /** * Encodes the specified BuildingInfo message. Does not implicitly {@link tutorial.Message.BuildingInfo.verify|verify} messages. * @function encode * @memberof tutorial.Message.BuildingInfo * @static * @param {tutorial.Message.IBuildingInfo} message BuildingInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ BuildingInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.id != null && message.hasOwnProperty("id")) writer.uint32(/* id 1, wireType 0 =*/8).int64(message.id); if (message.l != null && message.hasOwnProperty("l")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.l); if (message.cc != null && message.hasOwnProperty("cc")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.cc); return writer; }; /** * Encodes the specified BuildingInfo message, length delimited. Does not implicitly {@link tutorial.Message.BuildingInfo.verify|verify} messages. * @function encodeDelimited * @memberof tutorial.Message.BuildingInfo * @static * @param {tutorial.Message.IBuildingInfo} message BuildingInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ BuildingInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a BuildingInfo message from the specified reader or buffer. * @function decode * @memberof tutorial.Message.BuildingInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {tutorial.Message.BuildingInfo} BuildingInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ BuildingInfo.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.BuildingInfo(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: message.id = reader.int64(); break; case 2: message.l = reader.int32(); break; case 3: message.cc = reader.int32(); break; default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a BuildingInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof tutorial.Message.BuildingInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {tutorial.Message.BuildingInfo} BuildingInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ BuildingInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a BuildingInfo message. * @function verify * @memberof tutorial.Message.BuildingInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ BuildingInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.id != null && message.hasOwnProperty("id")) if (!$util.isInteger(message.id) && !(message.id && $util.isInteger(message.id.low) && $util.isInteger(message.id.high))) return "id: integer|Long expected"; if (message.l != null && message.hasOwnProperty("l")) if (!$util.isInteger(message.l)) return "l: integer expected"; if (message.cc != null && message.hasOwnProperty("cc")) if (!$util.isInteger(message.cc)) return "cc: integer expected"; return null; }; /** * Creates a BuildingInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof tutorial.Message.BuildingInfo * @static * @param {Object.} object Plain object * @returns {tutorial.Message.BuildingInfo} BuildingInfo */ BuildingInfo.fromObject = function fromObject(object) { if (object instanceof $root.tutorial.Message.BuildingInfo) return object; var message = new $root.tutorial.Message.BuildingInfo(); if (object.id != null) if ($util.Long) (message.id = $util.Long.fromValue(object.id)).unsigned = false; else if (typeof object.id === "string") message.id = parseInt(object.id, 10); else if (typeof object.id === "number") message.id = object.id; else if (typeof object.id === "object") message.id = new $util.LongBits(object.id.low >>> 0, object.id.high >>> 0).toNumber(); if (object.l != null) message.l = object.l | 0; if (object.cc != null) message.cc = object.cc | 0; return message; }; /** * Creates a plain object from a BuildingInfo message. Also converts values to other types if specified. * @function toObject * @memberof tutorial.Message.BuildingInfo * @static * @param {tutorial.Message.BuildingInfo} message BuildingInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ BuildingInfo.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.id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; } else object.id = options.longs === String ? "0" : 0; object.l = 0; object.cc = 0; } if (message.id != null && message.hasOwnProperty("id")) if (typeof message.id === "number") object.id = options.longs === String ? String(message.id) : message.id; else object.id = options.longs === String ? $util.Long.prototype.toString.call(message.id) : options.longs === Number ? new $util.LongBits(message.id.low >>> 0, message.id.high >>> 0).toNumber() : message.id; if (message.l != null && message.hasOwnProperty("l")) object.l = message.l; if (message.cc != null && message.hasOwnProperty("cc")) object.cc = message.cc; return object; }; /** * Converts this BuildingInfo to JSON. * @function toJSON * @memberof tutorial.Message.BuildingInfo * @instance * @returns {Object.} JSON object */ BuildingInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; return BuildingInfo; })(); return Message; })(); return tutorial; })(); return $root; });