public void Save() { string data = ""; XmlSerializer serializer = new XmlSerializer(typeof(List <MJumpTube>)); StringWriter textWriter = new StringWriter(); serializer.Serialize(textWriter, jumptubes); data = textWriter.ToString(); GameDataCenter.WriteDataToFile(data, GameDataCenter.GetSpecialAttributeFilePath(DataFileName.JumpTubes)); }
public IEnumerator Load() { WWW www = new WWW(GameDataCenter.GetSpecialAttributeFilePath(DataFileName.JumpTubes)); yield return(www); if (www.error != null) { Debug.LogError("Load " + DataFileName.JumpTubes + " error!!"); } else { TextReader fs = new StringReader(www.text); XmlSerializer serializer = new XmlSerializer(typeof(List <MJumpTube>)); jumptubes = (List <MJumpTube>)serializer.Deserialize(fs); fs.Close(); } }