public void LoadSaveButton() { if (SaveController.saves != null && SaveController.saves.Count != 0) { for (int i = SaveController.saves.Count - 1; i > -1; i--) { OneSavePanel panel = Instantiate(oneSavePanelPrefab); panel.SetInfo(SaveController.saves[i].SaveName, SaveController.saves[i].Date, SaveController.saves[i].LevelID, SaveController.saves[i].TexturePath, i); panel.GetComponent <Button>().onClick.AddListener(() => { panel.onClick(); }); panel.transform.SetParent(LoadSavePanel.transform); } } GameOverPanel.SetActive(false); LoadSavePanel.SetActive(true); }
void LoadSavesOnPanel() { //Debug.Log(SaveController.saves.Count); ClearSaveP(); if (SaveController.saves != null && SaveController.saves.Count != 0) { for (int i = SaveController.saves.Count - 1; i > -1; i--) { OneSavePanel panel = Instantiate(oneSavePanelPrefab); panel.SetInfo(SaveController.saves[i].SaveName, SaveController.saves[i].Date, SaveController.saves[i].LevelID, SaveController.saves[i].TexturePath, i); panel.GetComponent <Button>().onClick.AddListener(() => { panel.onClick(); }); panel.transform.SetParent(SavePanel.transform); } } else if (SaveController.saves == null || SaveController.saves.Count == 0) { LoadButton.SetActive(false); } }