public static void SaveSalePersonInfo(List <SalePersonInfo> newinfo) { SalePersonCfgNormal newCfg = new SalePersonCfgNormal(); newCfg.SalePerson = newinfo; string info = JsonUtility.ToJson(newCfg); string persistPath = Application.persistentDataPath + "/Config/SalePersonCfg.txt"; Utility.CreateDir(persistPath); File.WriteAllText(persistPath, info); LoadStoreInfo(); }
private static void LoadSalePersonInfo() { string persistPath = Application.persistentDataPath + "/Config/SalePersonCfg.txt"; if (File.Exists(persistPath)) { string info = File.ReadAllText(persistPath); SalePersonCfgNormal storeCfgNormal = JsonUtility.FromJson <SalePersonCfgNormal>(info); foreach (var s in storeCfgNormal.SalePerson) { SalePersonList.Add(s); } } else { SalePersonCfg salePersonCfg = Resources.Load <SalePersonCfg>("Configs/SalePersonCfg"); foreach (var s in salePersonCfg.SalePerson) { SalePersonList.Add(s); } } }