Ejemplo n.º 1
0
    //---------------------------------------------------------------------------------------------------------------
    private bool LoadAndActivateRoutines(String path, object data, GenricPopUpCallback CallBack = null)
    {
        if (path == String.Empty)
        {
            Debug.LogError("path == String.Empty");
        }

        GameObject prefab = Resources.Load(path) as GameObject;

        if (prefab == null)
        {
            Debug.Log("Attempt to Instantiate popup with path " + path + ", but Resources.Load returned null.");
            return(false);
        }
        currentPopup          = Instantiate(prefab, container).GetComponent <GenericPopup>();
        currentPopup.CallBack = CallBack;
        currentPopup.Activate(data);

        defaultDecor.gameObject.SetActive(!currentPopup.HasCustomDecor);

        if (currentPopup.DisableBlur)
        {
            return(false);
        }
        else
        {
            return(true);
        }
    }
Ejemplo n.º 2
0
    //---------------------------------------------------------------------------------------------------------------
    public void Open(PopupId popup, object data = null, GenricPopUpCallback CallBack = null)
    {
        if (popup == PopupId.NoPopUp)
        {
            Debug.LogError("NoPopUp was called.");
            return;
        }

        Debug.Log("Open " + popup + " popup was called.");
        queue.Enqueue(ShowPopupCoroutine(popup, data, CallBack));

        OnPopupOpen.Invoke(popup);
    }
Ejemplo n.º 3
0
    //---------------------------------------------------------------------------------------------------------------
    private IEnumerator ShowPopupCoroutine(PopupId popup, object data, GenricPopUpCallback CallBack = null
                                           )
    {
        Debug.Log("ShowPopupCoroutine started.");
        popupsController.gameObject.SetActive(true);

        if (currentPopup != null)
        {
            Debug.Log("Closing old popup.");
            yield return(popupsController.HidePanel());

            yield return(popupsController.ShowPanel(popup, data, CallBack));
        }
        else
        {
            Debug.Log("No existing popup found. Opening.");
            yield return(popupsController.Show(popup, data, CallBack));
        }

        Debug.Log("New popUp registered.");
        currentPopup = popup;
    }
Ejemplo n.º 4
0
    //---------------------------------------------------------------------------------------------------------------
    public IEnumerator ShowPanel(PopupId popup, object data, GenricPopUpCallback CallBack = null)
    {
        LoadAndActivate(popup, data, CallBack);

        yield return(AnimShowPanel());
    }
Ejemplo n.º 5
0
    //---------------------------------------------------------------------------------------------------------------
    private bool LoadAndActivate(PopupId id, object data, GenricPopUpCallback CallBack = null)
    {
        string path = id.GetDesc();

        return(this.LoadAndActivateRoutines(path, data, CallBack));
    }
Ejemplo n.º 6
0
    //---------------------------------------------------------------------------------------------------------------
    private bool LoadAndActivate(String PopUpName, object data, GenricPopUpCallback CallBack = null)
    {
        string path = "Prefabs/UI/Popups/" + PopUpName;

        return(this.LoadAndActivateRoutines(path, data, CallBack));
    }