Ejemplo n.º 1
0
        /// <summary>
        /// Register the Window or Window Group
        /// </summary>
        /// <param name="path"></param>
        /// <param name="window"></param>
        public void RegisterWindow(string path, IWindow window)
        {
            int pos = path.IndexOf('/');

            if (pos < 0 || pos >= path.Length - 1)
            {
                if (GetSpecificWindow(path) != null)
                {
                    Debug.LogWarning(path + " Window Already Registered");
                    return;
                }

                m_windows.Add(new KeyValuePair <string, IWindow>(path, window));
                RefreshWindowNames();
            }
            else
            {
                string      windowGroupName = path.Substring(0, pos);
                string      leftPath        = path.Substring(pos + 1);
                WindowGroup windowGroup     = (WindowGroup)GetSpecificWindow(windowGroupName);
                if (windowGroup == null)
                {
                    if (GetSpecificWindow(windowGroupName) != null)
                    {
                        Debug.LogWarning(path + " Window Group Already Registered");
                    }
                    windowGroup = new WindowGroup();
                    m_windows.Add(new KeyValuePair <string, IWindow>(windowGroupName, windowGroup));
                    RefreshWindowNames();
                }
                windowGroup.RegisterWindow(leftPath, window);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Select the window or window groups
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public bool SelectWindow(string path)
        {
            if (string.IsNullOrEmpty(path))
            {
                return(false);
            }

            int pos = path.IndexOf('/');

            if (pos < 0 || pos >= path.Length - 1)
            {
                return(SelectSpecificWindow(path));
            }

            string      windowGroupName = path.Substring(0, pos);
            string      leftPath        = path.Substring(pos + 1);
            WindowGroup windowGroup     = (WindowGroup)GetSpecificWindow(windowGroupName);

            if (windowGroup == null || !SelectSpecificWindow(windowGroupName))
            {
                return(false);
            }

            return(windowGroup.SelectWindow(leftPath));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Get the window or windows groups
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public IWindow GetWindow(string path)
        {
            if (string.IsNullOrEmpty(path))
            {
                return(null);
            }

            int pos = path.IndexOf('/');

            if (pos < 0 || pos >= path.Length - 1)
            {
                return(GetSpecificWindow(path)); // get the window
            }

            string      windowGroupName = path.Substring(0, pos);
            string      leftPath        = path.Substring(pos + 1);
            WindowGroup WindowGroup     = (WindowGroup)GetSpecificWindow(windowGroupName); // get the window group

            if (WindowGroup == null)
            {
                return(null);
            }

            return(WindowGroup.GetWindow(leftPath));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// draw the windows from window group
        /// </summary>
        /// <param name="debuggerWindowGroup"></param>
        private void DrawDebuggerWindowGroup(WindowGroup debuggerWindowGroup)
        {
            if (debuggerWindowGroup == null)
            {
                return;
            }

            List <string> names = new List <string>();

            string[] debuggerWindowNames = debuggerWindowGroup.GetWindowNames();
            for (int i = 0; i < debuggerWindowNames.Length; i++)
            {
                names.Add(string.Format("<b>{0}</b>", debuggerWindowNames[i]));
            }

            if (debuggerWindowGroup == m_debuggerManager.DebuggerWindowRoot)
            {
                names.Add("<b>Close</b>");
            }

            int toolbarIndex = GUILayout.Toolbar(debuggerWindowGroup.SelectedIndex, names.ToArray(), GUILayout.Height(30f), GUILayout.MaxWidth(Screen.width));

            if (toolbarIndex >= debuggerWindowGroup.WindowCount)
            {
                ShowFullWindow = false;
                return;
            }

            if (debuggerWindowGroup.SelectedIndex != toolbarIndex)
            {
                debuggerWindowGroup.SelectedWindow.OnWindowExit();
                debuggerWindowGroup.SelectedIndex = toolbarIndex;
                debuggerWindowGroup.SelectedWindow.OnWindowEnter();
            }

            WindowGroup subDebuggerWindowGroup = debuggerWindowGroup.SelectedWindow as WindowGroup;

            if (subDebuggerWindowGroup != null)
            {
                DrawDebuggerWindowGroup(subDebuggerWindowGroup);
            }

            if (debuggerWindowGroup.SelectedWindow != null)
            {
                debuggerWindowGroup.SelectedWindow.OnWindowDraw();
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// constructor
 /// </summary>
 public DebuggerManager()
 {
     m_debuggerWindowRoot = new WindowGroup();
 }