Exemple #1
0
        private void DrawRelationWindowSelectionButton(string buttonText, IWindowRenderer windowRenderer)
        {
            if (currentWindowRenderer == windowRenderer)
            {
                GUI.color = CodeControlEditorStyles.MainColor;
            }
            else
            {
                GUI.color = Color.white;
            }

            if (GUILayout.Button(buttonText, GUILayout.Height(TopBarHeight)))
            {
                if (Event.current.button == 1)
                {
                    windowRenderer.ShowContextMenu();
                }
                else
                {
                    WindowOffset          = WindowPadding;
                    currentWindowRenderer = windowRenderer;
                    EditorPrefs.SetString(EditorPrefsSelectedWindow, currentWindowRenderer.GetType().ToString());
                }
            }
            GUI.color = Color.white;
        }
Exemple #2
0
        private static void Init()
        {
            if (instance)
            {
                Deinit();
            }
            hasInit  = true;
            instance = EditorWindow.GetWindow(typeof(CodeControlMonitorWindow)) as CodeControlMonitorWindow;

            //instance.title = "Code Monitors";
            instance.titleContent.text = "Code Monitors";
            instance.minSize           = new Vector2(320, 200);

            previousTimeSinceStartup = EditorApplication.timeSinceStartup;

            windowRenderers = new List <IWindowRenderer>();
            windowRenderers.Add(new MessageFlowRenderer());
            windowRenderers.Add(new ModelRelationsRenderer());
            windowRenderers.Add(new ModelStructuresRenderer());

            WindowOffset = WindowPadding;

            if (!backgroundTexture)
            {
                backgroundTexture           = new Texture2D(1, 1, TextureFormat.ARGB32, true);
                backgroundTexture.hideFlags = HideFlags.DontSave;
                backgroundTexture.SetPixel(0, 1, new Color(0.05f, 0.05f, 0.05f));
                backgroundTexture.Apply();
            }

            string selectedWindow = EditorPrefs.GetString(EditorPrefsSelectedWindow);

            currentWindowRenderer = windowRenderers.Find(x => x.GetType().ToString() == selectedWindow);
            if (currentWindowRenderer == null)
            {
                currentWindowRenderer = windowRenderers[0];
                EditorPrefs.SetString(EditorPrefsSelectedWindow, currentWindowRenderer.GetType().ToString());
            }
        }