Ejemplo n.º 1
0
 private static void Deinit()
 {
     instance = null;
     if (windowRenderers == null)
     {
         return;
     }
     foreach (IWindowRenderer windowRenderer in windowRenderers)
     {
         windowRenderer.Deinit();
     }
 }
Ejemplo n.º 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());
            }
        }