Example #1
0
        private void OnGUI()
        {
            if (windowIDs.Count == 0)
            {
                return;
            }

            GUISkin old = GUI.skin;

            GUI.skin = WindowManager.Skin;

            GUI.depth = WindowManager.START_DEPTH;
            GUI.color = Color.black.Alpha(0.5f);
            GUI.Box(screenRect, string.Empty, GUI.skin.GetStyle("background"));
            GUI.color = Color.white;
            GUI.depth--;

            foreach (string id in windowIDs)
            {
                SystemWindow window = WindowManager.WINDOWS[id];

                EventType current = EventType.Ignore;
                if (!id.Equals(lastID))
                {
                    current = Event.current.type;
                    if (current != EventType.Layout && current != EventType.Repaint && current != EventType.Used)
                    {
                        Event.current.type = EventType.Ignore;
                    }

                    GUI.color = Color.gray;
                }

                GUILayout.BeginArea(window.Rect, window.Title, GUI.skin.window);
                window.Draw();
                GUILayout.EndArea();
                window.DrawUnbound();

                GUI.depth--;

                GUI.color = Color.white;
                if (current != EventType.Ignore)
                {
                    Event.current.type = current;
                }
            }

            GUI.skin = old;
        }