Exemplo n.º 1
0
    void OnViewButtonClick(PrimaryView a_clickedView)
    {
        bool l_onlyAvailable = false;

        foreach (var l_view in i_primaryPanels)
        {
            if (l_view != null)
            {
                PrimaryView l_viewC = l_view.GetComponent <PrimaryView>();
                if (l_viewC == a_clickedView)
                {
                    continue;
                }
                l_onlyAvailable = l_onlyAvailable || l_viewC.isActiveAndEnabled;
            }
        }

        if (!l_onlyAvailable)
        {
            return;
        }

        if (a_clickedView.isActiveAndEnabled)
        {
            a_clickedView.SetActiveAndSelect(false);
        }
        else
        {
            a_clickedView.SetActiveAndSelect(true);
        }
        ReArrangeLayout(firstView != null ? (firstView.isActiveAndEnabled ? firstView : null) : null,
                        secondView != null ? (secondView.isActiveAndEnabled ? secondView : null) : null,
                        thirdView != null ? (thirdView.isActiveAndEnabled ? thirdView : null) : null,
                        fourthView != null ? (fourthView.isActiveAndEnabled ? fourthView : null) : null);
    }
Exemplo n.º 2
0
    private void DeactivateSecondView()
    {
        if (firstView.isActiveAndEnabled && thirdView.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);
            RemoveSubscribers(threeViewLayout12, true);
            RemoveSubscribers(threeViewLayout23, true);

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

            parentPanel.OnRightPanelResize.RemoveAllListeners();
            parentPanel.OnRightPanelResize.AddListener(twoViewHorizontalLayout.OnParentPanelResize);
            secondView.SetActiveAndSelect(false);
            twoViewHorizontalLayout.AllignPanelsWithSplitter();
        }
        else if (firstView.isActiveAndEnabled)
        {
            DeactivateSlittedPanels();
            RemoveSubscribers(twoViewVerticalLayout, true);
            parentPanel.OnRightPanelResize.RemoveAllListeners();
            parentPanel.OnRightPanelResize.AddListener(firstView.OnParentPanelResize);
            firstView.transform.SetParent(parentPanel.rightPanel.transform, false);
            secondView.SetActiveAndSelect(false);
            firstView.SetActiveAndSelect(true);
            parentPanel.AllignPanelsWithSplitter();
        }
        else if (thirdView.isActiveAndEnabled)
        {
            DeactivateSlittedPanels();
            RemoveSubscribers(twoViewHorizontalLayout, true);
            parentPanel.OnRightPanelResize.RemoveAllListeners();
            parentPanel.OnRightPanelResize.AddListener(thirdView.OnParentPanelResize);
            thirdView.transform.SetParent(parentPanel.rightPanel.transform, false);
            secondView.SetActiveAndSelect(false);
            thirdView.SetActiveAndSelect(true);
            parentPanel.AllignPanelsWithSplitter();
        }
    }