///<summary>反序列化,读取数据</summary> public override int Read(byte[] _buffer_, int _offset_) { _offset_ = base.Read(_buffer_, _offset_); //字段个数,最多支持255个 var _fieldNum_ = XBuffer.ReadByte(_buffer_, ref _offset_); do { if (_fieldNum_ > 0) { result = XBuffer.ReadInt(_buffer_, ref _offset_); } else { break; } if (_fieldNum_ > 1) { reason = XBuffer.ReadInt(_buffer_, ref _offset_); } else { break; } if (_fieldNum_ > 2) { hasRole = XBuffer.ReadBool(_buffer_, ref _offset_); if (hasRole) { var _idx_ = XBuffer.ReadByte(_buffer_, ref _offset_); role = new RoleInfo(); _offset_ = role.Read(_buffer_, _offset_); } } else { break; } if (_fieldNum_ > 3) { userName = XBuffer.ReadString(_buffer_, ref _offset_); } else { break; } if (_fieldNum_ > 4) { isNewCreate = XBuffer.ReadBool(_buffer_, ref _offset_); } else { break; } }while(false); return(_offset_); }
public void LoadData(byte[] data, ref int offset) { t_id = XBuffer.ReadInt(data, ref offset); m_t_mult = XBuffer.ReadInt(data, ref offset); t_str = XBuffer.ReadString(data, ref offset); t_str2 = XBuffer.ReadString(data, ref offset); t_int = XBuffer.ReadInt(data, ref offset); t_int2 = XBuffer.ReadInt(data, ref offset); t_long = XBuffer.ReadLong(data, ref offset); }
///<summary>反序列化,读取数据</summary> public override int Read(byte[] _buffer_, int _offset_) { _offset_ = base.Read(_buffer_, _offset_); int _startOffset_ = _offset_; int _toReadLength_ = XBuffer.ReadInt(_buffer_, ref _offset_); //字段个数,最多支持255个 var _fieldNum_ = XBuffer.ReadByte(_buffer_, ref _offset_); do { if (_fieldNum_ > 0) { l1 = XBuffer.ReadLong(_buffer_, ref _offset_); } else { break; } if (_fieldNum_ > 1) { short _count_ = XBuffer.ReadShort(_buffer_, ref _offset_); for (int _a_ = 0; _a_ < _count_; ++_a_) { l2.Add(XBuffer.ReadString(_buffer_, ref _offset_)); } } else { break; } if (_fieldNum_ > 2) { short _count_ = XBuffer.ReadShort(_buffer_, ref _offset_); for (int _a_ = 0; _a_ < _count_; ++_a_) { l3.Add(XBuffer.ReadFloat(_buffer_, ref _offset_)); } } else { break; } if (_fieldNum_ > 3) { short _count_ = XBuffer.ReadShort(_buffer_, ref _offset_); for (int _a_ = 0; _a_ < _count_; ++_a_) { var _idx_ = XBuffer.ReadByte(_buffer_, ref _offset_); if (_idx_ <= 0) { l4.Add(default);
public void LoadData(byte[] data, ref int offset) { string useField = "t_" + Settings.Ins.Language; t_id = XBuffer.ReadInt(data, ref offset); if (string.IsNullOrEmpty(t_content) && useField == "t_chinese") { t_content = XBuffer.ReadString(data, ref offset); } else { //不需要的语言字段跳过 short slen = XBuffer.ReadShort(data, ref offset); offset += slen; } if (string.IsNullOrEmpty(t_content) && useField == "t_chinesetraditional") { t_content = XBuffer.ReadString(data, ref offset); } else { //不需要的语言字段跳过 short slen = XBuffer.ReadShort(data, ref offset); offset += slen; } if (string.IsNullOrEmpty(t_content) && useField == "t_english") { t_content = XBuffer.ReadString(data, ref offset); } else { //不需要的语言字段跳过 short slen = XBuffer.ReadShort(data, ref offset); offset += slen; } }
///<summary>反序列化,读取数据</summary> public override int Read(byte[] _buffer_, int _offset_) { _offset_ = base.Read(_buffer_, _offset_); //字段个数,最多支持255个 var _fieldNum_ = XBuffer.ReadByte(_buffer_, ref _offset_); do { if (_fieldNum_ > 0) { msg = XBuffer.ReadString(_buffer_, ref _offset_); } else { break; } if (_fieldNum_ > 1) { msgLanId = XBuffer.ReadInt(_buffer_, ref _offset_); } else { break; } if (_fieldNum_ > 2) { type = XBuffer.ReadShort(_buffer_, ref _offset_); } else { break; } }while(false); return(_offset_); }
///<summary>反序列化,读取数据</summary> public override int Read(byte[] _buffer_, int _offset_) { _offset_ = base.Read(_buffer_, _offset_); int _startOffset_ = _offset_; int _toReadLength_ = XBuffer.ReadInt(_buffer_, ref _offset_); //字段个数,最多支持255个 var _fieldNum_ = XBuffer.ReadByte(_buffer_, ref _offset_); do { if (_fieldNum_ > 0) { id_f = XBuffer.ReadLong(_buffer_, ref _offset_); } else { break; } if (_fieldNum_ > 1) { s1 = XBuffer.ReadString(_buffer_, ref _offset_); } else { break; } if (_fieldNum_ > 2) { i1 = XBuffer.ReadInt(_buffer_, ref _offset_); } else { break; } if (_fieldNum_ > 3) { b1 = XBuffer.ReadBool(_buffer_, ref _offset_); } else { break; } if (_fieldNum_ > 4) { f1 = XBuffer.ReadFloat(_buffer_, ref _offset_); } else { break; } if (_fieldNum_ > 5) { s2 = XBuffer.ReadShort(_buffer_, ref _offset_); } else { break; } if (_fieldNum_ > 6) { d1 = XBuffer.ReadDouble(_buffer_, ref _offset_); } else { break; } if (_fieldNum_ > 7) { b2 = XBuffer.ReadBytes(_buffer_, ref _offset_); } else { break; } if (_fieldNum_ > 8) { o1 = XBuffer.ReadString(_buffer_, ref _offset_); } else { break; } }while(false); //剔除多余数据 if (_offset_ < _toReadLength_ - _startOffset_) { _offset_ += _toReadLength_ - _startOffset_; } return(_offset_); }
///<summary>反序列化,读取数据</summary> public override int Read(byte[] _buffer_, int _offset_) { _offset_ = base.Read(_buffer_, _offset_); //字段个数,最多支持255个 var _fieldNum_ = XBuffer.ReadByte(_buffer_, ref _offset_); do { if (_fieldNum_ > 0) { userName = XBuffer.ReadString(_buffer_, ref _offset_); } else { break; } if (_fieldNum_ > 1) { serverId = XBuffer.ReadInt(_buffer_, ref _offset_); } else { break; } if (_fieldNum_ > 2) { sdkToken = XBuffer.ReadString(_buffer_, ref _offset_); } else { break; } if (_fieldNum_ > 3) { sdkType = XBuffer.ReadInt(_buffer_, ref _offset_); } else { break; } if (_fieldNum_ > 4) { channelId = XBuffer.ReadString(_buffer_, ref _offset_); } else { break; } if (_fieldNum_ > 5) { isRelogin = XBuffer.ReadBool(_buffer_, ref _offset_); } else { break; } if (_fieldNum_ > 6) { handToken = XBuffer.ReadLong(_buffer_, ref _offset_); } else { break; } if (_fieldNum_ > 7) { deviceType = XBuffer.ReadInt(_buffer_, ref _offset_); } else { break; } if (_fieldNum_ > 8) { deviceOS = XBuffer.ReadString(_buffer_, ref _offset_); } else { break; } if (_fieldNum_ > 9) { deviceModel = XBuffer.ReadString(_buffer_, ref _offset_); } else { break; } if (_fieldNum_ > 10) { deviceName = XBuffer.ReadString(_buffer_, ref _offset_); } else { break; } if (_fieldNum_ > 11) { deviceId = XBuffer.ReadString(_buffer_, ref _offset_); } else { break; } }while(false); return(_offset_); }
///<summary>反序列化,读取数据</summary> public override int Read(byte[] _buffer_, int _offset_) { _offset_ = base.Read(_buffer_, _offset_); int _startOffset_ = _offset_; int _toReadLength_ = XBuffer.ReadInt(_buffer_, ref _offset_); //字段个数,最多支持255个 var _fieldNum_ = XBuffer.ReadByte(_buffer_, ref _offset_); do { if (_fieldNum_ > 0) { roleId = XBuffer.ReadLong(_buffer_, ref _offset_); } else { break; } if (_fieldNum_ > 1) { roleName = XBuffer.ReadString(_buffer_, ref _offset_); } else { break; } if (_fieldNum_ > 2) { level = XBuffer.ReadInt(_buffer_, ref _offset_); } else { break; } if (_fieldNum_ > 3) { vipLevel = XBuffer.ReadInt(_buffer_, ref _offset_); } else { break; } if (_fieldNum_ > 4) { fightPower = XBuffer.ReadLong(_buffer_, ref _offset_); } else { break; } if (_fieldNum_ > 5) { guildId = XBuffer.ReadLong(_buffer_, ref _offset_); } else { break; } if (_fieldNum_ > 6) { guildName = XBuffer.ReadString(_buffer_, ref _offset_); } else { break; } if (_fieldNum_ > 7) { openServerDays = XBuffer.ReadInt(_buffer_, ref _offset_); } else { break; } if (_fieldNum_ > 8) { serverLevel = XBuffer.ReadInt(_buffer_, ref _offset_); } else { break; } if (_fieldNum_ > 9) { loginTick = XBuffer.ReadLong(_buffer_, ref _offset_); } else { break; } if (_fieldNum_ > 10) { createTick = XBuffer.ReadLong(_buffer_, ref _offset_); } else { break; } if (_fieldNum_ > 11) { isGMRole = XBuffer.ReadBool(_buffer_, ref _offset_); } else { break; } }while(false); //剔除多余数据 if (_offset_ < _toReadLength_ - _startOffset_) { _offset_ += _toReadLength_ - _startOffset_; } return(_offset_); }