Beispiel #1
0
        private void MainWindow(int id)
        {
            GUI.DragWindow(new Rect(0, 0, MainRect.width - 90, 20));

            if (GUIHelper.Button(new Rect(MainRect.width - 90, 2, 80, 20), $"Hide ({ModConfig.Instance.Main_Menu_Toggle})"))
            {
                ExplorerCore.ShowMenu = false;
                return;
            }

            GUIHelper.BeginArea(new Rect(5, 25, MainRect.width - 10, MainRect.height - 35), GUI.skin.box);

            MainHeader();

            var page = Pages[m_currentPage];

            page.scroll = GUIHelper.BeginScrollView(page.scroll);

            page.DrawWindow();

            GUIHelper.EndScrollView();

            MainRect = ResizeDrag.ResizeWindow(MainRect, MainWindowID);

            GUIHelper.EndArea();
        }
Beispiel #2
0
        public override void WindowFunction(int windowID)
        {
            try
            {
                GUI.DragWindow(new Rect(0, 0, m_rect.width - 90, 20));
                if (GUIHelper.Button(new Rect(m_rect.width - 90, 2, 80, 20), "<color=red>Close All</color>"))
                {
                    foreach (var window in WindowManager.Windows)
                    {
                        window.DestroyWindow();
                    }
                    return;
                }

                GUIHelper.BeginArea(new Rect(5, 25, m_rect.width - 10, m_rect.height - 35), GUI.skin.box);

                GUIHelper.BeginVertical(GUIContent.none, GUI.skin.box, null);
                GUIHelper.BeginHorizontal(new GUILayoutOption[0]);
                GUI.skin.button.alignment = TextAnchor.MiddleLeft;
                int tabPerRow = (int)Math.Floor(m_rect.width / 238);
                int rowCount  = 0;
                for (int i = 0; i < WindowManager.Windows.Count; i++)
                {
                    var window = WindowManager.Windows[i];

                    // Prevent trying to draw destroyed UnityEngine.Objects
                    // before the WindowManager removes them.
                    if (window.Target is UnityEngine.Object uObj && !uObj)
                    {
                        continue;
                    }

                    if (rowCount >= tabPerRow)
                    {
                        rowCount = 0;
                        GUILayout.EndHorizontal();
                        GUIHelper.BeginHorizontal(new GUILayoutOption[0]);
                    }
                    rowCount++;

                    bool   focused = i == TargetTabID;
                    string color   = focused ? "<color=lime>" : "<color=orange>";
                    GUI.color = focused ? Color.green : Color.white;

                    if (GUILayout.Button(color + window.Title + "</color>", new GUILayoutOption[] { GUILayout.Width(200) }))
                    {
                        TargetTabID = i;
                    }
                    if (GUILayout.Button("<color=red><b>X</b></color>", new GUILayoutOption[] { GUILayout.Width(22) }))
                    {
                        window.DestroyWindow();
                    }
                }
                GUI.color = Color.white;
                GUILayout.EndHorizontal();
                GUILayout.EndVertical();
                GUI.skin.button.alignment = TextAnchor.MiddleCenter;

                m_targetWindow.WindowFunction(m_targetWindow.windowID);

                m_rect = ResizeDrag.ResizeWindow(m_rect, windowID);

                GUIHelper.EndArea();
            }
            catch (Exception e)
            {
                if (!e.Message.Contains("in a group with only"))
                {
                    ExplorerCore.Log("Exception drawing Tab View window: " + e.GetType() + ", " + e.Message);
                    ExplorerCore.Log(e.StackTrace);
                }
            }
        }
Beispiel #3
0
        public override void WindowFunction(int windowID)
        {
            if (pendingDestroy)
            {
                return;
            }

            try
            {
                var rect = WindowManager.TabView ? TabViewWindow.Instance.m_rect : this.m_rect;

                if (!WindowManager.TabView)
                {
                    Header();
                    GUIHelper.BeginArea(new Rect(5, 25, rect.width - 10, rect.height - 35), GUI.skin.box);
                }

                scroll = GUIHelper.BeginScrollView(scroll);

                GUIHelper.BeginHorizontal(new GUILayoutOption[0]);
                GUILayout.Label("Scene: <color=cyan>" + (m_scene == "" ? "n/a" : m_scene) + "</color>", new GUILayoutOption[0]);
                if (m_scene == UnityHelpers.ActiveSceneName)
                {
                    if (GUILayout.Button("<color=#00FF00>Send to Scene View</color>", new GUILayoutOption[] { GUILayout.Width(150) }))
                    {
                        ScenePage.Instance.SetTransformTarget(TargetGO.transform);
                        MainMenu.SetCurrentPage(0);
                    }
                }
                if (GUILayout.Button("Reflection Inspect", new GUILayoutOption[] { GUILayout.Width(150) }))
                {
                    WindowManager.InspectObject(Target, out _, true);
                }
                GUILayout.EndHorizontal();

                GUIHelper.BeginHorizontal(new GUILayoutOption[0]);
                GUILayout.Label("Path:", new GUILayoutOption[] { GUILayout.Width(50) });
                string pathlabel = TargetGO.transform.GetGameObjectPath();
                if (TargetGO.transform.parent != null)
                {
                    if (GUILayout.Button("<-", new GUILayoutOption[] { GUILayout.Width(35) }))
                    {
                        InspectGameObject(TargetGO.transform.parent);
                    }
                }
                GUIHelper.TextArea(pathlabel, new GUILayoutOption[0]);
                GUILayout.EndHorizontal();

                GUIHelper.BeginHorizontal(new GUILayoutOption[0]);
                GUILayout.Label("Name:", new GUILayoutOption[] { GUILayout.Width(50) });
                GUIHelper.TextArea(m_name, new GUILayoutOption[0]);
                GUILayout.EndHorizontal();

                LayerControls();

                // --- Horizontal Columns section ---
                GUIHelper.BeginHorizontal(new GUILayoutOption[0]);

                GUIHelper.BeginVertical(new GUILayoutOption[] { GUILayout.Width(rect.width / 2 - 17) });
                TransformList(rect);
                GUILayout.EndVertical();

                GUIHelper.BeginVertical(new GUILayoutOption[] { GUILayout.Width(rect.width / 2 - 17) });
                ComponentList(rect);
                GUILayout.EndVertical();

                GUILayout.EndHorizontal(); // end horiz columns

                GameObjectControls();

                GUIHelper.EndScrollView();

                if (!WindowManager.TabView)
                {
                    m_rect = ResizeDrag.ResizeWindow(rect, windowID);

                    GUIHelper.EndArea();
                }
            }
            catch (Exception e)
            {
                DestroyOnException(e);
            }
        }