Esempio n. 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);
    }
Esempio n. 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);
    }
Esempio n. 3
0
    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);
    }
Esempio n. 4
0
 private void OnDlgBeginEffect(NvUIDialogBase dlg)
 {
     if (dlg.dialogEffect == NvUIDialogBase.EDialogEffect.eDE_OpenEffect)
     {
         activeTab(m_defaultIndex);
         mActiveDefaultTab = false;
     }
 }
Esempio n. 5
0
    public void closeDialog(string dlgName)
    {
        NvUIDialogBase dlg = m_owner.findDialog(dlgName);

        if (dlg != null)
        {
            dlg.closeDialog();
        }
    }
Esempio n. 6
0
    public void hideDialog(string dlgName)
    {
        NvUIDialogBase dlg = m_owner.findDialog(dlgName);

        if (dlg != null)
        {
            dlg.showDialog(false);
        }
    }
 public void clearSystemUICamera()
 {
     //mNGUI2DDialogCameraTr.DetachChildren();
     if (m_workingDialog != null)
     {
         m_workingDialog.endModal(-1);
         m_workingDialog = null;
     }
 }
Esempio n. 8
0
    public bool destoryDialog(string dlgName)
    {
        NvUIDialogBase dlg = findDialog(dlgName);

        if (dlg != null)
        {
            dlg.destroyDialog();
            //m_dialogChain.Remove( dlgName );
            return(true);
        }
        return(false);
    }
Esempio n. 9
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();
        }
    }
 public NvUIDialogBase createDialog(string dlgName, string dlgPrefab)
 {
     if (m_CommonLayer != null)
     {
         NvUIDialogBase dlg = m_CommonLayer.createDialog(dlgName, dlgPrefab);
         if (dlg != null)
         {
             dlg.registerNotifiactionListener(gameObject);
         }
         return(dlg);
     }
     return(null);
 }
Esempio n. 11
0
 public void update()
 {
     if (m_enable)
     {
         // call update for all dialogs
         foreach (KeyValuePair <string, NvUIDialogBase> kv in m_dialogChain)
         {
             NvUIDialogBase dlg = kv.Value;
             if (dlg.enable && dlg.standalone == false)
             {
                 dlg.lazyUpdate();
             }
         }
     }
 }
 public void DestroyDialog( NvUIDialogBase dlg )
 {
     if ( dlg != null )
     {
         foreach ( KeyValuePair< string, NvUIDialogBase > kv in mDialogTable )
         {
             if ( kv.Value == dlg )
             {
                 dlg.destroyDialog();
                 mDialogTable.Remove( kv.Key );
                 break;
             }
         }
     }
 }
Esempio n. 13
0
 public void DestroyDialog(NvUIDialogBase dlg)
 {
     if (dlg != null)
     {
         foreach (KeyValuePair <string, NvUIDialogBase> kv in mDialogTable)
         {
             if (kv.Value == dlg)
             {
                 dlg.destroyDialog();
                 mDialogTable.Remove(kv.Key);
                 break;
             }
         }
     }
 }
Esempio n. 14
0
    public void LockTab(bool flag)
    {
        NvUIDialogBase dlg = TabOwner;

        if (dlg != null)
        {
            if (flag)
            {
                dlg.Lock();
            }
            else
            {
                dlg.Unlock();
            }
        }
    }
Esempio n. 15
0
    private bool findTabCallback(Transform tr, object args)
    {
        NvUIDialogBase dlg = args as NvUIDialogBase;

        if (dlg.HasTabControl)
        {
            return(true);
        }
        else
        {
            NvUITab tab = tr.GetComponent <NvUITab>();
            if (tab != null)
            {
                dlg.mTab = tab;
                return(true);
            }
        }

        return(false);
    }
//	public NvUIDialogBase showCraftCompoundResultDlg( string craftIconRes, Vector3 scale,
//		List<string> craftBaseInfo, NvUIDialogBase.OnEndModal callback)
//	{
//		if ( m_workingDialog != null )
//		{
//			if ( m_workingDialog is NvCraftCompoundResultDialog )
//			{
//				return m_workingDialog;
//			}
//			return null;
//		}
//
//		NvUIDialogBase CraftCompoundResultDlg = findDialog( "CraftCompoundResultDlg" );
//
//		if ( CraftCompoundResultDlg == null )
//		{
//			CraftCompoundResultDlg = createDialog( "CraftCompoundResultDlg",
//				"UI Prefabs/Prefabs/Dialogs/NinjutsuUI/CraftCompoundResultDialog" );
//		}
//
//		if ( CraftCompoundResultDlg != null )
//		{
//			//NvCraftCompoundResultDialog craftCompoundResultDlg = CraftCompoundResultDlg as NvCraftCompoundResultDialog;
//
//			craftCompoundResultDlg.mItemIcon.spriteName = craftIconRes;
//			craftCompoundResultDlg.mItemIcon.transform.localScale = scale;
//
//			for( int i = 0; i < craftCompoundResultDlg.mItemBaseInfo.Count; i ++ )
////			{
////				craftCompoundResultDlg.mItemBaseInfo[i].text = craftBaseInfo[i];
////			}
////
////			craftCompoundResultDlg.eventOnEndModal += HandleDlgeventOnEndModal;
////			craftCompoundResultDlg.doModal();
////			m_baffle.enabled = true;
////
////			if ( m_workingDialog != null )
////			{
////				m_workingDialog.closeDialog();
////			}
////			else
////			{
////				// disable dialog scene manager
////				foreach ( NvUIBaseSceneManager UISceneMgr in m_UISceneMgrs )
////				{
////					UISceneMgr.activate = false;
////				}
////			}
////
////			m_workingDialog = craftCompoundResultDlg;
//	//	}
//
//		if ( CraftCompoundResultDlg != null && callback != null )
//		{
//			CraftCompoundResultDlg.eventOnEndModal += callback;
//		}
//
//		return CraftCompoundResultDlg;
//
//	}

    public NvUIDialogBase showModalDialog(string dlgName)
    {
        if (m_workingDialog != null)
        {
            // close modal dialog abnormally.
            m_workingDialog.endModal(-1);
            m_workingDialog = null;
        }

        NvUIDialogBase dlg = findDialog(dlgName);

        if (dlg != null)
        {
            dlg.eventOnEndModal += HandleDlgeventOnEndModal;
            dlg.doModal();
            m_workingDialog  = dlg;
            m_baffle.enabled = true;
        }

        return(dlg);
    }
