Ejemplo n.º 1
0
    protected static void SwapViews(View a, View b)
    {
        var containerA = a.GetPropertyValue <ContainerWindow>("window");
        var containerB = b.GetPropertyValue <ContainerWindow>("window");

        SetFreezeContainer(containerA, true);
        SetFreezeContainer(containerB, true);

        containerA.SetPropertyValue("rootView", b);
        containerB.SetPropertyValue("rootView", a);

        SetFreezeContainer(containerA, true);
        SetFreezeContainer(containerB, true);
    }
Ejemplo n.º 2
0
        protected void SwapViews(View a, View b)
        {
            var containerA = a.GetPropertyValue <ContainerWindow>("window");
            var containerB = b.GetPropertyValue <ContainerWindow>("window");

            SetFreezeContainer(containerA, true);
            SetFreezeContainer(containerB, true);

            Logger.Debug("Swapping views {0} and {1} @ {2} and {3}", a, b, containerA, containerB);

            containerA.SetPropertyValue("rootView", b);
            containerB.SetPropertyValue("rootView", a);

            SetFreezeContainer(containerA, true);
            SetFreezeContainer(containerB, true);
        }
Ejemplo n.º 3
0
        /// <summary>Create a new instance and automatically assigns the window, view and container.</summary>
        public ViewPyramid(ScriptableObject viewOrWindow)
        {
            if (!viewOrWindow)
            {
                m_window    = null;
                m_view      = null;
                m_container = null;
            }
            else if (viewOrWindow.IsOfType(typeof(EditorWindow)))
            {
                m_window    = viewOrWindow as EditorWindow;
                m_view      = m_window.GetFieldValue <View>("m_Parent");
                m_container = m_view.GetPropertyValue <ContainerWindow>("window");
            }
            else if (viewOrWindow.IsOfType(Types.View))
            {
                m_window    = null;
                m_view      = viewOrWindow;
                m_container = m_view.GetPropertyValue <ContainerWindow>("window");
            }
            else if (viewOrWindow.IsOfType(Types.ContainerWindow))
            {
                m_window    = null;
                m_view      = viewOrWindow.GetPropertyValue <ContainerWindow>("rootView");
                m_container = viewOrWindow;
            }
            else
            {
                throw new ArgumentException("Param must be of type EditorWindow, View or ContainerWindow", "viewOrWindow");
            }

            if (!m_window && m_view && m_view.IsOfType(Types.HostView))
            {
                m_window = m_view.GetPropertyValue <EditorWindow>("actualView");
            }

            m_windowInstanceID    = m_window ? m_window.GetInstanceID() : 0;
            m_viewInstanceID      = m_view ? m_view.GetInstanceID() : 0;
            m_containerInstanceID = m_container ? m_container.GetInstanceID() : 0;
        }