1934 lines
71 KiB
JavaScript
Raw Normal View History

2025-07-05 16:16:50 +08:00
/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
"use strict";
var $protobuf = require("protobufjs/minimal");
// Common aliases
var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
// Exported root namespace
var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});
$root.ReqMatchRoom = (function() {
/**
* Properties of a ReqMatchRoom.
* @exports IReqMatchRoom
* @interface IReqMatchRoom
* @property {ServiceTypeId|null} [gameId] ReqMatchRoom gameId
* @property {number|null} [roomType] ReqMatchRoom roomType
*/
/**
* Constructs a new ReqMatchRoom.
* @exports ReqMatchRoom
* @classdesc Represents a ReqMatchRoom.
* @implements IReqMatchRoom
* @constructor
* @param {IReqMatchRoom=} [properties] Properties to set
*/
function ReqMatchRoom(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]];
}
/**
* ReqMatchRoom gameId.
* @member {ServiceTypeId} gameId
* @memberof ReqMatchRoom
* @instance
*/
ReqMatchRoom.prototype.gameId = 0;
/**
* ReqMatchRoom roomType.
* @member {number} roomType
* @memberof ReqMatchRoom
* @instance
*/
ReqMatchRoom.prototype.roomType = 0;
/**
* Creates a new ReqMatchRoom instance using the specified properties.
* @function create
* @memberof ReqMatchRoom
* @static
* @param {IReqMatchRoom=} [properties] Properties to set
* @returns {ReqMatchRoom} ReqMatchRoom instance
*/
ReqMatchRoom.create = function create(properties) {
return new ReqMatchRoom(properties);
};
/**
* Encodes the specified ReqMatchRoom message. Does not implicitly {@link ReqMatchRoom.verify|verify} messages.
* @function encode
* @memberof ReqMatchRoom
* @static
* @param {IReqMatchRoom} message ReqMatchRoom message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
ReqMatchRoom.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.gameId != null && Object.hasOwnProperty.call(message, "gameId"))
writer.uint32(/* id 1, wireType 0 =*/8).int32(message.gameId);
if (message.roomType != null && Object.hasOwnProperty.call(message, "roomType"))
writer.uint32(/* id 2, wireType 0 =*/16).int32(message.roomType);
return writer;
};
/**
* Encodes the specified ReqMatchRoom message, length delimited. Does not implicitly {@link ReqMatchRoom.verify|verify} messages.
* @function encodeDelimited
* @memberof ReqMatchRoom
* @static
* @param {IReqMatchRoom} message ReqMatchRoom message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
ReqMatchRoom.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a ReqMatchRoom message from the specified reader or buffer.
* @function decode
* @memberof ReqMatchRoom
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {ReqMatchRoom} ReqMatchRoom
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
ReqMatchRoom.decode = function decode(reader, length, error) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.ReqMatchRoom();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 1: {
message.gameId = reader.int32();
break;
}
case 2: {
message.roomType = reader.int32();
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a ReqMatchRoom message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof ReqMatchRoom
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {ReqMatchRoom} ReqMatchRoom
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
ReqMatchRoom.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a ReqMatchRoom message.
* @function verify
* @memberof ReqMatchRoom
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
ReqMatchRoom.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.gameId != null && message.hasOwnProperty("gameId"))
switch (message.gameId) {
default:
return "gameId: enum value expected";
case 0:
case 10000:
case 10005:
case 10010:
case 10015:
case 10020:
case 20000:
case 20005:
case 30000:
break;
}
if (message.roomType != null && message.hasOwnProperty("roomType"))
if (!$util.isInteger(message.roomType))
return "roomType: integer expected";
return null;
};
/**
* Creates a ReqMatchRoom message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof ReqMatchRoom
* @static
* @param {Object.<string,*>} object Plain object
* @returns {ReqMatchRoom} ReqMatchRoom
*/
ReqMatchRoom.fromObject = function fromObject(object) {
if (object instanceof $root.ReqMatchRoom)
return object;
var message = new $root.ReqMatchRoom();
switch (object.gameId) {
default:
if (typeof object.gameId === "number") {
message.gameId = object.gameId;
break;
}
break;
case "STI_Unknown":
case 0:
message.gameId = 0;
break;
case "STI_Login":
case 10000:
message.gameId = 10000;
break;
case "STI_Chat":
case 10005:
message.gameId = 10005;
break;
case "STI_Match":
case 10010:
message.gameId = 10010;
break;
case "STI_Lobby":
case 10015:
message.gameId = 10015;
break;
case "STI_Admin":
case 10020:
message.gameId = 10020;
break;
case "STI_Gate":
case 20000:
message.gameId = 20000;
break;
case "STI_ColorGame":
case 20005:
message.gameId = 20005;
break;
case "STI_DB":
case 30000:
message.gameId = 30000;
break;
}
if (object.roomType != null)
message.roomType = object.roomType | 0;
return message;
};
/**
* Creates a plain object from a ReqMatchRoom message. Also converts values to other types if specified.
* @function toObject
* @memberof ReqMatchRoom
* @static
* @param {ReqMatchRoom} message ReqMatchRoom
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
ReqMatchRoom.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults) {
object.gameId = options.enums === String ? "STI_Unknown" : 0;
object.roomType = 0;
}
if (message.gameId != null && message.hasOwnProperty("gameId"))
object.gameId = options.enums === String ? $root.ServiceTypeId[message.gameId] === undefined ? message.gameId : $root.ServiceTypeId[message.gameId] : message.gameId;
if (message.roomType != null && message.hasOwnProperty("roomType"))
object.roomType = message.roomType;
return object;
};
/**
* Converts this ReqMatchRoom to JSON.
* @function toJSON
* @memberof ReqMatchRoom
* @instance
* @returns {Object.<string,*>} JSON object
*/
ReqMatchRoom.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for ReqMatchRoom
* @function getTypeUrl
* @memberof ReqMatchRoom
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
ReqMatchRoom.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/ReqMatchRoom";
};
return ReqMatchRoom;
})();
$root.RspMatchRoom = (function() {
/**
* Properties of a RspMatchRoom.
* @exports IRspMatchRoom
* @interface IRspMatchRoom
* @property {ErrCode|null} [code] RspMatchRoom code
* @property {ServiceTypeId|null} [gameId] RspMatchRoom gameId
* @property {number|null} [roomType] RspMatchRoom roomType
* @property {IGameUser|null} [User] RspMatchRoom User
* @property {RspMatchRoom.IColorInfo|null} [colorInfo] RspMatchRoom colorInfo
*/
/**
* Constructs a new RspMatchRoom.
* @exports RspMatchRoom
* @classdesc Represents a RspMatchRoom.
* @implements IRspMatchRoom
* @constructor
* @param {IRspMatchRoom=} [properties] Properties to set
*/
function RspMatchRoom(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]];
}
/**
* RspMatchRoom code.
* @member {ErrCode} code
* @memberof RspMatchRoom
* @instance
*/
RspMatchRoom.prototype.code = 0;
/**
* RspMatchRoom gameId.
* @member {ServiceTypeId} gameId
* @memberof RspMatchRoom
* @instance
*/
RspMatchRoom.prototype.gameId = 0;
/**
* RspMatchRoom roomType.
* @member {number} roomType
* @memberof RspMatchRoom
* @instance
*/
RspMatchRoom.prototype.roomType = 0;
/**
* RspMatchRoom User.
* @member {IGameUser|null|undefined} User
* @memberof RspMatchRoom
* @instance
*/
RspMatchRoom.prototype.User = null;
/**
* RspMatchRoom colorInfo.
* @member {RspMatchRoom.IColorInfo|null|undefined} colorInfo
* @memberof RspMatchRoom
* @instance
*/
RspMatchRoom.prototype.colorInfo = null;
/**
* Creates a new RspMatchRoom instance using the specified properties.
* @function create
* @memberof RspMatchRoom
* @static
* @param {IRspMatchRoom=} [properties] Properties to set
* @returns {RspMatchRoom} RspMatchRoom instance
*/
RspMatchRoom.create = function create(properties) {
return new RspMatchRoom(properties);
};
/**
* Encodes the specified RspMatchRoom message. Does not implicitly {@link RspMatchRoom.verify|verify} messages.
* @function encode
* @memberof RspMatchRoom
* @static
* @param {IRspMatchRoom} message RspMatchRoom message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
RspMatchRoom.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.code != null && Object.hasOwnProperty.call(message, "code"))
writer.uint32(/* id 1, wireType 0 =*/8).int32(message.code);
if (message.gameId != null && Object.hasOwnProperty.call(message, "gameId"))
writer.uint32(/* id 2, wireType 0 =*/16).int32(message.gameId);
if (message.roomType != null && Object.hasOwnProperty.call(message, "roomType"))
writer.uint32(/* id 3, wireType 0 =*/24).int32(message.roomType);
if (message.User != null && Object.hasOwnProperty.call(message, "User"))
$root.GameUser.encode(message.User, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim();
if (message.colorInfo != null && Object.hasOwnProperty.call(message, "colorInfo"))
$root.RspMatchRoom.ColorInfo.encode(message.colorInfo, writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim();
return writer;
};
/**
* Encodes the specified RspMatchRoom message, length delimited. Does not implicitly {@link RspMatchRoom.verify|verify} messages.
* @function encodeDelimited
* @memberof RspMatchRoom
* @static
* @param {IRspMatchRoom} message RspMatchRoom message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
RspMatchRoom.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a RspMatchRoom message from the specified reader or buffer.
* @function decode
* @memberof RspMatchRoom
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {RspMatchRoom} RspMatchRoom
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
RspMatchRoom.decode = function decode(reader, length, error) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.RspMatchRoom();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 1: {
message.code = reader.int32();
break;
}
case 2: {
message.gameId = reader.int32();
break;
}
case 3: {
message.roomType = reader.int32();
break;
}
case 4: {
message.User = $root.GameUser.decode(reader, reader.uint32());
break;
}
case 20: {
message.colorInfo = $root.RspMatchRoom.ColorInfo.decode(reader, reader.uint32());
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a RspMatchRoom message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof RspMatchRoom
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {RspMatchRoom} RspMatchRoom
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
RspMatchRoom.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a RspMatchRoom message.
* @function verify
* @memberof RspMatchRoom
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
RspMatchRoom.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.code != null && message.hasOwnProperty("code"))
switch (message.code) {
default:
return "code: enum value expected";
case 0:
case 1:
case 2:
case 100:
case 102:
case 103:
case 104:
case 110:
case 115:
case 120:
case 125:
case 126:
case 127:
case 500:
case 505:
break;
}
if (message.gameId != null && message.hasOwnProperty("gameId"))
switch (message.gameId) {
default:
return "gameId: enum value expected";
case 0:
case 10000:
case 10005:
case 10010:
case 10015:
case 10020:
case 20000:
case 20005:
case 30000:
break;
}
if (message.roomType != null && message.hasOwnProperty("roomType"))
if (!$util.isInteger(message.roomType))
return "roomType: integer expected";
if (message.User != null && message.hasOwnProperty("User")) {
var error = $root.GameUser.verify(message.User);
if (error)
return "User." + error;
}
if (message.colorInfo != null && message.hasOwnProperty("colorInfo")) {
var error = $root.RspMatchRoom.ColorInfo.verify(message.colorInfo);
if (error)
return "colorInfo." + error;
}
return null;
};
/**
* Creates a RspMatchRoom message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof RspMatchRoom
* @static
* @param {Object.<string,*>} object Plain object
* @returns {RspMatchRoom} RspMatchRoom
*/
RspMatchRoom.fromObject = function fromObject(object) {
if (object instanceof $root.RspMatchRoom)
return object;
var message = new $root.RspMatchRoom();
switch (object.code) {
default:
if (typeof object.code === "number") {
message.code = object.code;
break;
}
break;
case "OK":
case 0:
message.code = 0;
break;
case "SystemErr":
case 1:
message.code = 1;
break;
case "ParamErr":
case 2:
message.code = 2;
break;
case "LoginDiffLoc":
case 100:
message.code = 100;
break;
case "LoginUserOrPwdErr":
case 102:
message.code = 102;
break;
case "AccountFrozen":
case 103:
message.code = 103;
break;
case "AccountBanned":
case 104:
message.code = 104;
break;
case "RegisterUserExist":
case 110:
message.code = 110;
break;
case "VersionTooLow":
case 115:
message.code = 115;
break;
case "Maintain":
case 120:
message.code = 120;
break;
case "GoldNotEnough":
case 125:
message.code = 125;
break;
case "NotBetCount":
case 126:
message.code = 126;
break;
case "NotLeaveRoom":
case 127:
message.code = 127;
break;
case "TotalBetExceedsLimit":
case 500:
message.code = 500;
break;
case "AreaBetExceedsLimit":
case 505:
message.code = 505;
break;
}
switch (object.gameId) {
default:
if (typeof object.gameId === "number") {
message.gameId = object.gameId;
break;
}
break;
case "STI_Unknown":
case 0:
message.gameId = 0;
break;
case "STI_Login":
case 10000:
message.gameId = 10000;
break;
case "STI_Chat":
case 10005:
message.gameId = 10005;
break;
case "STI_Match":
case 10010:
message.gameId = 10010;
break;
case "STI_Lobby":
case 10015:
message.gameId = 10015;
break;
case "STI_Admin":
case 10020:
message.gameId = 10020;
break;
case "STI_Gate":
case 20000:
message.gameId = 20000;
break;
case "STI_ColorGame":
case 20005:
message.gameId = 20005;
break;
case "STI_DB":
case 30000:
message.gameId = 30000;
break;
}
if (object.roomType != null)
message.roomType = object.roomType | 0;
if (object.User != null) {
if (typeof object.User !== "object")
throw TypeError(".RspMatchRoom.User: object expected");
message.User = $root.GameUser.fromObject(object.User);
}
if (object.colorInfo != null) {
if (typeof object.colorInfo !== "object")
throw TypeError(".RspMatchRoom.colorInfo: object expected");
message.colorInfo = $root.RspMatchRoom.ColorInfo.fromObject(object.colorInfo);
}
return message;
};
/**
* Creates a plain object from a RspMatchRoom message. Also converts values to other types if specified.
* @function toObject
* @memberof RspMatchRoom
* @static
* @param {RspMatchRoom} message RspMatchRoom
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
RspMatchRoom.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults) {
object.code = options.enums === String ? "OK" : 0;
object.gameId = options.enums === String ? "STI_Unknown" : 0;
object.roomType = 0;
object.User = null;
object.colorInfo = null;
}
if (message.code != null && message.hasOwnProperty("code"))
object.code = options.enums === String ? $root.ErrCode[message.code] === undefined ? message.code : $root.ErrCode[message.code] : message.code;
if (message.gameId != null && message.hasOwnProperty("gameId"))
object.gameId = options.enums === String ? $root.ServiceTypeId[message.gameId] === undefined ? message.gameId : $root.ServiceTypeId[message.gameId] : message.gameId;
if (message.roomType != null && message.hasOwnProperty("roomType"))
object.roomType = message.roomType;
if (message.User != null && message.hasOwnProperty("User"))
object.User = $root.GameUser.toObject(message.User, options);
if (message.colorInfo != null && message.hasOwnProperty("colorInfo"))
object.colorInfo = $root.RspMatchRoom.ColorInfo.toObject(message.colorInfo, options);
return object;
};
/**
* Converts this RspMatchRoom to JSON.
* @function toJSON
* @memberof RspMatchRoom
* @instance
* @returns {Object.<string,*>} JSON object
*/
RspMatchRoom.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for RspMatchRoom
* @function getTypeUrl
* @memberof RspMatchRoom
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
RspMatchRoom.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/RspMatchRoom";
};
RspMatchRoom.ColorInfo = (function() {
/**
* Properties of a ColorInfo.
* @memberof RspMatchRoom
* @interface IColorInfo
*/
/**
* Constructs a new ColorInfo.
* @memberof RspMatchRoom
* @classdesc Represents a ColorInfo.
* @implements IColorInfo
* @constructor
* @param {RspMatchRoom.IColorInfo=} [properties] Properties to set
*/
function ColorInfo(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]];
}
/**
* Creates a new ColorInfo instance using the specified properties.
* @function create
* @memberof RspMatchRoom.ColorInfo
* @static
* @param {RspMatchRoom.IColorInfo=} [properties] Properties to set
* @returns {RspMatchRoom.ColorInfo} ColorInfo instance
*/
ColorInfo.create = function create(properties) {
return new ColorInfo(properties);
};
/**
* Encodes the specified ColorInfo message. Does not implicitly {@link RspMatchRoom.ColorInfo.verify|verify} messages.
* @function encode
* @memberof RspMatchRoom.ColorInfo
* @static
* @param {RspMatchRoom.IColorInfo} message ColorInfo message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
ColorInfo.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
return writer;
};
/**
* Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link RspMatchRoom.ColorInfo.verify|verify} messages.
* @function encodeDelimited
* @memberof RspMatchRoom.ColorInfo
* @static
* @param {RspMatchRoom.IColorInfo} message ColorInfo message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
ColorInfo.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a ColorInfo message from the specified reader or buffer.
* @function decode
* @memberof RspMatchRoom.ColorInfo
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {RspMatchRoom.ColorInfo} ColorInfo
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
ColorInfo.decode = function decode(reader, length, error) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.RspMatchRoom.ColorInfo();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a ColorInfo message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof RspMatchRoom.ColorInfo
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {RspMatchRoom.ColorInfo} ColorInfo
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
ColorInfo.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a ColorInfo message.
* @function verify
* @memberof RspMatchRoom.ColorInfo
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
ColorInfo.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
return null;
};
/**
* Creates a ColorInfo message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof RspMatchRoom.ColorInfo
* @static
* @param {Object.<string,*>} object Plain object
* @returns {RspMatchRoom.ColorInfo} ColorInfo
*/
ColorInfo.fromObject = function fromObject(object) {
if (object instanceof $root.RspMatchRoom.ColorInfo)
return object;
return new $root.RspMatchRoom.ColorInfo();
};
/**
* Creates a plain object from a ColorInfo message. Also converts values to other types if specified.
* @function toObject
* @memberof RspMatchRoom.ColorInfo
* @static
* @param {RspMatchRoom.ColorInfo} message ColorInfo
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
ColorInfo.toObject = function toObject() {
return {};
};
/**
* Converts this ColorInfo to JSON.
* @function toJSON
* @memberof RspMatchRoom.ColorInfo
* @instance
* @returns {Object.<string,*>} JSON object
*/
ColorInfo.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for ColorInfo
* @function getTypeUrl
* @memberof RspMatchRoom.ColorInfo
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
ColorInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/RspMatchRoom.ColorInfo";
};
return ColorInfo;
})();
return RspMatchRoom;
})();
$root.NotifyUserEnterRoom = (function() {
/**
* Properties of a NotifyUserEnterRoom.
* @exports INotifyUserEnterRoom
* @interface INotifyUserEnterRoom
* @property {Array.<IGameUser>|null} [User] NotifyUserEnterRoom User
*/
/**
* Constructs a new NotifyUserEnterRoom.
* @exports NotifyUserEnterRoom
* @classdesc Represents a NotifyUserEnterRoom.
* @implements INotifyUserEnterRoom
* @constructor
* @param {INotifyUserEnterRoom=} [properties] Properties to set
*/
function NotifyUserEnterRoom(properties) {
this.User = [];
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]];
}
/**
* NotifyUserEnterRoom User.
* @member {Array.<IGameUser>} User
* @memberof NotifyUserEnterRoom
* @instance
*/
NotifyUserEnterRoom.prototype.User = $util.emptyArray;
/**
* Creates a new NotifyUserEnterRoom instance using the specified properties.
* @function create
* @memberof NotifyUserEnterRoom
* @static
* @param {INotifyUserEnterRoom=} [properties] Properties to set
* @returns {NotifyUserEnterRoom} NotifyUserEnterRoom instance
*/
NotifyUserEnterRoom.create = function create(properties) {
return new NotifyUserEnterRoom(properties);
};
/**
* Encodes the specified NotifyUserEnterRoom message. Does not implicitly {@link NotifyUserEnterRoom.verify|verify} messages.
* @function encode
* @memberof NotifyUserEnterRoom
* @static
* @param {INotifyUserEnterRoom} message NotifyUserEnterRoom message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
NotifyUserEnterRoom.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.User != null && message.User.length)
for (var i = 0; i < message.User.length; ++i)
$root.GameUser.encode(message.User[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
return writer;
};
/**
* Encodes the specified NotifyUserEnterRoom message, length delimited. Does not implicitly {@link NotifyUserEnterRoom.verify|verify} messages.
* @function encodeDelimited
* @memberof NotifyUserEnterRoom
* @static
* @param {INotifyUserEnterRoom} message NotifyUserEnterRoom message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
NotifyUserEnterRoom.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a NotifyUserEnterRoom message from the specified reader or buffer.
* @function decode
* @memberof NotifyUserEnterRoom
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {NotifyUserEnterRoom} NotifyUserEnterRoom
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
NotifyUserEnterRoom.decode = function decode(reader, length, error) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.NotifyUserEnterRoom();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 1: {
if (!(message.User && message.User.length))
message.User = [];
message.User.push($root.GameUser.decode(reader, reader.uint32()));
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a NotifyUserEnterRoom message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof NotifyUserEnterRoom
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {NotifyUserEnterRoom} NotifyUserEnterRoom
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
NotifyUserEnterRoom.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a NotifyUserEnterRoom message.
* @function verify
* @memberof NotifyUserEnterRoom
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
NotifyUserEnterRoom.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.User != null && message.hasOwnProperty("User")) {
if (!Array.isArray(message.User))
return "User: array expected";
for (var i = 0; i < message.User.length; ++i) {
var error = $root.GameUser.verify(message.User[i]);
if (error)
return "User." + error;
}
}
return null;
};
/**
* Creates a NotifyUserEnterRoom message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof NotifyUserEnterRoom
* @static
* @param {Object.<string,*>} object Plain object
* @returns {NotifyUserEnterRoom} NotifyUserEnterRoom
*/
NotifyUserEnterRoom.fromObject = function fromObject(object) {
if (object instanceof $root.NotifyUserEnterRoom)
return object;
var message = new $root.NotifyUserEnterRoom();
if (object.User) {
if (!Array.isArray(object.User))
throw TypeError(".NotifyUserEnterRoom.User: array expected");
message.User = [];
for (var i = 0; i < object.User.length; ++i) {
if (typeof object.User[i] !== "object")
throw TypeError(".NotifyUserEnterRoom.User: object expected");
message.User[i] = $root.GameUser.fromObject(object.User[i]);
}
}
return message;
};
/**
* Creates a plain object from a NotifyUserEnterRoom message. Also converts values to other types if specified.
* @function toObject
* @memberof NotifyUserEnterRoom
* @static
* @param {NotifyUserEnterRoom} message NotifyUserEnterRoom
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
NotifyUserEnterRoom.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.arrays || options.defaults)
object.User = [];
if (message.User && message.User.length) {
object.User = [];
for (var j = 0; j < message.User.length; ++j)
object.User[j] = $root.GameUser.toObject(message.User[j], options);
}
return object;
};
/**
* Converts this NotifyUserEnterRoom to JSON.
* @function toJSON
* @memberof NotifyUserEnterRoom
* @instance
* @returns {Object.<string,*>} JSON object
*/
NotifyUserEnterRoom.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for NotifyUserEnterRoom
* @function getTypeUrl
* @memberof NotifyUserEnterRoom
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
NotifyUserEnterRoom.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/NotifyUserEnterRoom";
};
return NotifyUserEnterRoom;
})();
/**
* ErrCode enum.
* @exports ErrCode
* @enum {number}
* @property {number} OK=0 OK value
* @property {number} SystemErr=1 SystemErr value
* @property {number} ParamErr=2 ParamErr value
* @property {number} LoginDiffLoc=100 LoginDiffLoc value
* @property {number} LoginUserOrPwdErr=102 LoginUserOrPwdErr value
* @property {number} AccountFrozen=103 AccountFrozen value
* @property {number} AccountBanned=104 AccountBanned value
* @property {number} RegisterUserExist=110 RegisterUserExist value
* @property {number} VersionTooLow=115 VersionTooLow value
* @property {number} Maintain=120 Maintain value
* @property {number} GoldNotEnough=125 GoldNotEnough value
* @property {number} NotBetCount=126 NotBetCount value
* @property {number} NotLeaveRoom=127 NotLeaveRoom value
* @property {number} TotalBetExceedsLimit=500 TotalBetExceedsLimit value
* @property {number} AreaBetExceedsLimit=505 AreaBetExceedsLimit value
*/
$root.ErrCode = (function() {
var valuesById = {}, values = Object.create(valuesById);
values[valuesById[0] = "OK"] = 0;
values[valuesById[1] = "SystemErr"] = 1;
values[valuesById[2] = "ParamErr"] = 2;
values[valuesById[100] = "LoginDiffLoc"] = 100;
values[valuesById[102] = "LoginUserOrPwdErr"] = 102;
values[valuesById[103] = "AccountFrozen"] = 103;
values[valuesById[104] = "AccountBanned"] = 104;
values[valuesById[110] = "RegisterUserExist"] = 110;
values[valuesById[115] = "VersionTooLow"] = 115;
values[valuesById[120] = "Maintain"] = 120;
values[valuesById[125] = "GoldNotEnough"] = 125;
values[valuesById[126] = "NotBetCount"] = 126;
values[valuesById[127] = "NotLeaveRoom"] = 127;
values[valuesById[500] = "TotalBetExceedsLimit"] = 500;
values[valuesById[505] = "AreaBetExceedsLimit"] = 505;
return values;
})();
$root.ChatUser = (function() {
/**
* Properties of a ChatUser.
* @exports IChatUser
* @interface IChatUser
* @property {Long|null} [userId] ChatUser userId
* @property {string|null} [nickname] ChatUser nickname
* @property {string|null} [avatar] ChatUser avatar
* @property {string|null} [avatarFrame] ChatUser avatarFrame
* @property {string|null} [vipLevel] ChatUser vipLevel
*/
/**
* Constructs a new ChatUser.
* @exports ChatUser
* @classdesc Represents a ChatUser.
* @implements IChatUser
* @constructor
* @param {IChatUser=} [properties] Properties to set
*/
function ChatUser(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]];
}
/**
* ChatUser userId.
* @member {Long} userId
* @memberof ChatUser
* @instance
*/
ChatUser.prototype.userId = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
/**
* ChatUser nickname.
* @member {string} nickname
* @memberof ChatUser
* @instance
*/
ChatUser.prototype.nickname = "";
/**
* ChatUser avatar.
* @member {string} avatar
* @memberof ChatUser
* @instance
*/
ChatUser.prototype.avatar = "";
/**
* ChatUser avatarFrame.
* @member {string} avatarFrame
* @memberof ChatUser
* @instance
*/
ChatUser.prototype.avatarFrame = "";
/**
* ChatUser vipLevel.
* @member {string} vipLevel
* @memberof ChatUser
* @instance
*/
ChatUser.prototype.vipLevel = "";
/**
* Creates a new ChatUser instance using the specified properties.
* @function create
* @memberof ChatUser
* @static
* @param {IChatUser=} [properties] Properties to set
* @returns {ChatUser} ChatUser instance
*/
ChatUser.create = function create(properties) {
return new ChatUser(properties);
};
/**
* Encodes the specified ChatUser message. Does not implicitly {@link ChatUser.verify|verify} messages.
* @function encode
* @memberof ChatUser
* @static
* @param {IChatUser} message ChatUser message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
ChatUser.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.userId != null && Object.hasOwnProperty.call(message, "userId"))
writer.uint32(/* id 1, wireType 0 =*/8).int64(message.userId);
if (message.nickname != null && Object.hasOwnProperty.call(message, "nickname"))
writer.uint32(/* id 2, wireType 2 =*/18).string(message.nickname);
if (message.avatar != null && Object.hasOwnProperty.call(message, "avatar"))
writer.uint32(/* id 3, wireType 2 =*/26).string(message.avatar);
if (message.avatarFrame != null && Object.hasOwnProperty.call(message, "avatarFrame"))
writer.uint32(/* id 4, wireType 2 =*/34).string(message.avatarFrame);
if (message.vipLevel != null && Object.hasOwnProperty.call(message, "vipLevel"))
writer.uint32(/* id 5, wireType 2 =*/42).string(message.vipLevel);
return writer;
};
/**
* Encodes the specified ChatUser message, length delimited. Does not implicitly {@link ChatUser.verify|verify} messages.
* @function encodeDelimited
* @memberof ChatUser
* @static
* @param {IChatUser} message ChatUser message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
ChatUser.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a ChatUser message from the specified reader or buffer.
* @function decode
* @memberof ChatUser
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {ChatUser} ChatUser
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
ChatUser.decode = function decode(reader, length, error) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.ChatUser();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 1: {
message.userId = reader.int64();
break;
}
case 2: {
message.nickname = reader.string();
break;
}
case 3: {
message.avatar = reader.string();
break;
}
case 4: {
message.avatarFrame = reader.string();
break;
}
case 5: {
message.vipLevel = reader.string();
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a ChatUser message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof ChatUser
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {ChatUser} ChatUser
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
ChatUser.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a ChatUser message.
* @function verify
* @memberof ChatUser
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
ChatUser.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.userId != null && message.hasOwnProperty("userId"))
if (!$util.isInteger(message.userId) && !(message.userId && $util.isInteger(message.userId.low) && $util.isInteger(message.userId.high)))
return "userId: integer|Long expected";
if (message.nickname != null && message.hasOwnProperty("nickname"))
if (!$util.isString(message.nickname))
return "nickname: string expected";
if (message.avatar != null && message.hasOwnProperty("avatar"))
if (!$util.isString(message.avatar))
return "avatar: string expected";
if (message.avatarFrame != null && message.hasOwnProperty("avatarFrame"))
if (!$util.isString(message.avatarFrame))
return "avatarFrame: string expected";
if (message.vipLevel != null && message.hasOwnProperty("vipLevel"))
if (!$util.isString(message.vipLevel))
return "vipLevel: string expected";
return null;
};
/**
* Creates a ChatUser message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof ChatUser
* @static
* @param {Object.<string,*>} object Plain object
* @returns {ChatUser} ChatUser
*/
ChatUser.fromObject = function fromObject(object) {
if (object instanceof $root.ChatUser)
return object;
var message = new $root.ChatUser();
if (object.userId != null)
if ($util.Long)
(message.userId = $util.Long.fromValue(object.userId)).unsigned = false;
else if (typeof object.userId === "string")
message.userId = parseInt(object.userId, 10);
else if (typeof object.userId === "number")
message.userId = object.userId;
else if (typeof object.userId === "object")
message.userId = new $util.LongBits(object.userId.low >>> 0, object.userId.high >>> 0).toNumber();
if (object.nickname != null)
message.nickname = String(object.nickname);
if (object.avatar != null)
message.avatar = String(object.avatar);
if (object.avatarFrame != null)
message.avatarFrame = String(object.avatarFrame);
if (object.vipLevel != null)
message.vipLevel = String(object.vipLevel);
return message;
};
/**
* Creates a plain object from a ChatUser message. Also converts values to other types if specified.
* @function toObject
* @memberof ChatUser
* @static
* @param {ChatUser} message ChatUser
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
ChatUser.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.userId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
} else
object.userId = options.longs === String ? "0" : 0;
object.nickname = "";
object.avatar = "";
object.avatarFrame = "";
object.vipLevel = "";
}
if (message.userId != null && message.hasOwnProperty("userId"))
if (typeof message.userId === "number")
object.userId = options.longs === String ? String(message.userId) : message.userId;
else
object.userId = options.longs === String ? $util.Long.prototype.toString.call(message.userId) : options.longs === Number ? new $util.LongBits(message.userId.low >>> 0, message.userId.high >>> 0).toNumber() : message.userId;
if (message.nickname != null && message.hasOwnProperty("nickname"))
object.nickname = message.nickname;
if (message.avatar != null && message.hasOwnProperty("avatar"))
object.avatar = message.avatar;
if (message.avatarFrame != null && message.hasOwnProperty("avatarFrame"))
object.avatarFrame = message.avatarFrame;
if (message.vipLevel != null && message.hasOwnProperty("vipLevel"))
object.vipLevel = message.vipLevel;
return object;
};
/**
* Converts this ChatUser to JSON.
* @function toJSON
* @memberof ChatUser
* @instance
* @returns {Object.<string,*>} JSON object
*/
ChatUser.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for ChatUser
* @function getTypeUrl
* @memberof ChatUser
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
ChatUser.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/ChatUser";
};
return ChatUser;
})();
$root.GameUser = (function() {
/**
* Properties of a GameUser.
* @exports IGameUser
* @interface IGameUser
* @property {Long|null} [userId] GameUser userId
* @property {string|null} [nickname] GameUser nickname
* @property {string|null} [avatar] GameUser avatar
* @property {string|null} [avatarFrame] GameUser avatarFrame
* @property {number|null} [vipLevel] GameUser vipLevel
* @property {number|null} [vipExp] GameUser vipExp
* @property {Long|null} [seat] GameUser seat
* @property {Long|null} [gold] GameUser gold
*/
/**
* Constructs a new GameUser.
* @exports GameUser
* @classdesc Represents a GameUser.
* @implements IGameUser
* @constructor
* @param {IGameUser=} [properties] Properties to set
*/
function GameUser(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]];
}
/**
* GameUser userId.
* @member {Long} userId
* @memberof GameUser
* @instance
*/
GameUser.prototype.userId = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
/**
* GameUser nickname.
* @member {string} nickname
* @memberof GameUser
* @instance
*/
GameUser.prototype.nickname = "";
/**
* GameUser avatar.
* @member {string} avatar
* @memberof GameUser
* @instance
*/
GameUser.prototype.avatar = "";
/**
* GameUser avatarFrame.
* @member {string} avatarFrame
* @memberof GameUser
* @instance
*/
GameUser.prototype.avatarFrame = "";
/**
* GameUser vipLevel.
* @member {number} vipLevel
* @memberof GameUser
* @instance
*/
GameUser.prototype.vipLevel = 0;
/**
* GameUser vipExp.
* @member {number} vipExp
* @memberof GameUser
* @instance
*/
GameUser.prototype.vipExp = 0;
/**
* GameUser seat.
* @member {Long} seat
* @memberof GameUser
* @instance
*/
GameUser.prototype.seat = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
/**
* GameUser gold.
* @member {Long} gold
* @memberof GameUser
* @instance
*/
GameUser.prototype.gold = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
/**
* Creates a new GameUser instance using the specified properties.
* @function create
* @memberof GameUser
* @static
* @param {IGameUser=} [properties] Properties to set
* @returns {GameUser} GameUser instance
*/
GameUser.create = function create(properties) {
return new GameUser(properties);
};
/**
* Encodes the specified GameUser message. Does not implicitly {@link GameUser.verify|verify} messages.
* @function encode
* @memberof GameUser
* @static
* @param {IGameUser} message GameUser message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
GameUser.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.userId != null && Object.hasOwnProperty.call(message, "userId"))
writer.uint32(/* id 1, wireType 0 =*/8).int64(message.userId);
if (message.nickname != null && Object.hasOwnProperty.call(message, "nickname"))
writer.uint32(/* id 2, wireType 2 =*/18).string(message.nickname);
if (message.avatar != null && Object.hasOwnProperty.call(message, "avatar"))
writer.uint32(/* id 3, wireType 2 =*/26).string(message.avatar);
if (message.avatarFrame != null && Object.hasOwnProperty.call(message, "avatarFrame"))
writer.uint32(/* id 4, wireType 2 =*/34).string(message.avatarFrame);
if (message.vipLevel != null && Object.hasOwnProperty.call(message, "vipLevel"))
writer.uint32(/* id 5, wireType 0 =*/40).int32(message.vipLevel);
if (message.vipExp != null && Object.hasOwnProperty.call(message, "vipExp"))
writer.uint32(/* id 6, wireType 0 =*/48).int32(message.vipExp);
if (message.seat != null && Object.hasOwnProperty.call(message, "seat"))
writer.uint32(/* id 20, wireType 0 =*/160).int64(message.seat);
if (message.gold != null && Object.hasOwnProperty.call(message, "gold"))
writer.uint32(/* id 25, wireType 0 =*/200).int64(message.gold);
return writer;
};
/**
* Encodes the specified GameUser message, length delimited. Does not implicitly {@link GameUser.verify|verify} messages.
* @function encodeDelimited
* @memberof GameUser
* @static
* @param {IGameUser} message GameUser message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
GameUser.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a GameUser message from the specified reader or buffer.
* @function decode
* @memberof GameUser
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {GameUser} GameUser
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
GameUser.decode = function decode(reader, length, error) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.GameUser();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 1: {
message.userId = reader.int64();
break;
}
case 2: {
message.nickname = reader.string();
break;
}
case 3: {
message.avatar = reader.string();
break;
}
case 4: {
message.avatarFrame = reader.string();
break;
}
case 5: {
message.vipLevel = reader.int32();
break;
}
case 6: {
message.vipExp = reader.int32();
break;
}
case 20: {
message.seat = reader.int64();
break;
}
case 25: {
message.gold = reader.int64();
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a GameUser message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof GameUser
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {GameUser} GameUser
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
GameUser.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a GameUser message.
* @function verify
* @memberof GameUser
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
GameUser.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.userId != null && message.hasOwnProperty("userId"))
if (!$util.isInteger(message.userId) && !(message.userId && $util.isInteger(message.userId.low) && $util.isInteger(message.userId.high)))
return "userId: integer|Long expected";
if (message.nickname != null && message.hasOwnProperty("nickname"))
if (!$util.isString(message.nickname))
return "nickname: string expected";
if (message.avatar != null && message.hasOwnProperty("avatar"))
if (!$util.isString(message.avatar))
return "avatar: string expected";
if (message.avatarFrame != null && message.hasOwnProperty("avatarFrame"))
if (!$util.isString(message.avatarFrame))
return "avatarFrame: string expected";
if (message.vipLevel != null && message.hasOwnProperty("vipLevel"))
if (!$util.isInteger(message.vipLevel))
return "vipLevel: integer expected";
if (message.vipExp != null && message.hasOwnProperty("vipExp"))
if (!$util.isInteger(message.vipExp))
return "vipExp: integer expected";
if (message.seat != null && message.hasOwnProperty("seat"))
if (!$util.isInteger(message.seat) && !(message.seat && $util.isInteger(message.seat.low) && $util.isInteger(message.seat.high)))
return "seat: integer|Long expected";
if (message.gold != null && message.hasOwnProperty("gold"))
if (!$util.isInteger(message.gold) && !(message.gold && $util.isInteger(message.gold.low) && $util.isInteger(message.gold.high)))
return "gold: integer|Long expected";
return null;
};
/**
* Creates a GameUser message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof GameUser
* @static
* @param {Object.<string,*>} object Plain object
* @returns {GameUser} GameUser
*/
GameUser.fromObject = function fromObject(object) {
if (object instanceof $root.GameUser)
return object;
var message = new $root.GameUser();
if (object.userId != null)
if ($util.Long)
(message.userId = $util.Long.fromValue(object.userId)).unsigned = false;
else if (typeof object.userId === "string")
message.userId = parseInt(object.userId, 10);
else if (typeof object.userId === "number")
message.userId = object.userId;
else if (typeof object.userId === "object")
message.userId = new $util.LongBits(object.userId.low >>> 0, object.userId.high >>> 0).toNumber();
if (object.nickname != null)
message.nickname = String(object.nickname);
if (object.avatar != null)
message.avatar = String(object.avatar);
if (object.avatarFrame != null)
message.avatarFrame = String(object.avatarFrame);
if (object.vipLevel != null)
message.vipLevel = object.vipLevel | 0;
if (object.vipExp != null)
message.vipExp = object.vipExp | 0;
if (object.seat != null)
if ($util.Long)
(message.seat = $util.Long.fromValue(object.seat)).unsigned = false;
else if (typeof object.seat === "string")
message.seat = parseInt(object.seat, 10);
else if (typeof object.seat === "number")
message.seat = object.seat;
else if (typeof object.seat === "object")
message.seat = new $util.LongBits(object.seat.low >>> 0, object.seat.high >>> 0).toNumber();
if (object.gold != null)
if ($util.Long)
(message.gold = $util.Long.fromValue(object.gold)).unsigned = false;
else if (typeof object.gold === "string")
message.gold = parseInt(object.gold, 10);
else if (typeof object.gold === "number")
message.gold = object.gold;
else if (typeof object.gold === "object")
message.gold = new $util.LongBits(object.gold.low >>> 0, object.gold.high >>> 0).toNumber();
return message;
};
/**
* Creates a plain object from a GameUser message. Also converts values to other types if specified.
* @function toObject
* @memberof GameUser
* @static
* @param {GameUser} message GameUser
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
GameUser.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.userId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
} else
object.userId = options.longs === String ? "0" : 0;
object.nickname = "";
object.avatar = "";
object.avatarFrame = "";
object.vipLevel = 0;
object.vipExp = 0;
if ($util.Long) {
var long = new $util.Long(0, 0, false);
object.seat = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
} else
object.seat = options.longs === String ? "0" : 0;
if ($util.Long) {
var long = new $util.Long(0, 0, false);
object.gold = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
} else
object.gold = options.longs === String ? "0" : 0;
}
if (message.userId != null && message.hasOwnProperty("userId"))
if (typeof message.userId === "number")
object.userId = options.longs === String ? String(message.userId) : message.userId;
else
object.userId = options.longs === String ? $util.Long.prototype.toString.call(message.userId) : options.longs === Number ? new $util.LongBits(message.userId.low >>> 0, message.userId.high >>> 0).toNumber() : message.userId;
if (message.nickname != null && message.hasOwnProperty("nickname"))
object.nickname = message.nickname;
if (message.avatar != null && message.hasOwnProperty("avatar"))
object.avatar = message.avatar;
if (message.avatarFrame != null && message.hasOwnProperty("avatarFrame"))
object.avatarFrame = message.avatarFrame;
if (message.vipLevel != null && message.hasOwnProperty("vipLevel"))
object.vipLevel = message.vipLevel;
if (message.vipExp != null && message.hasOwnProperty("vipExp"))
object.vipExp = message.vipExp;
if (message.seat != null && message.hasOwnProperty("seat"))
if (typeof message.seat === "number")
object.seat = options.longs === String ? String(message.seat) : message.seat;
else
object.seat = options.longs === String ? $util.Long.prototype.toString.call(message.seat) : options.longs === Number ? new $util.LongBits(message.seat.low >>> 0, message.seat.high >>> 0).toNumber() : message.seat;
if (message.gold != null && message.hasOwnProperty("gold"))
if (typeof message.gold === "number")
object.gold = options.longs === String ? String(message.gold) : message.gold;
else
object.gold = options.longs === String ? $util.Long.prototype.toString.call(message.gold) : options.longs === Number ? new $util.LongBits(message.gold.low >>> 0, message.gold.high >>> 0).toNumber() : message.gold;
return object;
};
/**
* Converts this GameUser to JSON.
* @function toJSON
* @memberof GameUser
* @instance
* @returns {Object.<string,*>} JSON object
*/
GameUser.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for GameUser
* @function getTypeUrl
* @memberof GameUser
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
GameUser.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/GameUser";
};
return GameUser;
})();
/**
* ServiceTypeId enum.
* @exports ServiceTypeId
* @enum {number}
* @property {number} STI_Unknown=0 STI_Unknown value
* @property {number} STI_Login=10000 STI_Login value
* @property {number} STI_Chat=10005 STI_Chat value
* @property {number} STI_Match=10010 STI_Match value
* @property {number} STI_Lobby=10015 STI_Lobby value
* @property {number} STI_Admin=10020 STI_Admin value
* @property {number} STI_Gate=20000 STI_Gate value
* @property {number} STI_ColorGame=20005 STI_ColorGame value
* @property {number} STI_DB=30000 STI_DB value
*/
$root.ServiceTypeId = (function() {
var valuesById = {}, values = Object.create(valuesById);
values[valuesById[0] = "STI_Unknown"] = 0;
values[valuesById[10000] = "STI_Login"] = 10000;
values[valuesById[10005] = "STI_Chat"] = 10005;
values[valuesById[10010] = "STI_Match"] = 10010;
values[valuesById[10015] = "STI_Lobby"] = 10015;
values[valuesById[10020] = "STI_Admin"] = 10020;
values[valuesById[20000] = "STI_Gate"] = 20000;
values[valuesById[20005] = "STI_ColorGame"] = 20005;
values[valuesById[30000] = "STI_DB"] = 30000;
return values;
})();
module.exports = $root;