void LoadState() { PanelDataCollection pd = null; pd = pd.FromJson(fileName); if (pd == null) { Debug.Log("not loaded"); } pd.BuildDictionary(); var panels = GetPanels(); foreach (var p in panels) { var pp = pd.GetData(p.id); if (pp != null) { p.SetData(pp); } else { Debug.Log("could not find panel data " + p.id); } //pd.data.Add(p.GetData()); } }
void SaveState() { PanelDataCollection pd = new PanelDataCollection(); var panels = GetPanels(); foreach (var p in panels) { pd.panelData.Add(p.GetData()); } pd.ToJson(fileName); Debug.Log("found " + panels.Count + "p anels"); }