Esempio n. 17
0
    public NvUIDialogBase CreateDialog(string dlgName)
    {
        if (mGameSceneMgr == null)
        {
            Debug.Log("NvUIDialogManager: Wait mGameSceneMgr before using this function!");
            return(null);
        }

        foreach (DialogContext ctx in mContextTable)
        {
            if (ctx.dialogPrefab == null)
            {
                continue;
            }

            if ((ctx.dialogName != "" && ctx.dialogName == dlgName) || (dlgName == ctx.dialogPrefab.name))
            {
                // spawn dialog
                NvUIDialogLayerHandler handler = mGameSceneMgr.findDlgLayer(ctx.layer.ToString(), true);

                if (handler.depth != (int)ctx.layer)
                {
                    handler.depth = (int)ctx.layer;
                }
                //Debug.Log("=======>   dlgName: "+dlgName+ "   ctx.dialogPrefab:  "+ctx.dialogPrefab);
                NvUIDialogBase dlg = handler.createDialog(dlgName, ctx.dialogPrefab);
                dlg.depth           = ctx.depth + (int)ctx.layer;
                dlg.DlgManagerOwner = this;

                // find tab
                Utility.enumWidgets(dlg.transform, findTabCallback, dlg as object);

                mDialogTable.Add(dlgName, dlg);

                return(dlg);
            }
        }
        return(null);
    }
    IEnumerator OpenMessageBox(MsgBoxContext ctx)
    {
        while (m_workingDialog != null && m_workingDialog.isOpened == true)
        {
            yield return(null);
        }

        NvMessageBox msgbox = ctx.msgbox;

        msgbox.title            = ctx.title;
        msgbox.description      = ctx.description;
        msgbox.style            = ctx.style;
        msgbox.eventOnEndModal += HandleDlgeventOnEndModal;
        if (ctx.callback != null)
        {
            msgbox.eventOnEndModal += ctx.callback;
        }
        msgbox.doModal();
        m_baffle.enabled = true;

        m_workingDialog = msgbox;
    }
Esempio n. 19
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();
        }
    }
 void HandleDlgeventOnEndModal(int result)
 {
     m_baffle.enabled = false;
     m_workingDialog = null;
 }
 public void clearSystemUICamera()
 {
     //mNGUI2DDialogCameraTr.DetachChildren();
     if ( m_workingDialog != null )
     {
         m_workingDialog.endModal(-1);
         m_workingDialog = null;
     }
 }
 void HandleDlgeventOnEndModal(int result)
 {
     m_baffle.enabled = false;
     m_workingDialog  = null;
 }
//	public NvUIDialogBase showEquipmentStrengthenEnsureDlg( NvEquipmentStrengthenInfo info, NvUIDialogBase.OnEndModal callback)
//	{
//
//		if ( m_workingDialog != null )
//		{
//			if ( m_workingDialog is NvEquipmentStrengthenEnsureDialog )
//			{
//				return m_workingDialog;
//			}
//			return null;
//		}
//
//		NvUIDialogBase EquipStrengEnsureDlg = findDialog( "EquipmentStrengthenEnsureDialog" );
//		//Debug.Log( "#################################    EquipStrengEnsureDlg : " + EquipStrengEnsureDlg );
//		if ( EquipStrengEnsureDlg == null )
//		{
//			EquipStrengEnsureDlg = createDialog( "EquipStrengthenEnsureDialog",
//				"UI Prefabs/Prefabs/Dialogs/EquipmentUI/EquipStrengthenEnsureDialog" );
//		}
//		//Debug.Log( "#################################    EquipStrengEnsureDlg : " + EquipStrengEnsureDlg );
//		if ( EquipStrengEnsureDlg != null )
//		{
//			NvEquipmentStrengthenEnsureDialog equipStreEnsureDlg = EquipStrengEnsureDlg as NvEquipmentStrengthenEnsureDialog;
//			equipStreEnsureDlg.mLblTitle.text = info.equipName;
//			equipStreEnsureDlg.mImgIcon.spriteName = info.iconName;
//			equipStreEnsureDlg.mImgIcon.transform.localScale = info.iconScale;
//			if ( info.curLv < 10 )
//			{
//				equipStreEnsureDlg.mImgCurLv[1].transform.localScale = Vector3.zero;
//				equipStreEnsureDlg.mImgCurLv[0].setVisible ( true );
//				equipStreEnsureDlg.mImgCurLv[0].spriteName = "" + info.curLv;
//				equipStreEnsureDlg.mImgCurLv[0].transform.localScale = new Vector3 ( 22.0f, 35.0f, 0.0f );
//			}
//			else if ( info.curLv < 20 )
//			{
//				equipStreEnsureDlg.mImgCurLv[1].setVisible ( true );
//				equipStreEnsureDlg.mImgCurLv[1].spriteName = "1";
//				equipStreEnsureDlg.mImgCurLv[1].transform.localScale = new Vector3 ( 22.0f, 35.0f, 0.0f );
//				equipStreEnsureDlg.mImgCurLv[0].setVisible ( true );
//				equipStreEnsureDlg.mImgCurLv[0].spriteName = "" +  ( info.curLv - 10 ) ;
//				equipStreEnsureDlg.mImgCurLv[0].transform.localScale = new Vector3 ( 22.0f, 35.0f, 0.0f );
//			}
//			if ( info.newLv < 10 )
//			{
//				equipStreEnsureDlg.mImgNewLv[1].transform.localScale = Vector3.zero;
//				equipStreEnsureDlg.mImgNewLv[0].setVisible ( true );
//				equipStreEnsureDlg.mImgNewLv[0].spriteName = "" + info.newLv;
//				equipStreEnsureDlg.mImgNewLv[0].transform.localScale = new Vector3 ( 22.0f, 35.0f, 0.0f );
//			}
//			else if ( info.newLv < 20 )
//			{
//				equipStreEnsureDlg.mImgNewLv[1].setVisible ( true );
//				equipStreEnsureDlg.mImgNewLv[1].spriteName = "1";
//				equipStreEnsureDlg.mImgNewLv[1].transform.localScale = new Vector3 ( 22.0f, 35.0f, 0.0f );
//				equipStreEnsureDlg.mImgNewLv[0].setVisible ( true );
//				equipStreEnsureDlg.mImgNewLv[0].spriteName = "" + ( info.newLv - 10 ) ;
//				equipStreEnsureDlg.mImgNewLv[0].transform.localScale = new Vector3 ( 22.0f, 35.0f, 0.0f );
//			}
//
//			for ( int i = 0; i < 4; i ++ )
//			{
//				equipStreEnsureDlg.mLblAttrName[i].text = "";
//				equipStreEnsureDlg.mLblCurAttrValue[i].text = "";
//				equipStreEnsureDlg.mLblNewAttrValue[i].text = "";
//				equipStreEnsureDlg.mImgSmallArrow[i].transform.localScale = Vector3.one;
//			}
//
//			for ( int i = 0; i < 4; i ++ )
//			{
//				if ( info.curEquipAttr.Count / 2 > i )
//				{
//					equipStreEnsureDlg.mLblAttrName[i].text = info.curEquipAttr[i*2];
//					equipStreEnsureDlg.mLblCurAttrValue[i].text = info.curEquipAttr[i*2+1];
//					equipStreEnsureDlg.mLblNewAttrValue[i].text = info.newEquipAttr[i*2+1];
//					equipStreEnsureDlg.mImgSmallArrow[i].transform.localScale = new Vector3 ( 21.0f, 11.0f, 0.0f );
//				}
//			}
//
//			equipStreEnsureDlg.mLblCoinName.text = info.coinName;
//			equipStreEnsureDlg.mLblCoinNum.text = "" + info.coinNum;
//
//			equipStreEnsureDlg.eventOnEndModal += HandleDlgeventOnEndModal;
//			equipStreEnsureDlg.doModal();
//			m_baffle.enabled = true;
//
//			if ( m_workingDialog != null )
//			{
//				m_workingDialog.closeDialog();
//			}
//			else
//			{
//				// disable dialog scene manager
//				foreach ( NvUIBaseSceneManager UISceneMgr in m_UISceneMgrs )
//				{
//					UISceneMgr.activate = false;
//				}
//			}
//
//			m_workingDialog = equipStreEnsureDlg;
//		}
//
//		if ( EquipStrengEnsureDlg != null && callback != null )
//		{
//			EquipStrengEnsureDlg.eventOnEndModal += callback;
//		}
//
//		return EquipStrengEnsureDlg;
//	}

