public void SetStopPoint(int x, int y, bool zudang) { if (zudang == true) { foreach (var data in m_mapData.layers) { if (data.x == x && data.y == y) { return;// } } MapLayersData _mapLayersData = new MapLayersData(); _mapLayersData.x = x; _mapLayersData.y = y; _mapLayersData.zudang = 0; m_mapData.layers.Add(_mapLayersData); } else { foreach (var data in m_mapData.layers) { if (data.x == x && data.y == y) { m_mapData.layers.Remove(data); return;// } } } }
void Save() { m_mapData.layers.Clear(); for (int y = 0; y < m_mapData.gezihnum; ++y) { for (int i = 0; i < m_mapData.geziwnum; ++i) { string name = "" + y + "_" + i; Transform _Transform = this.transform.Find("" + y + "_" + i); if (_Transform.gameObject.activeInHierarchy == false) { List <string> list = new List <string>(name.Split('_'));//或 MapLayersData _mapLayersData = new MapLayersData(); _mapLayersData.x = Convert.ToInt32(list[0]); _mapLayersData.y = Convert.ToInt32(list[1]); _mapLayersData.zudang = 0; m_mapData.layers.Add(_mapLayersData); } } } string Path = Application.streamingAssetsPath + "/JsonData/mapaxing.json"; //Application.dataPath + "/Resources/JSON/mapaxing.json";//读取数据, IOHelper.SetData(Path, m_mapData); logMgr.log("A*地图保存完成"); }