Example #1
0
 public static bool DoPlayButtonSmall(string title, bool isEditing, System.Action startAction, System.Action stopAction)
 {
     GUILayout.FlexibleSpace();
     ExGUI.Horizontal(delegate()
     {
         GUIStyle style = new GUIStyle(EditorStyles.miniButton);
         if (isEditing)
         {
             style.normal = style.active;
             ExGUI.Button(new GUIContent(title, EditorGUIUtility.FindTexture("PlayButton On"), "Stop editing"), style, delegate
             {
                 stopAction();
                 isEditing = false;
             }, GUILayout.Height(15));
         }
         else
         {
             //GUI.enabled = GUI.enabled && CallCanBeginEditingTool(compEditor.editor);
             ExGUI.Button(new GUIContent(title, EditorGUIUtility.FindTexture("PlayButton"), "Start editing"), style, delegate
             {
                 if (!isEditing)
                 {
                     stopAction();
                 }
                 startAction();
                 isEditing = true;
             }, GUILayout.Height(15));
         }
     });
     GUI.enabled = true;
     GUILayout.FlexibleSpace();
     return(isEditing);
 }
        void DrawMigration()
        {
            _skinTarget = EditorGUILayout.ObjectField("Target", _skinTarget, typeof(GUISkin), false) as GUISkin;
            if (_skinOriginal == null || _skinTarget == null)
            {
                return;
            }
            ExGUI.Group("Styles", delegate()
            {
                ExGUI.ButtonGo("Copy All:", delegate()
                {
                    CopyAllRegularStyles();
                    SaveSkin(_skinTarget);
                });

                ExGUI.Horizontal(delegate()
                {
                    EditorGUILayout.LabelField("Copy styles names to Clipboard");
                    GUILayout.FlexibleSpace();
                    ExGUI.Button("Original", EditorStyles.miniButtonLeft, delegate()
                    {
                        CopyAllNamesToClipboar(_skinOriginal);
                    });
                    ExGUI.Button("Target", EditorStyles.miniButtonRight, delegate()
                    {
                        CopyAllNamesToClipboar(_skinTarget);
                    });
                });
            });
            ExGUI.Group("Custom Styles", delegate()
            {
                ExGUI.ButtonGo("Copy All:", delegate()
                {
                    _skinTarget.customStyles = _skinOriginal.customStyles;
                    SaveSkin(_skinTarget);
                });
                ExGUI.ButtonGo("Update All:", delegate()
                {
                    ActionsToAll(true);
                    SaveSkin(_skinTarget);
                });

                ExGUIx.ScrollView("CustomStyles", delegate()
                {
                    for (int x = 0; x < _skinOriginal.customStyles.Length; x++)
                    {
                        ExGUI.Horizontal(delegate()
                        {
                            ExGUI.Button("X", EditorStyles.miniButtonLeft, delegate()
                            {
                                RemoveCustomStyle(_skinOriginal.customStyles[x].name);
                                SaveSkin(_skinTarget);
                            }, GUILayout.Width(30), GUILayout.Height(20));

                            if (_skinTarget.FindStyle(_skinOriginal.customStyles[x].name) == null)
                            {
                                ExGUI.Button(EditorGUIUtility.FindTexture("Animation.Play"), EditorStyles.miniButtonRight, delegate()
                                {
                                    AddCopyCustomStyle(_skinOriginal.customStyles[x].name);
                                    SaveSkin(_skinTarget);
                                }, GUILayout.Width(30), GUILayout.Height(20));
                            }
                            else
                            {
                                ExGUI.Button(EditorGUIUtility.FindTexture("RotateTool"), EditorStyles.miniButtonRight, delegate()
                                {
                                    ReplaceCustomStyle(_skinOriginal.customStyles[x].name);
                                    SaveSkin(_skinTarget);
                                }, GUILayout.Width(30), GUILayout.Height(20));
                            }

                            EditorGUILayout.LabelField(_skinOriginal.customStyles[x].name);
                        });
                    }
                });
            });
        }