//	public NvUIDialogBase showNinjutsuStrengthenEnsureDlg( NvNinjutsuStrengthenInfo info, NvUIDialogBase.OnEndModal callback)
//	{
//		if ( m_workingDialog != null )
//		{
//			if ( m_workingDialog is NvNinjutsuStrengthenEnsureDialog )
//			{
//				return m_workingDialog;
//			}
//			return null;
//		}
//
//		NvUIDialogBase NinjutsuStrengEnsureDlg = findDialog( "NinjutsuStrengthenEnsureDialog" );
//
//		if ( NinjutsuStrengEnsureDlg == null )
//		{
//			NinjutsuStrengEnsureDlg = createDialog( "NinjutsuStrengthenEnsureDialog",
//				"UI Prefabs/Prefabs/Dialogs/NinjutsuUI/NinjutsuStrengthenEnsureDialog" );
//		}
//
//		if ( NinjutsuStrengEnsureDlg != null )
//		{
//			NvNinjutsuStrengthenEnsureDialog ninjutsuStreEnsureDlg = NinjutsuStrengEnsureDlg as NvNinjutsuStrengthenEnsureDialog;
//			ninjutsuStreEnsureDlg.mLblTitle.text = info.craftName;
//			ninjutsuStreEnsureDlg.mImgIcon.spriteName = info.iconName;
//			ninjutsuStreEnsureDlg.mImgIcon.transform.localScale = info.iconScale;
//			if ( info.curLv < 10 )
//			{
//				ninjutsuStreEnsureDlg.mImgCurLv[1].transform.localScale = Vector3.zero;
//				ninjutsuStreEnsureDlg.mImgCurLv[0].setVisible ( true );
//				ninjutsuStreEnsureDlg.mImgCurLv[0].spriteName = "" + info.curLv;
//				ninjutsuStreEnsureDlg.mImgCurLv[0].transform.localScale = new Vector3 ( 22.0f, 35.0f, 0.0f );
//			}
//			else if ( info.curLv < 20 )
//			{
//				ninjutsuStreEnsureDlg.mImgCurLv[1].setVisible ( true );
//				ninjutsuStreEnsureDlg.mImgCurLv[1].spriteName = "1";
//				ninjutsuStreEnsureDlg.mImgCurLv[1].transform.localScale = new Vector3 ( 22.0f, 35.0f, 0.0f );
//				ninjutsuStreEnsureDlg.mImgCurLv[0].setVisible ( true );
//				ninjutsuStreEnsureDlg.mImgCurLv[0].spriteName = "" +  ( info.curLv - 10 ) ;
//				ninjutsuStreEnsureDlg.mImgCurLv[0].transform.localScale = new Vector3 ( 22.0f, 35.0f, 0.0f );
//			}
//			if ( info.newLv < 10 )
//			{
//				ninjutsuStreEnsureDlg.mImgNewLv[1].transform.localScale = Vector3.zero;
//				ninjutsuStreEnsureDlg.mImgNewLv[0].setVisible ( true );
//				ninjutsuStreEnsureDlg.mImgNewLv[0].spriteName = "" + info.newLv;
//				ninjutsuStreEnsureDlg.mImgNewLv[0].transform.localScale = new Vector3 ( 22.0f, 35.0f, 0.0f );
//			}
//			else if ( info.newLv < 20 )
//			{
//				ninjutsuStreEnsureDlg.mImgNewLv[1].setVisible ( true );
//				ninjutsuStreEnsureDlg.mImgNewLv[1].spriteName = "1";
//				ninjutsuStreEnsureDlg.mImgNewLv[1].transform.localScale = new Vector3 ( 22.0f, 35.0f, 0.0f );
//				ninjutsuStreEnsureDlg.mImgNewLv[0].setVisible ( true );
//				ninjutsuStreEnsureDlg.mImgNewLv[0].spriteName = "" + ( info.newLv - 10 ) ;
//				ninjutsuStreEnsureDlg.mImgNewLv[0].transform.localScale = new Vector3 ( 22.0f, 35.0f, 0.0f );
//			}
//			ninjutsuStreEnsureDlg.mLblDesc.text = info.description;
//			ninjutsuStreEnsureDlg.mLblCoinName.text = info.coinName;
//			ninjutsuStreEnsureDlg.mLblCoinNum.text = info.coinNum;
//
//			ninjutsuStreEnsureDlg.eventOnEndModal += HandleDlgeventOnEndModal;
//			ninjutsuStreEnsureDlg.doModal();
//			m_baffle.enabled = true;
//
//			if ( m_workingDialog != null )
//			{
//				m_workingDialog.closeDialog();
//			}
//			else
//			{
//				// disable dialog scene manager
//				foreach ( NvUIBaseSceneManager UISceneMgr in m_UISceneMgrs )
//				{
//					UISceneMgr.activate = false;
//				}
//			}
//
//			m_workingDialog = ninjutsuStreEnsureDlg;
//		}
//
//		if ( NinjutsuStrengEnsureDlg != null && callback != null )
//		{
//			NinjutsuStrengEnsureDlg.eventOnEndModal += callback;
//		}
//
//		return NinjutsuStrengEnsureDlg;
//	}

