public void Read(ref JInputStream stream) { RolesInfo = new List <JObjRoleInfo>(); Result = JBinaryReaderWriter.Read <bool> (stream); int count = JBinaryReaderWriter.Read <int> (stream); for (int i = 0; i < count; i++) { RolesInfo.Add(JBinaryReaderWriter.Read <JObjRoleInfo> (stream)); } }
public void Read(ref JInputStream stream) { roleName = JBinaryReaderWriter.Read <string> (stream); roleType = JBinaryReaderWriter.Read <int> (stream); roleLevel = JBinaryReaderWriter.Read <int> (stream); x = JBinaryReaderWriter.Read <double> (stream); y = JBinaryReaderWriter.Read <double> (stream); z = JBinaryReaderWriter.Read <double> (stream); rotatex = JBinaryReaderWriter.Read <double> (stream); rotatey = JBinaryReaderWriter.Read <double> (stream); rotatez = JBinaryReaderWriter.Read <double> (stream); }
/// <summary> /// Read the specified data,start at start_index. /// </summary> /// <param name="data">data to read</param> /// <param name="start_index">Start index of data to read</param> /// <returns> offset of data</returns> public static T Read <T> (JInputStream jstream) { if (typeof(T) == typeof(string)) { ushort len = (ushort)jstream.Reader.ReadInt16(); return((T)Convert.ChangeType(Encoding.UTF8.GetString(jstream.Reader.ReadBytes(len)), typeof(T))); } if (typeof(T).IsValueType) { if (typeof(T) == typeof(short)) { short result = (short)jstream.Reader.ReadInt16(); return((T)Convert.ChangeType(result, typeof(T))); } else if (typeof(T) == typeof(ushort)) { ushort result = (ushort)jstream.Reader.ReadUInt16(); return((T)Convert.ChangeType(result, typeof(T))); } else if (typeof(T) == typeof(int)) { int result = (int)jstream.Reader.ReadInt32(); return((T)Convert.ChangeType(result, typeof(T))); } else if (typeof(T) == typeof(uint)) { uint result = (uint)jstream.Reader.ReadUInt32(); return((T)Convert.ChangeType(result, typeof(T))); } else if (typeof(T) == typeof(long)) { long result = (long)jstream.Reader.ReadInt64(); return((T)Convert.ChangeType(result, typeof(T))); } else if (typeof(T) == typeof(ulong)) { ulong result = (ulong)jstream.Reader.ReadUInt64(); return((T)Convert.ChangeType(result, typeof(T))); } else if (typeof(T) == typeof(float)) { float result = (float)jstream.Reader.ReadSingle(); return((T)Convert.ChangeType(result, typeof(T))); } else if (typeof(T) == typeof(double)) { double result = (double)jstream.Reader.ReadDouble(); return((T)Convert.ChangeType(result, typeof(T))); } else if (typeof(T) == typeof(decimal)) { decimal result = (decimal)jstream.Reader.ReadDecimal(); return((T)Convert.ChangeType(result, typeof(T))); } else if (typeof(T) == typeof(bool)) { bool result = (bool)jstream.Reader.ReadBoolean(); return((T)Convert.ChangeType(result, typeof(T))); } else if (typeof(T) == typeof(byte)) { byte result = (byte)jstream.Reader.ReadByte(); return((T)Convert.ChangeType(result, typeof(T))); } else if (typeof(T) == typeof(sbyte)) { sbyte result = (sbyte)jstream.Reader.ReadSByte(); return((T)Convert.ChangeType(result, typeof(T))); } else if (typeof(T) == typeof(char)) { char result = (char)jstream.Reader.ReadChar(); return((T)Convert.ChangeType(result, typeof(T))); } //else if (typeof(T).IsEnum) {} } else if (typeof(T).IsInterface || typeof(T).IsClass) { ushort objType = (ushort)jstream.Reader.ReadUInt16(); IStreamObj obj = JGameUtil.InvokeStreamObject(objType); obj.Read(ref jstream); return((T)obj); } JLog.Error("JBinaryReaderWriter.Read:not support type" + typeof(T).ToString()); return(default(T)); }
public void Read(ref JInputStream stream) { Result = JBinaryReaderWriter.Read <bool> (stream); }
public void Read(ref JInputStream stream) { _strAccount = JBinaryReaderWriter.Read <string> (stream); _strCode = JBinaryReaderWriter.Read <string> (stream); }
public void Read(ref JInputStream stream) { Info.Account = JBinaryReaderWriter.Read <string> (stream); }
/// <summary> /// Read the specified data. /// </summary> /// <param name="data">input data</param> public void Read(ref JInputStream stream) { Result = (CreateRoleResultType)JBinaryReaderWriter.Read <ushort> (stream); UserId = JBinaryReaderWriter.Read <string> (stream); }
/// <summary> /// Read the specified data. /// </summary> /// <param name="data">input data</param> public void Read(ref JInputStream stream) { RoleName = JBinaryReaderWriter.Read <string> (stream); RoleType = JBinaryReaderWriter.Read <Int16> (stream); }
public void Read(ref JInputStream stream) { Result = (AccountRegisterResultType)JBinaryReaderWriter.Read <ushort> (stream); }