Esempio n. 1
0
    public bool ShowPopupWithData <T>(PopupType type, T slot = default, List <T> slots = null, string message = null, Action noCallBack = null, Action yesCallBack = null)
    {
        if (PopupList.ContainsKey(type.ToString()))
        {
            BasePopupSimple popup = PopupList[type.ToString()];
            if (popup != null)
            {
                BasePopup <T> _popup = popup as BasePopup <T>;
                _popup.SetupData(slot, slots, message, noCallBack, yesCallBack);
                _popup.transform.SetAsLastSibling();
                _popup.OnShow();
                return(true);
            }
            return(false);
        }
        bool check = InitPopup(type, slot, slots, message, noCallBack, yesCallBack);

        return(check);
    }
Esempio n. 2
0
    private bool InitPopup <T>(PopupType type, T slot, List <T> slots = null, string message = null, Action noCallBack = null, Action yesCallBack = null)
    {
        // UpdateContainer();
        BasePopupSimple popupPrefab = Resources.Load <BasePopupSimple>(string.Format(ResourcesConstant.POPUP_PATH, type.ToString()));

        if (popupPrefab == null)
        {
            return(false);
        }
        BasePopupSimple popup = GameMgr.Ins.InstantiateHelper(popupPrefab);

        PopupList.Add(popup.type.ToString(), popup);
        if (popup != null)
        {
            BasePopup <T> _popup = popup as BasePopup <T>;
            _popup.SetupData(slot, slots, message, noCallBack, yesCallBack);
            _popup.transform.SetAsLastSibling();
            _popup.OnShow();
            return(true);
        }
        return(false);
    }