public void Pick() { replayToLoad = replayRecord; ReplayRecord.replayMode = ReplayMode.LOAD_REPLAY; Menu.instance.ReplayPanel_LoadLevel(); }
/** * @brief Returns a sorted by date list of {@link ReplayRecordInfo} of the saved replay found. **/ public static List <ReplayRecordInfo> GetContextRecords() { List <ReplayRecordInfo> result = new List <ReplayRecordInfo>(); #if !UNITY_WEBPLAYER foreach (FileInfo fileInfo in CheckReplayFolder().GetFiles("*.tsr")) { ReplayRecordInfo replay = new ReplayRecordInfo(fileInfo); if (replay != null) { result.Add(replay); } } result.Sort(); #endif return(result); }
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); }
public void Pick() { replayToLoad = replayRecord; ReplayRecord.replayMode = ReplayMode.LOAD_REPLAY; }