Esempio n. 1
0
        public override void Setup()
        {
            // Initial bounds must be set before the base.Setup() is called
            minBounds = new Vector3(0.375f, k_MinBounds.y, 0.3f);
            m_CustomStartingBounds = new Vector3(0.375f, k_MinBounds.y, 0.6f);

            base.Setup();
            var contentPrefab = ObjectUtils.Instantiate(m_ContentPrefab, m_WorkspaceUI.sceneContainer, false);

            m_InspectorUI = contentPrefab.GetComponent <InspectorUI>();

            m_LockUI = ObjectUtils.Instantiate(m_LockPrefab, m_WorkspaceUI.frontPanel, false).GetComponentInChildren <LockUI>();
            connectInterfaces(m_LockUI);
            m_LockUI.lockButtonPressed  += SetIsLocked;
            EditorApplication.delayCall += m_LockUI.Setup;             // Need to write stencilRef after WorkspaceButton does it

            var listView = m_InspectorUI.listView;

            connectInterfaces(listView);
            listView.data              = new List <InspectorData>();
            listView.arraySizeChanged += OnArraySizeChanged;

            var scrollHandle = m_InspectorUI.scrollHandle;

            scrollHandle.dragStarted  += OnScrollDragStarted;
            scrollHandle.dragging     += OnScrollDragging;
            scrollHandle.dragEnded    += OnScrollDragEnded;
            scrollHandle.hoverStarted += OnScrollHoverStarted;
            scrollHandle.hoverEnded   += OnScrollHoverEnded;

            contentBounds = new Bounds(Vector3.zero, m_CustomStartingBounds.Value);

            var scrollHandleTransform = m_InspectorUI.scrollHandle.transform;

            scrollHandleTransform.SetParent(m_WorkspaceUI.topFaceContainer);
            scrollHandleTransform.localScale    = new Vector3(1.03f, 0.02f, 1.02f);        // Extra space for scrolling
            scrollHandleTransform.localPosition = new Vector3(0f, -0.01f, 0f);             // Offset from content for collision purposes

            if (Selection.activeGameObject)
            {
                OnSelectionChanged();
            }

            Undo.postprocessModifications += OnPostprocessModifications;
            Undo.undoRedoPerformed        += OnUndoRedo;
        }