예제 #1
0
 private static void GetCurrentWindow()
 {
     thisWindow = (MA_TextureAtlasserProExportWindow)EditorWindow.GetWindow <MA_TextureAtlasserProExportWindow>();
 }
        public override void UpdateView(Event e, Rect editorViewRect)
        {
            //Update base derived class
            base.UpdateView(e, editorViewRect);

            //Draw Menu
            if (isLoaded)
            {
                GUILayout.BeginArea(editorViewRect, EditorStyles.helpBox);
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));

                if (GUILayout.Button(MA_TextureAtlasserProIcons.createAtlasIcon, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true)))
                {
                    MA_TextureAtlasserProCreateWindow.InitEditorWindow(curWindow);
                }
                if (GUILayout.Button(MA_TextureAtlasserProIcons.loadAtlasIcon, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true)))
                {
                    curWindow.textureAtlas = MA_TextureAtlasserProUtils.LoadTextureAtlas();
                }

                if (curWindow.textureAtlas != null)
                {
                    if (GUILayout.Button(MA_TextureAtlasserProIcons.exportAtlasIcon, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true)))
                    {
                        MA_TextureAtlasserProExportWindow.InitEditorWindow(curWindow);
                        //MA_TextureAtlasserProUtils.ExportAtlas(curWindow.textureAtlas);
                    }
                    GUILayout.Space(MA_TextureAtlasserProUtils.VIEW_OFFSET);
                    if (curWindow.textureAtlas.showTextures && GUILayout.Button(MA_TextureAtlasserProIcons.showTexturesOnIcon, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true)))
                    {
                        curWindow.textureAtlas.showTextures = false;
                    }
                    else if (!curWindow.textureAtlas.showTextures && GUILayout.Button(MA_TextureAtlasserProIcons.showTexturesOffIcon, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true)))
                    {
                        curWindow.textureAtlas.showTextures = true;
                    }
                    GUILayout.Space(MA_TextureAtlasserProUtils.VIEW_OFFSET);
                    if (GUILayout.Button(MA_TextureAtlasserProIcons.createQuadIcon, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true)))
                    {
                        MA_TextureAtlasserProUtils.CreateTextureQuad(curWindow.textureAtlas, "new Quad", new Rect(0, 0, 128, 128), curWindow.settings.autoFocus);
                    }
                    if (curWindow.textureAtlas.selectedTextureQuad != null && GUILayout.Button(MA_TextureAtlasserProIcons.removeQuadIcon, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true)))
                    {
                        if (curWindow.textureAtlas.selectedTextureQuad != null)
                        {
                            MA_TextureAtlasserProUtils.RemoveTextureQuad(curWindow.textureAtlas, curWindow.settings.autoFocus);
                        }
                    }
                    if (curWindow.textureAtlas.selectedTextureQuad != null && GUILayout.Button(MA_TextureAtlasserProIcons.duplicateQuadIcon, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true)))
                    {
                        if (curWindow.textureAtlas.selectedTextureQuad != null)
                        {
                            MA_TextureAtlasserProUtils.DuplicateTextureQuad(curWindow.textureAtlas, curWindow.settings.autoFocus, curWindow.settings.copySelectedQuadData, curWindow.settings.duplicatedQuadNamePrefix);
                        }
                    }
                }

                GUILayout.EndHorizontal();
                GUILayout.EndArea();
            }

            ProcessEvents(e, editorViewRect);
        }