Beispiel #1
0
        private void StartDragAsync()
        {
            FlaxEngine.Scripting.LateUpdate -= StartDragAsync;

            if (StartDragAsyncWindow != null)
            {
                var win = StartDragAsyncWindow;
                StartDragAsyncWindow = null;

                // Check if has only one window docked and is floating
                if (_panel.ChildPanelsCount == 0 && _panel.TabsCount == 1 && _panel.IsFloating)
                {
                    // Create docking hint window but in an async manner
                    DockHintWindow.Create(_panel as FloatWindowDockPanel);
                }
                else
                {
                    // Select another tab
                    int index = _panel.GetTabIndex(win);
                    if (index == 0)
                    {
                        index = _panel.TabsCount;
                    }
                    _panel.SelectTab(index - 1);

                    // Create docking hint window
                    DockHintWindow.Create(win);
                }
            }
        }
Beispiel #2
0
        private void LoadPanel(XmlElement node, DockPanel panel)
        {
            int selectedTab = int.Parse(node.GetAttribute("SelectedTab"), CultureInfo.InvariantCulture);

            // Load docked windows
            var windows = node.SelectNodes("Window");

            if (windows != null)
            {
                foreach (XmlElement child in windows)
                {
                    if (child == null)
                    {
                        continue;
                    }

                    var typename = child.GetAttribute("Typename");
                    var window   = GetWindow(typename);
                    if (window != null)
                    {
                        if (child.SelectSingleNode("Data") is XmlElement data)
                        {
                            window.OnLayoutDeserialize(data);
                        }
                        else
                        {
                            window.OnLayoutDeserialize();
                        }

                        window.Show(DockState.DockFill, panel);
                    }
                }
            }

            // Load child panels
            var panels = node.SelectNodes("Panel");

            if (panels != null)
            {
                foreach (XmlElement child in panels)
                {
                    if (child == null)
                    {
                        continue;
                    }

                    // Create child panel
                    DockState state         = (DockState)int.Parse(child.GetAttribute("DockState"), CultureInfo.InvariantCulture);
                    float     splitterValue = float.Parse(child.GetAttribute("SplitterValue"), CultureInfo.InvariantCulture);
                    var       p             = panel.CreateChildPanel(state, splitterValue);

                    LoadPanel(child, p);

                    // Check if panel has no docked window (due to loading problems or sth)
                    if (p.TabsCount == 0 && p.ChildPanelsCount == 0)
                    {
                        // Remove empty panel
                        Editor.LogWarning("Empty panel inside layout.");
                        p.RemoveIt();
                    }
                }
            }

            panel.SelectTab(selectedTab);
        }