예제 #1
0
    void Start()
    {
        NvGameUISceneManager   mgr   = Singlton.getInstance("NvGameUISceneManager") as NvGameUISceneManager;
        NvUIDialogLayerHandler layer = mgr.findDlgLayer(layerName);

        if (layer != null)
        {
            if (DialogPrefabs != null)
            {
                foreach (GameObject obj in DialogPrefabs)
                {
                    if (obj != null)
                    {
                        NvUIDialogBase dlg = layer.createDialog(obj.name, obj);
                        if (dlg != null && dlg.name == startDlgName)
                        {
                            dlg.openDialog();
                        }
                    }
                }
            }
        }

        GameObject.Destroy(gameObject);
    }
예제 #2
0
    public NvUIDialogBase OpenDialog(string dlgName, int tabIndex = 0)
    {
        if (dlgName == "")
        {
            return(null);
        }

        if (mDialogTable.ContainsKey(dlgName))
        {
            NvUIDialogBase dlg = mDialogTable[dlgName];
            if (dlg.isOpened == false)
            {
                dlg.openDialog(tabIndex);
                return(dlg);
            }
        }
        else
        {
            NvUIDialogBase dlg = CreateDialog(dlgName);
            if (dlg != null)
            {
                dlg.openDialog(tabIndex);
            }

            return(dlg);
        }
        return(null);
    }
예제 #3
0
    public void openDialog(string dlgName)
    {
        NvUIDialogBase dlg = m_owner.findDialog(dlgName);

        if (dlg != null)
        {
            dlg.openDialog();
        }
    }
예제 #4
0
    public void open()
    {
        if (m_dlgScript == null)
        {
            if (m_dialogPrefab != null && m_tabControl != null)
            {
                GameObject dlg = Utility.Instantiate(m_dialogPrefab) as GameObject;
                dlg.name                    = m_dialogPrefab.name;
                dlg.transform.parent        = m_tabControl.spawnTarget;
                dlg.transform.localPosition = Vector3.zero;
                dlg.transform.localRotation = Quaternion.identity;
                dlg.transform.localScale    = Vector3.one;

                m_dlgScript = dlg.GetComponent <NvUIDialogBase>();
                int depthFixed = m_dialogOwner != null ? m_dialogOwner.depth : 0;
                if (m_dlgScript != null)
                {
                    m_dlgScript.depth = m_dialogDepth + depthFixed;
                    m_dlgScript.OnCreated();
                    m_dlgScript.setVisible(false);
                    m_dlgScript.setEnable(false);
                }

                m_dlgScript.mTab = m_tabControl;

                // assign camera to anchor
                List <Transform> stack = new List <Transform>();
                stack.Add(dlg.transform);
                while (stack.Count > 0)
                {
                    Transform tr = stack[0];
                    stack.RemoveAt(0);
                    UIAnchor ac = tr.GetComponent <UIAnchor>();
                    if (ac != null)
                    {
                        //Debug.Log(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>> anchor = " + ac.name);
                        ac.uiCamera = (Singlton.getInstance("NvGameUIManager") as NvGameUIManager).GameUICamera;
                    }

                    for (int ii = 0; ii < tr.childCount; ++ii)
                    {
                        stack.Add(tr.GetChild(ii));
                    }
                }
            }
        }

        if (m_dlgScript != null && m_dlgScript.isOpened == false)
        {
            m_dlgScript.openDialog();
        }
    }