public void SaveGame() { if (HexagonalGrid.Instance == null) { return; } needLoad = true; HexagonalCell[] cells = HexagonalGrid.Instance.GetAllCells(); int lenght = cells.Length; SaveInfo.Cards = new Cards.CardData[lenght]; for (int i = 0; i < lenght; i++) { SaveInfo.Cards[i] = cells[i].GetCard().Info; } HudUI score = FindObjectOfType <HudUI>(); SaveInfo.Score = score.GetScore(); SaveInfo.Turn = score.GetTurn(); SaveInfo.untilClosed = ManagerClosedCard.Instance.currentProgress; string obj = JsonUtility.ToJson(SaveInfo); PlayerPrefs.SetString("load", obj); }
public void AddNewTurnInfo() { LoadData newTurn = new LoadData(); HexagonalCell[] cells = HexagonalGrid.Instance.GetAllCells(); int lenght = cells.Length; newTurn.Cards = new CardData[lenght]; for (int i = 0; i < lenght; i++) { CardData newCard = new CardData(); newCard.myNumCard = cells[i].GetCard().Info.myNumCard; newCard.myColor = cells[i].GetCard().Info.myColor; newCard.mySpecialCard = cells[i].GetCard().Info.mySpecialCard; newCard.isClosed = cells[i].GetCard().Info.isClosed; newTurn.Cards[i] = newCard; } CardData _acticCardCard = new CardData(); _acticCardCard.myNumCard = activCard.myCard.Info.myNumCard; _acticCardCard.myColor = activCard.myCard.Info.myColor; _acticCardCard.mySpecialCard = activCard.myCard.Info.mySpecialCard; newTurn.ActicCard = _acticCardCard; newTurn.Score = score.GetScore(); newTurn.Turn = score.GetTurn(); newTurn.untilClosed = ManagerClosedCard.Instance.currentProgress; // newTurn.BonusSlot1 = BonusSlot1.GetMyCard().Info; // newTurn.BonusSlot2 = BonusSlot2.GetMyCard().Info; SaveInfo.Add(newTurn); }