private void LoadGameMenu_LoadGameMenuInvoked(object sender, SavesEventArgs e) { if (e.IfSavesNeedsToBeReloaded) { foreach (Button saveButtons in this.saveButtons) { Destroy(saveButtons.gameObject); } if (e.IsHaveSaves) { foreach (SaveMember saveMember in e.SaveMembers) { Button saveMemberButtonClone = Instantiate(this.loadButtonPrefab, loadButtonList.transform).GetComponent <Button>(); this.saveButtons.Add(saveMemberButtonClone); this.saveButtons[this.saveButtons.Count - 1].gameObject.SetActive(true); this.saveButtons[this.saveButtons.Count - 1].GetComponentInChildren <Text>().text = saveMember.SavePath; this.saveButtons[this.saveButtons.Count - 1].onClick.AddListener(() => this.OnButtonClick(saveMember.SavePath)); } } } }
protected void OnLoadGameMenuInvoked(SavesEventArgs e) { this.LoadGameMenuInvoked?.Invoke(this, e); }