public NvUIDialogBase createDialog(string dlgName, GameObject dlgPrefabObj) { if (!m_dialogChain.ContainsKey(dlgName) && dlgPrefabObj != null) { GameObject dlgObj = Utility.Instantiate(dlgPrefabObj) as GameObject; dlgObj.name = dlgName; dlgObj.transform.parent = m_spawnRoot; dlgObj.transform.localPosition = Vector3.zero; dlgObj.transform.localRotation = Quaternion.identity; dlgObj.transform.localScale = Vector3.one; NvUIDialogBase dlgBase = dlgObj.GetComponent <NvUIDialogBase>(); if (dlgBase != null) { dlgBase.LayerOwner = this; dlgBase.depth = dlgBase.depth + m_depth; dlgBase.OnCreated(); dlgBase.setVisible(false); dlgBase.setEnable(false); m_dialogChain.Add(dlgName, dlgBase); } else { GameObject.DestroyImmediate(dlgObj); } return(dlgBase); } return(null); }
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(); } }
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(); } }