Ejemplo n.º 1
0
        ///////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Init
        /// # Initialise the window and show it
        /// </summary>
        ///////////////////////////////////////////////////////////////////////////////////////////////////////
        static void Init()
        {
            // Get existing open window or if none, make a new one:
            CreateDecalWindow window = (CreateDecalWindow)EditorWindow.GetWindow(typeof(CreateDecalWindow));

            window.Show();
        }
        ///////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// DrawAdvancedButtons
        /// # Draw all advanced buttons
        /// </summary>
        ///////////////////////////////////////////////////////////////////////////////////////////////////////
        void DrawAdvancedButtons()
        {
            bool drawThis = true;

            if (!configSaver.parameters.showAdvancedActionsAlways && (systemMode != cSystemMode.edition))
            {
                drawThis = false;
            }

            if (drawThis)
            {
                configSaver.parameters.showAdvancedActions = EditorGUILayout.Foldout(configSaver.parameters.showAdvancedActions, new GUIContent("Advanced actions", "Show advanced actions"));

                if (configSaver.parameters.showAdvancedActions)
                {
                    EditorBasicFunctions.DrawEditorBox("Advanced actions", Color.yellow, position);

                    EditorGUILayout.Separator();
                    EditorGUILayout.Separator();

                    float buttonsScale = position.width / 6;

                    if (cleanAlSceneScriptsConfirmationMode)
                    {
                        EditorBasicFunctions.DrawEditorBox("Do you really want to clean all the scripts?", Color.white, position);

                        // clean all scripts
                        GUILayout.BeginHorizontal();
                        GUILayout.FlexibleSpace();

                        if (EditorBasicFunctions.GetEditorButton("NoButton", "Don't clean", new Vector2(buttonsScale, buttonsScale), true, false, false, true))
                        {
                            cleanAlSceneScriptsConfirmationMode = false;
                        }

                        EditorBasicFunctions.GetEditorButton("EmptyButton", "", new Vector2(buttonsScale, buttonsScale), false, true, true, true);
                        EditorBasicFunctions.GetEditorButton("EmptyButton", "", new Vector2(buttonsScale, buttonsScale), false, true, true, true);

                        if (EditorBasicFunctions.GetEditorButton("YesButton", "Continue cleaning", new Vector2(buttonsScale, buttonsScale), true, false, false, true))
                        {
                            CleanAllSceneScriptsAction();
                            cleanAlSceneScriptsConfirmationMode = false;
                        }

                        GUILayout.FlexibleSpace();
                        GUILayout.EndHorizontal();
                    }
                    else
                    {
                        // clean all scripts
                        GUILayout.BeginHorizontal();
                        GUILayout.FlexibleSpace();

                        if (EditorBasicFunctions.GetEditorTextButton("CLEAN SCRIPTS", "Clean all the scripts in the scene, for example to use without this editor extension in the system", position))
                        {
                            cleanAlSceneScriptsConfirmationMode = true;
                        }

                        // create new decal
                        if (EditorBasicFunctions.GetEditorTextButton("CREATE DECAL", "Create a new decal just selecting textures, type and folder", position))
                        {
                            CreateDecalWindow window = ScriptableObject.CreateInstance <CreateDecalWindow>();
                            window.name = "Create new decal";
#if UNITY_5_0
                            window.title = window.name;
#else
                            window.titleContent = new GUIContent(window.name);
#endif
                            window.Show();
                        }

                        GUILayout.FlexibleSpace();
                        GUILayout.EndHorizontal();

                        EditorGUILayout.Separator();

                        GUILayout.BeginHorizontal();
                        GUILayout.FlexibleSpace();


                        // lock all future time lockable decals
                        if (EditorBasicFunctions.GetEditorTextButton("LOCK DECALS", "Mark all 'futureTimeLockableShape' decals as locked", position))
                        {
                            foreach (GenericMeshDecal actualDecal in GameObject.FindObjectsOfType <GenericMeshDecal>())
                            {
                                if (actualDecal.futureTimeLockableShape)
                                {
                                    actualDecal.lockedShapeAlways = true;
                                }
                            }
                        }

                        // merge decals
                        if (EditorBasicFunctions.GetEditorTextButton("MERGE DECALS", "Merge all selected decals into single one mesh", position))
                        {
                            MergeDecalWindow window = ScriptableObject.CreateInstance <MergeDecalWindow>();
                            window.name = "Merge new decal";
#if UNITY_5_0
                            window.title = window.name;
#else
                            window.titleContent = new GUIContent(window.name);
#endif
                            window.Show();
                        }

                        GUILayout.FlexibleSpace();
                        GUILayout.EndHorizontal();
                    }

                    EditorGUILayout.Separator();
                    EditorGUILayout.Separator();
                    EditorBasicFunctions.DrawLineSeparator();
                }
            }
        }