Exemplo n.º 1
0
    public static void ClosePopup(Define.PopupType type, System.Action callback = null)
    {
        if (instance == null)
        {
            return;
        }
        if (instance.popupDic.ContainsKey(type))
        {
            instance.JustClosePopup(type, () =>
            {
                openPopupStack.Pop();
                nowOpenPopup = openPopupStack.Peek();

                if (nowOpenPopup != Define.PopupType.None)
                {
                    instance.JustOpenPopup(nowOpenPopup, null);
                }
                else
                {
                    instance.popupBlinder.SetActive(false);
                }

                if (callback != null)
                {
                    callback();
                }
            });
        }
    }
Exemplo n.º 2
0
 public static T GetPopup <T>(Define.PopupType type) where T : IPopup
 {
     if (instance == null)
     {
         return(null);
     }
     if (instance.popupDic.ContainsKey(type))
     {
         return(instance.popupDic[type] as T);
     }
     return(null);
 }
Exemplo n.º 3
0
 private void JustClosePopup(Define.PopupType popupType, System.Action callback)
 {
     if (popupDic.ContainsKey(popupType))
     {
         popupDic[popupType].ClosePopup(() =>
         {
             if (callback != null)
             {
                 callback();
             }
         });
     }
 }
Exemplo n.º 4
0
 private void JustOpenPopup(Define.PopupType popupType, System.Action callback)
 {
     if (popupDic.ContainsKey(popupType))
     {
         popupBlinder.SetActive(true);
         popupDic[popupType].OpenPopup(() =>
         {
             if (callback != null)
             {
                 callback();
             }
         });
     }
 }
Exemplo n.º 5
0
 public static void OpenPopup(Define.PopupType type, System.Action callback = null)
 {
     if (instance == null)
     {
         return;
     }
     if (instance.popupDic.ContainsKey(type))
     {
         if (nowOpenPopup != Define.PopupType.None)
         {
             instance.JustClosePopup(nowOpenPopup, () =>
             {
                 instance.JustOpenPopup(type, () =>
                 {
                     if (callback != null)
                     {
                         callback();
                     }
                     openPopupStack.Push(type);
                     nowOpenPopup = type;
                 });
             });
         }
         else
         {
             instance.JustOpenPopup(type, () =>
             {
                 if (callback != null)
                 {
                     callback();
                 }
                 openPopupStack.Push(type);
                 nowOpenPopup = type;
             });
         }
     }
 }
Exemplo n.º 6
0
    public override void InitSystem()
    {
        openPopupStack.Clear();
        openPopupStack.Push(Define.PopupType.None);
        nowOpenPopup = Define.PopupType.None;
        popupBlinder.SetActive(false);

        instance = this;

        popupDic.Clear();
        for (int i = 0, max = popupList.Count; i < max; i++)
        {
            Define.PopupType type = popupList[i].GetPopupType();
            if (!popupDic.ContainsKey(type))
            {
                popupDic.Add(type, popupList[i]);
                popupList[i].Init();
            }
            else
            {
                Debug.Log("something is wrong");
            }
        }
    }
Exemplo n.º 7
0
 public static bool IsOpened(Define.PopupType popup)
 {
     return(nowOpenPopup == popup);
 }