void CreateHorizontalWithVertBot(PrimaryView a_top, PrimaryView a_botL, PrimaryView a_botR)
    {
        DeleteSecondaryPanels();
        parentPanel.OnRightPanelResize.RemoveAllListeners();

        PanelWithHorizontalSplitter l_panelHS = Instantiate(PanelWithHorizontalSplitterPrefab).GetComponent <PanelWithHorizontalSplitter>();

        l_panelHS.transform.SetParent(parentPanel.rightPanel, false);
        parentPanel.OnRightPanelResize.AddListener(l_panelHS.OnParentPanelResize);
        l_panelHS.MoveSplitterToCenter();

        a_top.transform.SetParent(l_panelHS.topPanel.transform, false);
        l_panelHS.OnTopPanelResize.AddListener(a_top.OnParentPanelResize);

        PanelWithVerticalSplitter l_panelVS = Instantiate(PanelWithVerticalSplitterPrefab).GetComponent <PanelWithVerticalSplitter>();

        l_panelVS.transform.SetParent(l_panelHS.bottomPanel.transform, false);
        l_panelVS.MoveSplitterToCenter();
        l_panelHS.OnBottomPanelResize.AddListener(l_panelVS.OnParentPanelResize);

        a_botL.transform.SetParent(l_panelVS.leftPanel.transform, false);
        a_botR.transform.SetParent(l_panelVS.rightPanel.transform, false);
        l_panelVS.OnLeftPanelResize.AddListener(a_botL.OnParentPanelResize);
        l_panelVS.OnRightPanelResize.AddListener(a_botR.OnParentPanelResize);

        parentPanel.AllignPanelsWithSplitter();
    }
    void CreateTwoVertical(PrimaryView a_left, PrimaryView a_right)
    {
        DeleteSecondaryPanels();
        parentPanel.OnRightPanelResize.RemoveAllListeners();
        PanelWithVerticalSplitter l_panelVS = Instantiate(PanelWithVerticalSplitterPrefab).GetComponent <PanelWithVerticalSplitter>();

        l_panelVS.transform.SetParent(parentPanel.rightPanel, false);
        parentPanel.OnRightPanelResize.AddListener(l_panelVS.OnParentPanelResize);
        l_panelVS.MoveSplitterToCenter();
        a_left.transform.SetParent(l_panelVS.leftPanel.transform, false);
        a_right.transform.SetParent(l_panelVS.rightPanel.transform, false);
        l_panelVS.OnLeftPanelResize.AddListener(a_left.OnParentPanelResize);
        l_panelVS.OnRightPanelResize.AddListener(a_right.OnParentPanelResize);
        parentPanel.AllignPanelsWithSplitter();
    }
Example #3
0
 private void RemoveSubscribers(PanelWithVerticalSplitter a_parent, bool a_removeFromChildren)
 {
     a_parent.OnLeftPanelResize.RemoveAllListeners();
     a_parent.OnRightPanelResize.RemoveAllListeners();
     if (a_removeFromChildren)
     {
         foreach (var l_child in a_parent.GetComponentsInChildren <PanelWithHorizontalSplitter>())
         {
             RemoveSubscribers(l_child, false);
         }
         foreach (var l_child in a_parent.GetComponentsInChildren <PanelWithVerticalSplitter>())
         {
             RemoveSubscribers(l_child, false);
         }
     }
 }
Example #4
0
    private void ActivateThirdView()
    {
        if (secondView.isActiveAndEnabled && firstView.isActiveAndEnabled)
        {
            thirdView.transform.SetParent(threeViewLayout12.topPanel.transform, false);
            PanelWithVerticalSplitter bottomPanel = threeViewLayout12.bottomPanel.GetComponentInChildren <PanelWithVerticalSplitter>();
            firstView.transform.SetParent(bottomPanel.leftPanel.transform, false);
            secondView.transform.SetParent(bottomPanel.rightPanel.transform, false);

            RemoveSubscribers(twoViewVerticalLayout, true);

            threeViewLayout12.OnTopPanelResize.AddListener(thirdView.OnParentPanelResize);
            threeViewLayout12.OnBottomPanelResize.AddListener(bottomPanel.OnParentPanelResize);
            bottomPanel.OnLeftPanelResize.AddListener(firstView.OnParentPanelResize);
            bottomPanel.OnRightPanelResize.AddListener(secondView.OnParentPanelResize);

            parentPanel.OnRightPanelResize.RemoveAllListeners();
            parentPanel.OnRightPanelResize.AddListener(threeViewLayout12.OnParentPanelResize);

            DeactivateSlittedPanels();

            thirdView.SetActiveAndSelect(true);
            threeViewLayout12.gameObject.SetActive(true);

            bottomPanel.splitter.transform.position = twoViewVerticalLayout.splitter.transform.position;
            threeViewLayout12.MoveSplitterToCenter();
            bottomPanel.MoveSplitterToCenter();

            threeViewLayout12.AllignPanelsWithSplitter();
        }
        else if (secondView.isActiveAndEnabled)
        {
            thirdView.transform.SetParent(twoViewHorizontalLayout.topPanel.transform, false);
            secondView.transform.SetParent(twoViewHorizontalLayout.bottomPanel.transform, false);

            thirdView.SetActiveAndSelect(true);
            DeactivateSlittedPanels();
            twoViewHorizontalLayout.gameObject.SetActive(true);

            RemoveSubscribers(twoViewVerticalLayout, true);

            twoViewHorizontalLayout.OnTopPanelResize.AddListener(thirdView.OnParentPanelResize);
            twoViewHorizontalLayout.OnBottomPanelResize.AddListener(secondView.OnParentPanelResize);

            parentPanel.OnRightPanelResize.RemoveAllListeners();
            parentPanel.OnRightPanelResize.AddListener(twoViewHorizontalLayout.OnParentPanelResize);

            twoViewHorizontalLayout.MoveSplitterToCenter();
            twoViewHorizontalLayout.AllignPanelsWithSplitter();
        }
        else if (firstView.isActiveAndEnabled)
        {
            thirdView.transform.SetParent(twoViewHorizontalLayout.topPanel.transform, false);
            firstView.transform.SetParent(twoViewHorizontalLayout.bottomPanel.transform, false);

            thirdView.SetActiveAndSelect(true);
            DeactivateSlittedPanels();
            twoViewHorizontalLayout.gameObject.SetActive(true);

            RemoveSubscribers(twoViewHorizontalLayout, true);

            twoViewHorizontalLayout.OnTopPanelResize.AddListener(thirdView.OnParentPanelResize);
            twoViewHorizontalLayout.OnBottomPanelResize.AddListener(firstView.OnParentPanelResize);

            parentPanel.OnRightPanelResize.RemoveAllListeners();
            parentPanel.OnRightPanelResize.AddListener(twoViewHorizontalLayout.OnParentPanelResize);

            twoViewHorizontalLayout.MoveSplitterToCenter();
            twoViewHorizontalLayout.AllignPanelsWithSplitter();
        }
    }