/// <summary> /// Fill the Response object with data from the server /// </summary> /// <param name="dataStream">The input stream</param> public static NetworkResponse Parse(MemoryStream dataStream) { ResponseClashSpeciesList response = new ResponseClashSpeciesList(); int count = DataReader.ReadInt(dataStream); // Debug.Log("received " + count + " species"); for(int i = 0; i < count; i++) { ClashSpecies s = new ClashSpecies(); s.id = DataReader.ReadInt(dataStream); s.name = DataReader.ReadString(dataStream); s.cost = DataReader.ReadInt(dataStream); s.type = (SpeciesType)DataReader.ReadInt(dataStream); s.description = DataReader.ReadString(dataStream); s.attack = DataReader.ReadInt(dataStream); s.hp = DataReader.ReadInt(dataStream); s.moveSpeed = DataReader.ReadInt(dataStream); s.attackSpeed = DataReader.ReadInt(dataStream); response.speciesList.Add(s); } return response; }
/// <summary> /// Fill the Response object with data from the server /// </summary> /// <param name="dataStream">The input stream</param> public static NetworkResponse Parse(MemoryStream dataStream) { ResponseClashSpeciesList response = new ResponseClashSpeciesList(); int count = DataReader.ReadInt(dataStream); // Debug.Log("received " + count + " species"); for (int i = 0; i < count; i++) { ClashSpecies s = new ClashSpecies(); s.id = DataReader.ReadInt(dataStream); s.name = DataReader.ReadString(dataStream); s.cost = DataReader.ReadInt(dataStream); s.type = (SpeciesType)DataReader.ReadInt(dataStream); s.description = DataReader.ReadString(dataStream); s.attack = DataReader.ReadInt(dataStream); s.hp = DataReader.ReadInt(dataStream); s.moveSpeed = DataReader.ReadInt(dataStream); s.attackSpeed = DataReader.ReadInt(dataStream); response.speciesList.Add(s); } return(response); }