//	public NvUIDialogBase showItemSellDlg ( NvItemInfo info, NvUIDialogBase.OnEndModal callback )
//	{
//		if ( m_workingDialog != null )
//		{
//			if ( m_workingDialog is NvItemSellDialog)
//			{
//				return m_workingDialog;
//			}
//			return null;
//		}
//
//		NvUIDialogBase ItemSellDlg = findDialog( "ItemSellDialog" );
//
//		if ( ItemSellDlg == null )
//		{
//			ItemSellDlg = createDialog( "ItemSellDialog", "UI Prefabs/Prefabs/Dialogs/ItemUI/ItemSellDialog" );
//		}
//
//		if ( ItemSellDlg != null )
//		{
//			NvItemSellDialog itemSellDlg = ItemSellDlg as NvItemSellDialog;
//
//			itemSellDlg.mLblTitle.text = info.itemName;
//			itemSellDlg.mImgIcon.spriteName = info.iconName;
//			itemSellDlg.mImgIcon.transform.localScale = info.iconScale;
//			itemSellDlg.mItemMaxNum = info.itemMaxNum;
//			itemSellDlg.mItemPrice = info.itemPrice;
//			itemSellDlg.mLblCoinNum.text = "" + info.itemPrice;
//			itemSellDlg.mLblCoinName.text = info.coinName;
//
//			itemSellDlg.eventOnEndModal += HandleDlgeventOnEndModal;
//			itemSellDlg.doModal();
//			m_baffle.enabled = true;
//
//			if ( m_workingDialog != null )
//			{
//				m_workingDialog.closeDialog();
//			}
//			else
//			{
//				// disable dialog scene manager
//				foreach ( NvUIBaseSceneManager UISceneMgr in m_UISceneMgrs )
//				{
//					UISceneMgr.activate = false;
//				}
//			}
//
//			m_workingDialog = itemSellDlg;
//		}
//
//		if ( ItemSellDlg != null && callback != null )
//		{
//			ItemSellDlg.eventOnEndModal += callback;
//		}
//
//		return ItemSellDlg;
//	}

