private void LoadReplays()
    {
        var filePaths = ReplayIO.GetReplayFilepaths();

        // generate each button for each replay
        foreach (var filePath in filePaths)
        {
            var fileName  = Path.GetFileNameWithoutExtension(filePath);
            var newButton = GameObject.Instantiate(ButtonPrefab);
            newButton.transform.SetParent(ScrollViewContent.transform);
            newButton.transform.localScale = new Vector3(1, 1, 1);
            newButton.GetComponent <ReplayItemButtonScript>().SetText(fileName);
            newButton.GetComponent <Button>().onClick.AddListener(delegate { OpenReplay(filePath); });
        }
    }
 private void OpenReplay(string filePath)
 {
     GlobalState.Instance.ReplayToLoad = ReplayIO.LoadReplayFromFilepath(filePath);
     StateController.SwitchToReplayScene();
 }
示例#3
0
 public void SaveReplay()
 {
     SavedImage.SetActive(true);
     SaveButton.interactable = false;
     ReplayIO.SaveReplayWithTimeAsFilename(GlobalState.Instance.ReplayToSave);
 }