private void Awake()
    {
        m_gameUIManager = Singlton.getInstance("NvGameUIManager") as NvGameUIManager;
        m_sceneRoot     = m_gameUIManager.GameUILayoutCameraLink;

        AwakeImpl();
    }
Пример #2
0
    protected override void AwakeImpl()
    {
        base.AwakeImpl();

        m_ViewSpriteTr = transform.FindChild("ListBaseSprite");
        m_ViewScale    = m_ViewSpriteTr.localScale;
        m_TopLeft      = transform.FindChild("ListBaseSprite/TopLeft");
        m_BottomRight  = transform.FindChild("ListBaseSprite/BottomRight");
        //m_DragCamera = transform.FindChild("ListBaseSprite").GetComponent<UIDragCamera>();
        NvGameUIManager mgr = Singlton.getInstance("NvGameUIManager") as NvGameUIManager;

        m_UICamera = mgr.GameUICamera;

        m_ListPrefab = Resources.Load("UI Prefabs/Prefabs/Controls/UIListView") as GameObject;
        m_ListView   = GameObject.Instantiate(m_ListPrefab) as GameObject;
        //rename list view
        m_ListView.name = listName;
        Transform listviewCamera = m_ListView.transform.FindChild("UIListViewCamera");

        //Transform listviewCamera = m_ListView.transform.FindChild("UIListViewCamera" );
        //m_ListViewCamera = listviewCamera.GetComponent<UIDraggableCamera>();
        //rename list view draggable camera
        //m_ListViewCamera.name = listName + "Camera";
        //set draggable camera to drag camera
        //m_DragCamera.draggableCamera = m_ListViewCamera;
        m_ListViewViewport = listviewCamera.GetComponent <UIViewport>();
        //set viewport camera
        m_ListViewViewport.sourceCamera = m_UICamera;
        m_ListViewLink            = m_ListView.transform.FindChild("Link");
        m_ListViewLink.localScale = Utility.GetScreenRatio();
        Transform listOffset = m_ListView.transform.FindChild("Link/Anchor/ListOffset");

        listOffset.transform.localPosition = new Vector3(dragCameraDistance, dragCameraDistance, listOffset.transform.localPosition.z);
        m_ListViewTable  = listOffset.GetComponent <UITable>();
        m_listViewAnchor = m_ListView.transform.FindChild("Link/Anchor").GetComponent <UIAnchor>();
        //m_DragPanel = m_ListView.transform.FindChild("Link/Anchor/ListOffset").GetComponent<UIDraggablePanel>();
        //set ui layer camera to list view anchor
        m_listViewAnchor.uiCamera = m_UICamera;
        //set slider bar
        if (horizontalScrollBar != null)
        {
            m_horizontalScrollBar = horizontalScrollBar.GetComponent <UIScrollBar>();
            //m_DragPanel.scale = new Vector3( 1.0f, 0.0f, 0.0f );
            //m_DragPanel.horizontalScrollBar = m_horizontalScrollBar;
        }
        if (verticalScrollBar != null)
        {
            m_verticalScrollBar = verticalScrollBar.GetComponent <UIScrollBar>();
            //m_DragPanel.scale = new Vector3( 0.0f, 1.0f, 0.0f );
            //m_DragPanel.verticalScrollBar = m_verticalScrollBar;
        }
    }
//	private bool revertVisibleCallback( Transform tr, object args )
//	{
//		NvUIBase elem = tr.GetComponent<NvUIBase>();
//		if ( elem != null )
//		{
//			elem.revertVisible();
//			return true;
//		}
//		else
//		{
//			bool flag = revertVisibleFromTable( tr );
//			Debug.Log(">>>>>>>>>>>>>>>>>>>>>> revert visible (" + tr.name + ") = " + flag );
//			saveVisibleToTable( tr, flag );
//			tr.gameObject.active = flag;
//		}
//
//		return false;
//	}
//
//	public override void revertVisible()
//	{
//		base.revertVisible();
//		enumWidgets( revertVisibleCallback );
//	}
//
//	private bool revertVisibleFromTable( Transform obj )
//	{
//		if ( m_visibleTable.ContainsKey( obj ) )
//		{
//			return m_visibleTable[obj];
//		}
//		return true;
//	}
//
//	private void saveVisibleToTable( Transform obj, bool flag )
//	{
//		if ( obj != null )
//		{
//			m_visibleTable[ obj ] = flag;
//		}
//	}

    private void OpenOrCloseSceneCam(bool flag)
    {
        if (m_closeSceneCamWhenOpened)
        {
            NvGameUIManager mgr = Singlton.getInstance("NvGameUIManager") as NvGameUIManager;
            if (mgr.CachedMainCamera != null)
            {
                mgr.CachedMainCamera.enabled = flag;
            }
        }

        if (m_CloseMenuWhenOpen)
        {
            Utility.SetMenuBarVisible(flag);
        }
    }