//	public NvUIDialogBase showEquipSellDlg ( NvItemInfo info, NvUIDialogBase.OnEndModal callback )
//	{
//		if ( m_workingDialog != null )
//		{
//			if ( m_workingDialog is NvEquipSellDialog )
//			{
//				return m_workingDialog;
//			}
//			return null;
//		}
//
//		NvUIDialogBase EquipSellDlg = findDialog( "EquipSellDialog" );
//
//		if ( EquipSellDlg == null )
//		{
//			EquipSellDlg = createDialog( "EquipSellDialog", "UI Prefabs/Prefabs/Dialogs/EquipmentUI/EquipSellDialog" );
//		}
//
//		if ( EquipSellDlg != null )
//		{
//			NvEquipSellDialog equipSellDlg = EquipSellDlg as NvEquipSellDialog;
//
//			equipSellDlg.mLblTitle.text = info.itemName;
//			equipSellDlg.mImgIcon.spriteName = info.iconName;
//			equipSellDlg.mImgIcon.transform.localScale = info.iconScale;
//			equipSellDlg.mItemPrice = info.itemPrice;
//			equipSellDlg.mLblCoinNum.text = "" + info.itemPrice;
//			equipSellDlg.mLblCoinName.text = info.coinName;
//
//			equipSellDlg.eventOnEndModal += HandleDlgeventOnEndModal;
//			equipSellDlg.doModal();
//			m_baffle.enabled = true;
//
//			if ( m_workingDialog != null )
//			{
//				m_workingDialog.closeDialog();
//			}
//			else
//			{
//				// disable dialog scene manager
//				foreach ( NvUIBaseSceneManager UISceneMgr in m_UISceneMgrs )
//				{
//					UISceneMgr.activate = false;
//				}
//			}
//
//			m_workingDialog = equipSellDlg;
//		}
//
//		if ( EquipSellDlg != null && callback != null )
//		{
//			EquipSellDlg.eventOnEndModal += callback;
//		}
//
//		return EquipSellDlg;
//	}

    public NvUIDialogBase showEquipSmithResultDlg(string equipIconRes,
                                                  List <string> equipBaseInfo, List <string> equipAttrInfo, NvUIDialogBase.OnEndModal callback)
    {
        if (m_workingDialog != null)
        {
//			if ( m_workingDialog is NvEquipSmithResultDialog )
//			{
//				return m_workingDialog;
//			}
            return(null);
        }

        NvUIDialogBase EquipSmithResultDlg = findDialog("EquipSmithResultDlg");

        if (EquipSmithResultDlg == null)
        {
            EquipSmithResultDlg = createDialog("EquipSmithResultDlg",
                                               "UI Prefabs/Prefabs/Dialogs/EquipmentUI/EquipSmithResultDialog");
        }

//		if ( EquipSmithResultDlg != null )
//		{
//			NvEquipSmithResultDialog equipSmithResultDlg = EquipSmithResultDlg as NvEquipSmithResultDialog;
//
//			equipSmithResultDlg.mItemIcon.spriteName = equipIconRes;
//			equipSmithResultDlg.mItemIcon.transform.localScale = new Vector3 ( 64.0f, 64.0f, 0.0f );
//
//			for( int i = 0; i < equipSmithResultDlg.mItemBaseInfo.Count; i ++ )
//			{
//				equipSmithResultDlg.mItemBaseInfo[i].text = equipBaseInfo[i];
//			}
//			for( int i = 0; i < equipSmithResultDlg.mItemAttrInfo.Count; i ++ )
//			{
//				if ( i < equipAttrInfo.Count )
//				{
//					equipSmithResultDlg.mItemAttrInfo[i].text = equipAttrInfo[i];
//				}
//				else
//				{
//					equipSmithResultDlg.mItemAttrInfo[i].text = "";
//				}
//			}
//
//			equipSmithResultDlg.eventOnEndModal += HandleDlgeventOnEndModal;
//			equipSmithResultDlg.doModal();
//			m_baffle.enabled = true;
//
//			if ( m_workingDialog != null )
//			{
//				m_workingDialog.closeDialog();
//			}
//			else
//			{
//				// disable dialog scene manager
//				foreach ( NvUIBaseSceneManager UISceneMgr in m_UISceneMgrs )
//				{
//					UISceneMgr.activate = false;
//				}
//			}
//
//			m_workingDialog = equipSmithResultDlg;
//		}

        if (EquipSmithResultDlg != null && callback != null)
        {
            EquipSmithResultDlg.eventOnEndModal += callback;
        }

        return(EquipSmithResultDlg);
    }
    public NvUIDialogBase showMessageBox(string msg, string title            = "",
                                         NvMessageBox.EMessageBoxStyle style = NvMessageBox.EMessageBoxStyle.eStyle_OkayOnly,
                                         NvUIDialogBase.OnEndModal callback  = null, bool closeIfOpened = false)
    {
        bool pendingMessagebox = false;

        if (m_workingDialog != null && m_workingDialog.isOpened)
        {
            if (!closeIfOpened)
            {
                return(null);
            }
            else
            {
                pendingMessagebox = true;
                m_workingDialog.endModal(-1);
            }
        }

        NvUIDialogBase msgbox = findDialog("MessageBox");

        if (msgbox == null)
        {
            msgbox = createDialog("MessageBox", "UI Prefabs/Prefabs/Dialogs/MessageBox");
        }

        if (msgbox != null)
        {
            NvMessageBox messagebox = msgbox as NvMessageBox;

            if (pendingMessagebox)
            {
                MsgBoxContext ctx = new MsgBoxContext();
                ctx.msgbox      = messagebox;
                ctx.title       = title;
                ctx.description = msg;
                ctx.style       = style;
                ctx.callback    = callback;

                StartCoroutine("OpenMessageBox", ctx);
            }
            else
            {
                messagebox.eventOnEndModal += HandleDlgeventOnEndModal;
                if (callback != null)
                {
                    messagebox.eventOnEndModal += callback;
                }

                messagebox.description = msg;
                messagebox.title       = title;
                messagebox.style       = style;
                messagebox.doModal();

                m_workingDialog  = messagebox;
                m_baffle.enabled = true;
            }
        }

        return(msgbox);
    }
    //    public NvUIDialogBase showCraftCompoundResultDlg( string craftIconRes, Vector3 scale,
    //        List<string> craftBaseInfo, NvUIDialogBase.OnEndModal callback)
    //    {
    //        if ( m_workingDialog != null )
    //        {
    //            if ( m_workingDialog is NvCraftCompoundResultDialog )
    //            {
    //                return m_workingDialog;
    //            }
    //            return null;
    //        }
    //        
    //        NvUIDialogBase CraftCompoundResultDlg = findDialog( "CraftCompoundResultDlg" );
    //        
    //        if ( CraftCompoundResultDlg == null )
    //        {
    //            CraftCompoundResultDlg = createDialog( "CraftCompoundResultDlg",
    //                "UI Prefabs/Prefabs/Dialogs/NinjutsuUI/CraftCompoundResultDialog" );
    //        }
    //        
    //        if ( CraftCompoundResultDlg != null )
    //        {
    //            //NvCraftCompoundResultDialog craftCompoundResultDlg = CraftCompoundResultDlg as NvCraftCompoundResultDialog;
    //            
    //            craftCompoundResultDlg.mItemIcon.spriteName = craftIconRes;
    //            craftCompoundResultDlg.mItemIcon.transform.localScale = scale;
    //            
    //            for( int i = 0; i < craftCompoundResultDlg.mItemBaseInfo.Count; i ++ )
    ////			{
    ////				craftCompoundResultDlg.mItemBaseInfo[i].text = craftBaseInfo[i];
    ////			}			
    ////			
    ////			craftCompoundResultDlg.eventOnEndModal += HandleDlgeventOnEndModal;
    ////			craftCompoundResultDlg.doModal();
    ////			m_baffle.enabled = true;
    ////			
    ////			if ( m_workingDialog != null )
    ////			{
    ////				m_workingDialog.closeDialog();
    ////			}
    ////			else
    ////			{
    ////				// disable dialog scene manager
    ////				foreach ( NvUIBaseSceneManager UISceneMgr in m_UISceneMgrs )
    ////				{
    ////					UISceneMgr.activate = false;
    ////				}
    ////			}
    ////			
    ////			m_workingDialog = craftCompoundResultDlg;						
    //    //	}
    //        
    //        if ( CraftCompoundResultDlg != null && callback != null )
    //        {
    //            CraftCompoundResultDlg.eventOnEndModal += callback;
    //        }
    //        
    //        return CraftCompoundResultDlg;
    //        
    //    }
    public NvUIDialogBase showModalDialog( string dlgName )
    {
        if ( m_workingDialog != null )
        {
            // close modal dialog abnormally.
            m_workingDialog.endModal(-1);
            m_workingDialog = null;
        }

        NvUIDialogBase dlg = findDialog( dlgName );
        if ( dlg != null )
        {
            dlg.eventOnEndModal += HandleDlgeventOnEndModal;
            dlg.doModal();
            m_workingDialog = dlg;
            m_baffle.enabled = true;
        }

        return dlg;
    }
