public void SaveDeck() { List <ReplayRecordInfo> replayRecords = ReplayUtils.GetContextRecords(); PlayerPrefs.SetString("Replay: " + replayRecords.Count + " Shuffle: " + shuffleNumber, ToString()); print("SAVED" + ("Replay: " + replayRecords.Count + " Shuffle: " + shuffleNumber)); shuffleNumber++; }
public void MatchPanel_ReplayBtn() { List <ReplayRecordInfo> replayRecords = ReplayUtils.GetContextRecords(); if (replayRecords.Count == 0) { replayInfoText.text = "No Replays"; } else { replayInfoText.text = "Replays: " + replayRecords.Count; } foreach (Transform child in this.replayListContent) { Destroy(child.gameObject); } for (int index = 0; index < replayRecords.Count; index++) { ReplayRecordInfo replayRecord = replayRecords[index]; GameObject newReplayBtn = Instantiate(replayPrefabBtn); newReplayBtn.transform.SetParent(this.replayListContent, false); //Display info about the replay newReplayBtn.transform.Find("DateText").GetComponent <Text>().text = replayRecord.creationDate.ToString("yyyy-MM-dd"); newReplayBtn.transform.Find("TimeText").GetComponent <Text>().text = replayRecord.creationDate.ToString("HH:mm"); newReplayBtn.transform.Find("PlayersText").GetComponent <Text>().text = "Players: " + replayRecord.numberOfPlayers; newReplayBtn.GetComponent <ReplayPicker>().replayRecord = replayRecord; RectTransform newReplayBtnRect = newReplayBtn.transform as RectTransform; newReplayBtnRect.localPosition = new Vector3((index % 3) * (newReplayBtnRect.sizeDelta.x + 10), -((index / 3) * (newReplayBtnRect.sizeDelta.y + 10)), 0); } this.replayListContent.sizeDelta = new Vector2(this.replayListContent.sizeDelta.x, ((replayRecords.Count - 1) / 3 + 1) * (replayPrefabBtn.GetComponent <RectTransform>().sizeDelta.y + 10)); ActivePanel(PanelType.Replay); }