private GameObject CreatePopup(string wordId, EPopupType popupType) { GameObject popup = Instantiate(PrefabMgr.Instance.Popup); popup.GetComponentInChildren <LocalizeMe>().SetNewWordIdAndLocalize(wordId, true, "."); Image image = popup.GetComponentInChildren <Image>(); switch (popupType) { case EPopupType.Information: image.color = Color.white; break; case EPopupType.Warning: image.color = Color.yellow; break; case EPopupType.Error: image.color = Color.red; break; default: throw new CaseStatementMissingException(popupType); } return(popup); }
public void CreateAndShowPopup(string wordId, EPopupType popupType = default) { GameObject popup = CreatePopup(wordId, popupType); while (Popups.Count >= MaxPopups) { RemovePopup(Popups[0]); } Popups.Add(popup); // Reposition the popups (because they need to be above/below each other. if (Popups.Count > 1) { SetPopupsPosY(); } }