Esempio n. 26
0
    public void DestroyDialog(string dlgName)
    {
        NvUIDialogBase dlg = FindDialog(dlgName);

        DestroyDialog(dlg);
    }
    IEnumerator OpenMessageBox( MsgBoxContext ctx )
    {
        while ( m_workingDialog != null && m_workingDialog.isOpened == true )
        {
            yield return null;
        }

        NvMessageBox msgbox = ctx.msgbox;
        msgbox.title = ctx.title;
        msgbox.description = ctx.description;
        msgbox.style = ctx.style;
        msgbox.eventOnEndModal += HandleDlgeventOnEndModal;
        if ( ctx.callback != null )
        {
            msgbox.eventOnEndModal += ctx.callback;
        }
        msgbox.doModal();
        m_baffle.enabled = true;

        m_workingDialog = msgbox;
    }
    //    public NvUIDialogBase showEquipmentStrengthenEnsureDlg( NvEquipmentStrengthenInfo info, NvUIDialogBase.OnEndModal callback)
    //    {
    //        
    //        if ( m_workingDialog != null )
    //        {
    //            if ( m_workingDialog is NvEquipmentStrengthenEnsureDialog )
    //            {
    //                return m_workingDialog;
    //            }
    //            return null;
    //        }
    //        
    //        NvUIDialogBase EquipStrengEnsureDlg = findDialog( "EquipmentStrengthenEnsureDialog" );
    //        //Debug.Log( "#################################    EquipStrengEnsureDlg : " + EquipStrengEnsureDlg );
    //        if ( EquipStrengEnsureDlg == null )
    //        {
    //            EquipStrengEnsureDlg = createDialog( "EquipStrengthenEnsureDialog",
    //                "UI Prefabs/Prefabs/Dialogs/EquipmentUI/EquipStrengthenEnsureDialog" );
    //        }
    //        //Debug.Log( "#################################    EquipStrengEnsureDlg : " + EquipStrengEnsureDlg );
    //        if ( EquipStrengEnsureDlg != null )
    //        {
    //            NvEquipmentStrengthenEnsureDialog equipStreEnsureDlg = EquipStrengEnsureDlg as NvEquipmentStrengthenEnsureDialog;
    //            equipStreEnsureDlg.mLblTitle.text = info.equipName;
    //            equipStreEnsureDlg.mImgIcon.spriteName = info.iconName;
    //            equipStreEnsureDlg.mImgIcon.transform.localScale = info.iconScale;
    //            if ( info.curLv < 10 )
    //            {
    //                equipStreEnsureDlg.mImgCurLv[1].transform.localScale = Vector3.zero;
    //                equipStreEnsureDlg.mImgCurLv[0].setVisible ( true );
    //                equipStreEnsureDlg.mImgCurLv[0].spriteName = "" + info.curLv;
    //                equipStreEnsureDlg.mImgCurLv[0].transform.localScale = new Vector3 ( 22.0f, 35.0f, 0.0f );
    //            }
    //            else if ( info.curLv < 20 )
    //            {
    //                equipStreEnsureDlg.mImgCurLv[1].setVisible ( true );
    //                equipStreEnsureDlg.mImgCurLv[1].spriteName = "1";
    //                equipStreEnsureDlg.mImgCurLv[1].transform.localScale = new Vector3 ( 22.0f, 35.0f, 0.0f );
    //                equipStreEnsureDlg.mImgCurLv[0].setVisible ( true );
    //                equipStreEnsureDlg.mImgCurLv[0].spriteName = "" +  ( info.curLv - 10 ) ;
    //                equipStreEnsureDlg.mImgCurLv[0].transform.localScale = new Vector3 ( 22.0f, 35.0f, 0.0f );
    //            }
    //            if ( info.newLv < 10 )
    //            {
    //                equipStreEnsureDlg.mImgNewLv[1].transform.localScale = Vector3.zero;
    //                equipStreEnsureDlg.mImgNewLv[0].setVisible ( true );
    //                equipStreEnsureDlg.mImgNewLv[0].spriteName = "" + info.newLv;
    //                equipStreEnsureDlg.mImgNewLv[0].transform.localScale = new Vector3 ( 22.0f, 35.0f, 0.0f );
    //            }
    //            else if ( info.newLv < 20 )
    //            {
    //                equipStreEnsureDlg.mImgNewLv[1].setVisible ( true );
    //                equipStreEnsureDlg.mImgNewLv[1].spriteName = "1";
    //                equipStreEnsureDlg.mImgNewLv[1].transform.localScale = new Vector3 ( 22.0f, 35.0f, 0.0f );
    //                equipStreEnsureDlg.mImgNewLv[0].setVisible ( true );
    //                equipStreEnsureDlg.mImgNewLv[0].spriteName = "" + ( info.newLv - 10 ) ;
    //                equipStreEnsureDlg.mImgNewLv[0].transform.localScale = new Vector3 ( 22.0f, 35.0f, 0.0f );
    //            }
    //            
    //            for ( int i = 0; i < 4; i ++ )
    //            {
    //                equipStreEnsureDlg.mLblAttrName[i].text = "";
    //                equipStreEnsureDlg.mLblCurAttrValue[i].text = "";
    //                equipStreEnsureDlg.mLblNewAttrValue[i].text = "";
    //                equipStreEnsureDlg.mImgSmallArrow[i].transform.localScale = Vector3.one;
    //            }
    //            
    //            for ( int i = 0; i < 4; i ++ )
    //            {
    //                if ( info.curEquipAttr.Count / 2 > i )
    //                {
    //                    equipStreEnsureDlg.mLblAttrName[i].text = info.curEquipAttr[i*2];
    //                    equipStreEnsureDlg.mLblCurAttrValue[i].text = info.curEquipAttr[i*2+1];
    //                    equipStreEnsureDlg.mLblNewAttrValue[i].text = info.newEquipAttr[i*2+1];
    //                    equipStreEnsureDlg.mImgSmallArrow[i].transform.localScale = new Vector3 ( 21.0f, 11.0f, 0.0f );
    //                }
    //            }
    //            
    //            equipStreEnsureDlg.mLblCoinName.text = info.coinName;
    //            equipStreEnsureDlg.mLblCoinNum.text = "" + info.coinNum;
    //            
    //            equipStreEnsureDlg.eventOnEndModal += HandleDlgeventOnEndModal;
    //            equipStreEnsureDlg.doModal();
    //            m_baffle.enabled = true;
    //            
    //            if ( m_workingDialog != null )
    //            {
    //                m_workingDialog.closeDialog();
    //            }
    //            else
    //            {
    //                // disable dialog scene manager
    //                foreach ( NvUIBaseSceneManager UISceneMgr in m_UISceneMgrs )
    //                {
    //                    UISceneMgr.activate = false;
    //                }
    //            }
    //            
    //            m_workingDialog = equipStreEnsureDlg;
    //        }
    //        
    //        if ( EquipStrengEnsureDlg != null && callback != null )
    //        {
    //            EquipStrengEnsureDlg.eventOnEndModal += callback;
    //        }
    //        
    //        return EquipStrengEnsureDlg;
    //    }
    //    public NvUIDialogBase showNinjutsuStrengthenEnsureDlg( NvNinjutsuStrengthenInfo info, NvUIDialogBase.OnEndModal callback)
    //    {
    //        if ( m_workingDialog != null )
    //        {
    //            if ( m_workingDialog is NvNinjutsuStrengthenEnsureDialog )
    //            {
    //                return m_workingDialog;
    //            }
    //            return null;
    //        }
    //        
    //        NvUIDialogBase NinjutsuStrengEnsureDlg = findDialog( "NinjutsuStrengthenEnsureDialog" );
    //        
    //        if ( NinjutsuStrengEnsureDlg == null )
    //        {
    //            NinjutsuStrengEnsureDlg = createDialog( "NinjutsuStrengthenEnsureDialog",
    //                "UI Prefabs/Prefabs/Dialogs/NinjutsuUI/NinjutsuStrengthenEnsureDialog" );
    //        }
    //        
    //        if ( NinjutsuStrengEnsureDlg != null )
    //        {
    //            NvNinjutsuStrengthenEnsureDialog ninjutsuStreEnsureDlg = NinjutsuStrengEnsureDlg as NvNinjutsuStrengthenEnsureDialog;
    //            ninjutsuStreEnsureDlg.mLblTitle.text = info.craftName;
    //            ninjutsuStreEnsureDlg.mImgIcon.spriteName = info.iconName;
    //            ninjutsuStreEnsureDlg.mImgIcon.transform.localScale = info.iconScale;
    //            if ( info.curLv < 10 )
    //            {
    //                ninjutsuStreEnsureDlg.mImgCurLv[1].transform.localScale = Vector3.zero;
    //                ninjutsuStreEnsureDlg.mImgCurLv[0].setVisible ( true );
    //                ninjutsuStreEnsureDlg.mImgCurLv[0].spriteName = "" + info.curLv;
    //                ninjutsuStreEnsureDlg.mImgCurLv[0].transform.localScale = new Vector3 ( 22.0f, 35.0f, 0.0f );
    //            }
    //            else if ( info.curLv < 20 )
    //            {
    //                ninjutsuStreEnsureDlg.mImgCurLv[1].setVisible ( true );
    //                ninjutsuStreEnsureDlg.mImgCurLv[1].spriteName = "1";
    //                ninjutsuStreEnsureDlg.mImgCurLv[1].transform.localScale = new Vector3 ( 22.0f, 35.0f, 0.0f );
    //                ninjutsuStreEnsureDlg.mImgCurLv[0].setVisible ( true );
    //                ninjutsuStreEnsureDlg.mImgCurLv[0].spriteName = "" +  ( info.curLv - 10 ) ;
    //                ninjutsuStreEnsureDlg.mImgCurLv[0].transform.localScale = new Vector3 ( 22.0f, 35.0f, 0.0f );
    //            }
    //            if ( info.newLv < 10 )
    //            {
    //                ninjutsuStreEnsureDlg.mImgNewLv[1].transform.localScale = Vector3.zero;
    //                ninjutsuStreEnsureDlg.mImgNewLv[0].setVisible ( true );
    //                ninjutsuStreEnsureDlg.mImgNewLv[0].spriteName = "" + info.newLv;
    //                ninjutsuStreEnsureDlg.mImgNewLv[0].transform.localScale = new Vector3 ( 22.0f, 35.0f, 0.0f );
    //            }
    //            else if ( info.newLv < 20 )
    //            {
    //                ninjutsuStreEnsureDlg.mImgNewLv[1].setVisible ( true );
    //                ninjutsuStreEnsureDlg.mImgNewLv[1].spriteName = "1";
    //                ninjutsuStreEnsureDlg.mImgNewLv[1].transform.localScale = new Vector3 ( 22.0f, 35.0f, 0.0f );
    //                ninjutsuStreEnsureDlg.mImgNewLv[0].setVisible ( true );
    //                ninjutsuStreEnsureDlg.mImgNewLv[0].spriteName = "" + ( info.newLv - 10 ) ;
    //                ninjutsuStreEnsureDlg.mImgNewLv[0].transform.localScale = new Vector3 ( 22.0f, 35.0f, 0.0f );
    //            }
    //            ninjutsuStreEnsureDlg.mLblDesc.text = info.description;
    //            ninjutsuStreEnsureDlg.mLblCoinName.text = info.coinName;
    //            ninjutsuStreEnsureDlg.mLblCoinNum.text = info.coinNum;
    //            
    //            ninjutsuStreEnsureDlg.eventOnEndModal += HandleDlgeventOnEndModal;
    //            ninjutsuStreEnsureDlg.doModal();
    //            m_baffle.enabled = true;
    //            
    //            if ( m_workingDialog != null )
    //            {
    //                m_workingDialog.closeDialog();
    //            }
    //            else
    //            {
    //                // disable dialog scene manager
    //                foreach ( NvUIBaseSceneManager UISceneMgr in m_UISceneMgrs )
    //                {
    //                    UISceneMgr.activate = false;
    //                }
    //            }
    //            
    //            m_workingDialog = ninjutsuStreEnsureDlg;
    //        }
    //        
    //        if ( NinjutsuStrengEnsureDlg != null && callback != null )
    //        {
    //            NinjutsuStrengEnsureDlg.eventOnEndModal += callback;
    //        }
    //        
    //        return NinjutsuStrengEnsureDlg;
    //    }
    //    public NvUIDialogBase showItemSellDlg ( NvItemInfo info, NvUIDialogBase.OnEndModal callback )
    //    {
    //        if ( m_workingDialog != null )
    //        {
    //            if ( m_workingDialog is NvItemSellDialog)
    //            {
    //                return m_workingDialog;
    //            }
    //            return null;
    //        }
    //        
    //        NvUIDialogBase ItemSellDlg = findDialog( "ItemSellDialog" );
    //        
    //        if ( ItemSellDlg == null )
    //        {
    //            ItemSellDlg = createDialog( "ItemSellDialog", "UI Prefabs/Prefabs/Dialogs/ItemUI/ItemSellDialog" );
    //        }
    //        
    //        if ( ItemSellDlg != null )
    //        {
    //            NvItemSellDialog itemSellDlg = ItemSellDlg as NvItemSellDialog;
    //            
    //            itemSellDlg.mLblTitle.text = info.itemName;
    //            itemSellDlg.mImgIcon.spriteName = info.iconName;
    //            itemSellDlg.mImgIcon.transform.localScale = info.iconScale;
    //            itemSellDlg.mItemMaxNum = info.itemMaxNum;
    //            itemSellDlg.mItemPrice = info.itemPrice;
    //            itemSellDlg.mLblCoinNum.text = "" + info.itemPrice;
    //            itemSellDlg.mLblCoinName.text = info.coinName;
    //            
    //            itemSellDlg.eventOnEndModal += HandleDlgeventOnEndModal;
    //            itemSellDlg.doModal();
    //            m_baffle.enabled = true;
    //            
    //            if ( m_workingDialog != null )
    //            {
    //                m_workingDialog.closeDialog();
    //            }
    //            else
    //            {
    //                // disable dialog scene manager
    //                foreach ( NvUIBaseSceneManager UISceneMgr in m_UISceneMgrs )
    //                {
    //                    UISceneMgr.activate = false;
    //                }
    //            }
    //            
    //            m_workingDialog = itemSellDlg;
    //        }
    //        
    //        if ( ItemSellDlg != null && callback != null )
    //        {
    //            ItemSellDlg.eventOnEndModal += callback;
    //        }
    //        
    //        return ItemSellDlg;
    //    }
    //    public NvUIDialogBase showEquipSellDlg ( NvItemInfo info, NvUIDialogBase.OnEndModal callback )
    //    {
    //        if ( m_workingDialog != null )
    //        {
    //            if ( m_workingDialog is NvEquipSellDialog )
    //            {
    //                return m_workingDialog;
    //            }
    //            return null;
    //        }
    //        
    //        NvUIDialogBase EquipSellDlg = findDialog( "EquipSellDialog" );
    //
    //        if ( EquipSellDlg == null )
    //        {
    //            EquipSellDlg = createDialog( "EquipSellDialog", "UI Prefabs/Prefabs/Dialogs/EquipmentUI/EquipSellDialog" );
    //        }
    //        
    //        if ( EquipSellDlg != null )
    //        {
    //            NvEquipSellDialog equipSellDlg = EquipSellDlg as NvEquipSellDialog;
    //            
    //            equipSellDlg.mLblTitle.text = info.itemName;
    //            equipSellDlg.mImgIcon.spriteName = info.iconName;
    //            equipSellDlg.mImgIcon.transform.localScale = info.iconScale;
    //            equipSellDlg.mItemPrice = info.itemPrice;
    //            equipSellDlg.mLblCoinNum.text = "" + info.itemPrice;
    //            equipSellDlg.mLblCoinName.text = info.coinName;
    //            
    //            equipSellDlg.eventOnEndModal += HandleDlgeventOnEndModal;
    //            equipSellDlg.doModal();
    //            m_baffle.enabled = true;
    //            
    //            if ( m_workingDialog != null )
    //            {
    //                m_workingDialog.closeDialog();
    //            }
    //            else
    //            {
    //                // disable dialog scene manager
    //                foreach ( NvUIBaseSceneManager UISceneMgr in m_UISceneMgrs )
    //                {
    //                    UISceneMgr.activate = false;
    //                }
    //            }
    //            
    //            m_workingDialog = equipSellDlg;
    //        }
    //        
    //        if ( EquipSellDlg != null && callback != null )
    //        {
    //            EquipSellDlg.eventOnEndModal += callback;
    //        }
    //        
    //        return EquipSellDlg;
    //    }
    public NvUIDialogBase showEquipSmithResultDlg( string equipIconRes, 
		List<string> equipBaseInfo,  List<string> equipAttrInfo, NvUIDialogBase.OnEndModal callback)
    {
        if ( m_workingDialog != null )
        {
        //			if ( m_workingDialog is NvEquipSmithResultDialog )
        //			{
        //				return m_workingDialog;
        //			}
            return null;
        }

        NvUIDialogBase EquipSmithResultDlg = findDialog( "EquipSmithResultDlg" );

        if ( EquipSmithResultDlg == null )
        {
            EquipSmithResultDlg = createDialog( "EquipSmithResultDlg",
                "UI Prefabs/Prefabs/Dialogs/EquipmentUI/EquipSmithResultDialog" );
        }

        //		if ( EquipSmithResultDlg != null )
        //		{
        //			NvEquipSmithResultDialog equipSmithResultDlg = EquipSmithResultDlg as NvEquipSmithResultDialog;
        //
        //			equipSmithResultDlg.mItemIcon.spriteName = equipIconRes;
        //			equipSmithResultDlg.mItemIcon.transform.localScale = new Vector3 ( 64.0f, 64.0f, 0.0f );
        //
        //			for( int i = 0; i < equipSmithResultDlg.mItemBaseInfo.Count; i ++ )
        //			{
        //				equipSmithResultDlg.mItemBaseInfo[i].text = equipBaseInfo[i];
        //			}
        //			for( int i = 0; i < equipSmithResultDlg.mItemAttrInfo.Count; i ++ )
        //			{
        //				if ( i < equipAttrInfo.Count )
        //				{
        //					equipSmithResultDlg.mItemAttrInfo[i].text = equipAttrInfo[i];
        //				}
        //				else
        //				{
        //					equipSmithResultDlg.mItemAttrInfo[i].text = "";
        //				}
        //			}
        //
        //			equipSmithResultDlg.eventOnEndModal += HandleDlgeventOnEndModal;
        //			equipSmithResultDlg.doModal();
        //			m_baffle.enabled = true;
        //
        //			if ( m_workingDialog != null )
        //			{
        //				m_workingDialog.closeDialog();
        //			}
        //			else
        //			{
        //				// disable dialog scene manager
        //				foreach ( NvUIBaseSceneManager UISceneMgr in m_UISceneMgrs )
        //				{
        //					UISceneMgr.activate = false;
        //				}
        //			}
        //
        //			m_workingDialog = equipSmithResultDlg;
        //		}

        if ( EquipSmithResultDlg != null && callback != null )
        {
            EquipSmithResultDlg.eventOnEndModal += callback;
        }

        return EquipSmithResultDlg;
    }
