IEnumerator FoodClear() { List <Foodd> TempList = new List <Foodd>(); for (int i = 0; i < 12; i++) { //recovery = InventoryManager.Instance.FData.FoodList[i].Recovery; //name = InventoryManager.Instance.FData.FoodList[i].Name; //count = InventoryManager.Instance.FData.FoodList[i].Count; fd = new Foodd(0, 0); TempList.Add(fd); } JsonData FoodJson = JsonMapper.ToJson(TempList); //File.WriteAllText(Application.persistentDataPath + "/FoodData.json", FoodJson.ToString()); if (EndingEvent.Instance.path == Application.persistentDataPath) { File.WriteAllText(Application.persistentDataPath + "/FoodData.json", FoodJson.ToString()); } else { File.WriteAllText(EndingEvent.Instance.path + "/Resources/FoodData.json", FoodJson.ToString()); } yield return(null); }
private void ParsingFood(JsonData Data) { Foodd fd; for (int i = 0; i < Data.Count; i++) { //text = Data[i]["Text"].ToString(); //Debug.Log(Data[i]["Text"]); //name = Data[i]["Name"].ToString(); //Debug.Log(Data[i]["Name"]); //count = int.Parse(Data[i]["Count"].ToString()); fd = new Foodd(int.Parse(Data[i]["Recovery"].ToString()), int.Parse(Data[i]["Count"].ToString())); FoodList.Add(fd); } }