Exemple #1
0
    // modal dialog management
    public void CommonBtnDelegate( GameObject go )
    {
        if( currentModal != null ) {

            UnityEngine.Object.Destroy( currentModal.gameObject );
            currentModal = null;
        }
    }
Exemple #2
0
    public void ShowModal( GUIManager.ModalType modalType, string strMessage, UIEventListener.VoidDelegate[] btnDelegates )
    {
        if( modalType < GUIManager.ModalType.OneButtonModal || modalType > GUIManager.ModalType.ThreeButtonModal )
            return;

        string strModalPrefab = modalType.ToString();
        GameObject modal = GUIManager.Instance.InstantiateModalToParent( gameObject, strModalPrefab );
        if( modal == null ) {

            Debug.Log( "Modal2D.ShowModal() - couldn't instantiate modal prefab" );
            return;
        }

        // set current modal
        NGUITools.SetActive( modal, true );
        CurrentModal = modal.GetComponent<UIModal>();

        CurrentModal.InitModal( modalType, strMessage, btnDelegates, CommonBtnDelegate );
    }
Exemple #3
0
    public bool ShowModal(UIModal modal)
    {
        if (isModalInTransition)
        {
            return(false);
        }

        if (visibleModal == null)
        {
            OpenAsVisibleModal(modal);
            return(true);
        }
        isModalInTransition = true;
        visibleModal.RemoveCloseHandler(HandleVisibleClose);
        visibleModal.CloseModal(false).ContinueWith((task) => {
            OpenAsVisibleModal(modal);
            isModalInTransition = false;
        }, TaskContinuationOptions.ExecuteSynchronously);
        return(true);
    }
Exemple #4
0
    public void ShowWaitCoroutineModal( GUIManager.ModalType modalType, string strMessage, 
										YieldInstruction instruction, float fDuration = 0.0f, 
										System.Action waitCoroutineCallBack = null, System.Action waitCallBack = null )
    {
        if( modalType != GUIManager.ModalType.WaitCoroutineModal )
            return;

        string strModalPrefab = modalType.ToString();
        GameObject modal = GUIManager.Instance.InstantiateModalToParent( gameObject, strModalPrefab );
        if( modal == null ) {

            Debug.Log( "Modal2D.ShowWaitCoroutineModal() - couldn't instantiate modal prefab" );
            return;
        }

        // set current modal
        NGUITools.SetActive( modal, true );
        CurrentModal = modal.GetComponent<UIModal>();

        StartCoroutine( CurrentModal.InitWaitCoroutineModal( modalType, strMessage, instruction, fDuration, waitCoroutineCallBack, waitCallBack ) );
    }
Exemple #5
0
 private void HandleVisibleClose(bool isGraceful)
 {
     visibleModal.RemoveCloseHandler(HandleVisibleClose);
     visibleModal = null;
 }
Exemple #6
0
 private void OpenAsVisibleModal(UIModal modal)
 {
     visibleModal = modal;
     visibleModal.AddCloseHandler(HandleVisibleClose);
     modal.OpenModal();
 }
Exemple #7
0
 public void ResetModals()
 {
     visibleModal        = null;
     isModalInTransition = false;
 }