Пример #1
0
    public void Build()
    {
        GameObject popupObject = GameObject.Instantiate(Resources.Load("Popup/" + "PopupPanel", typeof(GameObject))) as GameObject;

        popupObject.transform.SetParent(this.m_target, false);
        PopupPanel popupPanel = popupObject.GetComponent <PopupPanel>();

        popupPanel.SetTitle(this.m_title);
        popupPanel.SetDescription(this.m_description);
        popupPanel.SetButtons(this.m_buttonInfoList);
        popupPanel.Init();
    }
Пример #2
0
    public void OpenConfirmCancel()
    {
        Transform  canvasObj = FindObjectOfType <Canvas>().transform;
        GameObject popup     = Instantiate(popupPrefab, canvasObj);
        PopupPanel script    = popup.GetComponent <PopupPanel>();

        script.SetTitle("Deletar");
        script.SetDescription(
            "Você tem certeza que gostaria de remover a imagem selecionada?\n" +
            "Essa ação não poderá ser desfeita."
            );

        UnityEvent myEvent = new UnityEvent();

        myEvent.AddListener(DestroyThenUpdate);
        myEvent.AddListener(script.SelfDestruct);
        script.SetClickTrigger(myEvent);
    }