private GameObject GetPopupPrefab(PopupTypes type)
        {
            GameObject popup = null;

            if (popupPrefabs != null && popupPrefabs.Length >= (int)type)
            {
                popup = popupPrefabs[(int)type];
            }
            return(popup);
        }
Exemple #2
0
    public static void ShowPopup(PopupTypes PopupType, string Title, string Description, string Yes, System.Action YesAction, string No = "", System.Action NoAction = null, string Cancel = "", System.Action CancelAction = null)
    {
        Popup NewPopup = new Popup();

        NewPopup.PopupType   = PopupType;
        NewPopup.Title       = Title;
        NewPopup.Description = Description;
        NewPopup.Yes         = Yes;
        NewPopup.No          = No;
        NewPopup.Cancel      = Cancel;

        NewPopup.YesAction    = YesAction;
        NewPopup.NoAction     = NoAction;
        NewPopup.CancelAction = CancelAction;

        PopupBufor.Add(NewPopup);
        Current.StartPopup();
    }
        public PopupBase OpenPopup(PopupTypes type, params System.Object[] lists)
        {
            GameObject popupPrefab = GetPopupPrefab(type);
            PopupBase  popup       = null;

            if (popupPrefab != null)
            {
                GameObject popupObject = Instantiate(popupPrefab, Vector3.zero, Quaternion.identity);
                popupObject.SetActive(true);
                popupObject.transform.SetParent(parentCanvas);

                RectTransform rt = popupObject.GetComponent <RectTransform>();
                rt.sizeDelta        = parentCanvas.rect.size;
                rt.anchoredPosition = new Vector2(-1f, 1f);

                popup = popupObject.GetComponent <PopupBase>();
                popup.InitValue(lists);
                popup.gameObject.SetActive(true);
            }
            return(popup);
        }
    public static void AddParalelPopupText(string text, PopupTypes type)
    {
        PopupInformation popup = new PopupInformation(type, text);

        CreatePopupText(popup);
    }
 public static void AddPopupText(string text, PopupTypes type)
 {
     popupsToShow.Enqueue(new PopupInformation(type, text));
 }
 static void Initialize(PopupTypes type)
 {
     popupText = Resources.Load <PopupDmgScript>("PopupTextParent" + (type.GetHashCode() + 1).ToString());
     canvas    = GameObject.FindGameObjectWithTag("Canvas");
 }
 public PopupInformation(PopupTypes _type, string _text)
 {
     type = _type;
     text = _text;
 }