void Load(string path) { SAVEBLOCKDATA data = new SAVEBLOCKDATA(); try { data = JsonConvert.DeserializeObject <SAVEBLOCKDATA>(File.ReadAllText(path)); m_MapLoad.LoadBlock(data); } catch (System.Exception e) { Debug.Log(e); } }
void Save(string path) { try { SAVEBLOCKDATA data = new SAVEBLOCKDATA(); data.blocks = new BLOCK[m_MapLoad.blocks.Length]; data.row = m_MapLoad.GetRowCount(); data.col = m_MapLoad.GetColCount(); for (int i = 0; i < m_MapLoad.blocks.Length; i++) { data.blocks[i] = m_MapLoad.blocks[i].GetComponent <BlockHive>().GetBlockInfo(); } File.WriteAllText(path, JsonConvert.SerializeObject(data)); } catch (System.Exception e) { Debug.Log(e); } }