private static void SaveConfig(SceneInfo sceneInfo, string path) { string content = sceneInfo.ToXMLString(); string name = Path.GetFileNameWithoutExtension(path); path = Application.dataPath + "/ArtAssets/prefabs/configs/map_res/" + name + ".xml"; if (File.Exists(path)) { File.Delete(path); } StreamWriter SW; SW = File.CreateText(path); SW.WriteLine(content); SW.Close(); if (sceneInfo.SaveGridsByBytes) { //存为byte stream path = Application.dataPath + "/ArtAssets/prefabs/configs/map_res/" + name + "_grids" + ".txt"; FileStream fileStream = File.Create(path); fileStream.Write(sceneInfo.GridsBytes, 0, sceneInfo.GridsBytes.Length); fileStream.Close(); } else { // 存为txt path = Application.dataPath + "/ArtAssets/prefabs/configs/map_res/" + name + "_grids" + ".txt"; SW = File.CreateText(path); SW.WriteLine(sceneInfo.GridsContent); SW.Close(); } }