Esempio n. 1
0
        private void OnGUI()
        {
            if (thisWindow == null)
            {
                GetCurrentWindow();
                return;
            }

            //Get current event
            Event e = ProcessEvents();

            if (isLoaded)
            {
                GUILayout.BeginArea(new Rect(MA_TextureAtlasserProUtils.VIEWOFFSET, MA_TextureAtlasserProUtils.VIEWOFFSET, position.width - (MA_TextureAtlasserProUtils.VIEWOFFSET * 2), position.height - (MA_TextureAtlasserProUtils.VIEWOFFSET * 2)));
                GUILayout.BeginVertical();


                if (curWindow != null && curWindow.textureAtlas != null)
                {
                    //Export options
                    GUILayout.Box("Note: No custom export options right now.. :<", EditorStyles.helpBox);

                    //Export
                    GUILayout.BeginVertical(EditorStyles.helpBox);

                    GUILayout.Label("Meshes: OBJ | Textures: PNG");
                    if (GUILayout.Button("Export Atlas", GUILayout.ExpandWidth(true), GUILayout.Height(37)))
                    {
                        MA_TextureAtlasserProUtils.ExportAtlas(curWindow.textureAtlas);
                    }

                    GUILayout.EndVertical();
                }
                else if (curWindow == null)
                {
                    GUI.backgroundColor = Color.red;
                    GUILayout.Box("Error: Link with the Texture Atlas Editor lost!", EditorStyles.helpBox);
                    if (GUILayout.Button("Link Atlas Editor", GUILayout.ExpandWidth(true), GUILayout.Height(37)))
                    {
                        curWindow = (MA_TextureAtlasserProWindow)EditorWindow.GetWindow <MA_TextureAtlasserProWindow>();
                    }
                    GUI.backgroundColor = Color.white;
                }
                else if (curWindow.textureAtlas == null)
                {
                    GUI.backgroundColor = Color.red;
                    GUILayout.Box("Error: No Texture Atlas found make sure to open one!", EditorStyles.helpBox);
                    GUI.backgroundColor = Color.white;
                }

                GUILayout.EndVertical();
                GUILayout.EndArea();
            }

            if (e.type == EventType.Repaint)
            {
                isLoaded = true;
            }
        }