protected static int ParseMapS2I(GameDataParser parser, byte[] bytes, int offset, GameDataBase gameDataObj, string fieldName) { BitConverterUtility.ConvertEndianFrom(bytes, true, offset, 4); var count = BitConverter.ToInt32(bytes, offset); offset += 4; Dictionary <string, int> values = new Dictionary <string, int>(count); for (int i = 0; i < count; i++) { BitConverterUtility.ConvertEndianFrom(bytes, true, offset, 4); var key = BitConverter.ToInt32(bytes, offset); offset += 4; BitConverterUtility.ConvertEndianFrom(bytes, true, offset, 4); var value = BitConverter.ToInt32(bytes, offset); offset += 4; values.Add(parser.m_StringBuffList[key], value); } gameDataObj.SetDictionaryS2I(fieldName, values); return(offset); }
protected static int ParseListFloat2(GameDataParser parser, byte[] bytes, int offset, GameDataBase gameDataObj, string fieldName) { BitConverterUtility.ConvertEndianFrom(bytes, true, offset, 4); var arrayCount = BitConverter.ToInt32(bytes, offset); offset += 4; List <List <float> > array = new List <List <float> >(arrayCount); for (int i = 0; i < arrayCount; i++) { BitConverterUtility.ConvertEndianFrom(bytes, true, offset, 4); var count = BitConverter.ToInt32(bytes, offset); offset += 4; List <float> values = new List <float>(count); for (int j = 0; j < count; j++) { BitConverterUtility.ConvertEndianFrom(bytes, true, offset, 4); var value = BitConverter.ToSingle(bytes, offset); offset += 4; values.Add(value); } array.Add(values); } gameDataObj.SetListFloat2(fieldName, array); return(offset); }
protected static int ParseString(GameDataParser parser, byte[] bytes, int offset, GameDataBase gameDataObj, string fieldName) { BitConverterUtility.ConvertEndianFrom(bytes, true, offset, 4); var value = BitConverter.ToInt32(bytes, offset); offset += 4; gameDataObj.SetString(fieldName, parser.m_StringBuffList[value]); return(offset); }
protected static int ParseFloat(GameDataParser parser, byte[] bytes, int offset, GameDataBase gameDataObj, string fieldName) { BitConverterUtility.ConvertEndianFrom(bytes, true, offset, 4); var value = BitConverter.ToSingle(bytes, offset); offset += 4; gameDataObj.SetFloat(fieldName, value); return(offset); }
protected static int ParseLong(GameDataParser parser, byte[] bytes, int offset, GameDataBase gameDataObj, string fieldName) { BitConverterUtility.ConvertEndianFrom(bytes, true, offset, 8); var value = BitConverter.ToInt64(bytes, offset); offset += 8; gameDataObj.SetLong(fieldName, value); return(offset); }
protected static int ParseHashSetString(GameDataParser parser, byte[] bytes, int offset, GameDataBase gameDataObj, string fieldName) { BitConverterUtility.ConvertEndianFrom(bytes, true, offset, 4); var count = BitConverter.ToInt32(bytes, offset); offset += 4; HashSet <string> values = new HashSet <string>(); for (int i = 0; i < count; i++) { BitConverterUtility.ConvertEndianFrom(bytes, true, offset, 4); var value = BitConverter.ToInt32(bytes, offset); offset += 4; values.Add(parser.m_StringBuffList[value]); } gameDataObj.SetHashSetString(fieldName, values); return(offset); }
protected static int ParseListInt(GameDataParser parser, byte[] bytes, int offset, GameDataBase gameDataObj, string fieldName) { BitConverterUtility.ConvertEndianFrom(bytes, true, offset, 4); var count = BitConverter.ToInt32(bytes, offset); offset += 4; List <int> values = new List <int>(count); for (int i = 0; i < count; i++) { BitConverterUtility.ConvertEndianFrom(bytes, true, offset, 4); var value = BitConverter.ToInt32(bytes, offset); offset += 4; values.Add(value); } gameDataObj.SetListInt(fieldName, values); return(offset); }