Esempio n. 29
0
 private void OnDlgBeginEffect( NvUIDialogBase dlg )
 {
     if ( dlg.dialogEffect == NvUIDialogBase.EDialogEffect.eDE_OpenEffect )
     {
         activeTab(m_defaultIndex);
         mActiveDefaultTab = false;
     }
 }
    public NvUIDialogBase showMessageBox( string msg, string title = "",
		NvMessageBox.EMessageBoxStyle style = NvMessageBox.EMessageBoxStyle.eStyle_OkayOnly, 
		NvUIDialogBase.OnEndModal callback = null, bool closeIfOpened = false )
    {
        bool pendingMessagebox = false;

        if ( m_workingDialog != null && m_workingDialog.isOpened )
        {
            if ( !closeIfOpened )
            {
                return null;
            }
            else
            {
                pendingMessagebox = true;
                m_workingDialog.endModal(-1);
            }
        }

        NvUIDialogBase msgbox = findDialog( "MessageBox" );
        if ( msgbox == null )
        {
            msgbox = createDialog( "MessageBox", "UI Prefabs/Prefabs/Dialogs/MessageBox" );
        }

        if ( msgbox != null )
        {
            NvMessageBox messagebox = msgbox as NvMessageBox;

            if ( pendingMessagebox )
            {
                MsgBoxContext ctx = new MsgBoxContext();
                ctx.msgbox = messagebox;
                ctx.title = title;
                ctx.description = msg;
                ctx.style = style;
                ctx.callback = callback;

                StartCoroutine("OpenMessageBox", ctx);
            }
            else
            {
                messagebox.eventOnEndModal += HandleDlgeventOnEndModal;
                if ( callback != null )
                {
                    messagebox.eventOnEndModal += callback;
                }

                messagebox.description = msg;
                messagebox.title = title;
                messagebox.style = style;
                messagebox.doModal();

                m_workingDialog = messagebox;
                m_baffle.enabled = true;
            }
        }

        return msgbox;
    }