public void CreatePopupChoice(string message, string buttonLabel1, Action onButton1, Color?c = null, string buttonLabel2 = null, Action onButton2 = null) { cleanUp(); ToWriteTo.text = message; MainBlocker.SetActive(true); Root.SetActive(true); if (c.HasValue) { ToWriteTo.color = c.Value; } else { ToWriteTo.color = originalTextColor; } StopAllCoroutines(); PopImage.gameObject.SetActive(false); if (buttonLabel1 != null && onButton1 != null) { currentB1Action = onButton1; Choice1.gameObject.SetActive(true); Choice1.onClick.AddListener(delegate { cleanUp(); currentB1Action(); }); Choice1.GetComponentInChildren <Text>().text = buttonLabel1; } if (buttonLabel2 != null && onButton2 != null) { currentB2Action = onButton2; Choice2.gameObject.SetActive(true); Choice2.onClick.AddListener(delegate { cleanUp(); currentB2Action(); }); Choice2.GetComponentInChildren <Text>().text = buttonLabel2; } }
void SetText() { MainText.text = CurrentDialogue.DialogueText; if (CurrentDialogue.Choice1 == null) { Choice1.GetComponentInChildren <Text> ().text = ""; Choice1.GetComponent <Button> ().interactable = false; } else { Choice1.GetComponentInChildren <Text> ().text = CurrentDialogue.Choice1; } if (CurrentDialogue.Choice2 == null) { Choice2.GetComponent <Button> ().interactable = false; Choice2.GetComponentInChildren <Text> ().text = ""; } else { Choice2.GetComponentInChildren <Text> ().text = CurrentDialogue.Choice2; } }