private void SaveEditorPrefs()
                {
                    string prefsXml = Serializer.ToString(_editorPrefs);

                    EditorPrefs.SetString(_editorPrefsTag, prefsXml);
                }
Exemple #2
0
        private void OnGUI()
        {
            Instance = this;
            if (EditorApplication.timeSinceStartup > lastTime)
            {
                lastTime = EditorApplication.timeSinceStartup + 1;
                Repaint();
            }

            Window.DrawHeader("", "");
            DrawVersionInformation();

            if (Builder.Building)
            {
                if (GUILayout.Button("Cancel"))
                {
                    Builder.Building = false;
                }

                EditorGUILayout.LabelField("Building...", EditorStyles.boldLabel);
                return;
            }

            //loop through the services, and toggle each setting
            int            uploadServices = 0;
            List <Service> services       = Builder.Services;

            for (int i = 0; i < services.Count; i++)
            {
                services[i].Index       = i;
                services[i].CanUploadTo = EditorGUILayout.Toggle("Upload to " + services[i].Name, services[i].CanUploadTo);
                if (services[i].CanUploadTo)
                {
                    uploadServices++;
                }
            }

            //mode enum
            Builder.ScriptingImplementation = (ScriptingImplementation)EditorGUILayout.EnumPopup("Mode", Builder.ScriptingImplementation);

            //development stuff
            Builder.ProfilerDebug = EditorGUILayout.Toggle("Autoconnect Profiler", Builder.ProfilerDebug);

            Rect lastRect = GUILayoutUtility.GetLastRect();

            //toolbar garbage
            string platform = EditorPrefs.GetString(PlayerSettings.productGUID + "_buildPlatform", "win");

            string[] platforms    = new string[] { "win", "linux", "mac", "webgl", "android" };
            int      currentIndex = IndexOf(platform, platforms);

            platform = platforms[GUI.Toolbar(new Rect(0, lastRect.y + lastRect.height + 5, Screen.width, 20), currentIndex, platforms, EditorStyles.toolbarButton)];
            EditorPrefs.SetString(PlayerSettings.productGUID + "_buildPlatform", platform);

            GUILayout.Space(25);

            //upload button
            if (Builder.UploadExists(platform) && uploadServices > 0 && !Builder.Uploading)
            {
                if (GUILayout.Button("Upload", GUILayout.Height(40)))
                {
                    Builder.Upload(platform);
                }
            }
            else
            {
                GUI.color = new Color(1f, 1f, 1f, 0.3f);

                GUILayout.Button("Upload", GUILayout.Height(40));

                GUI.color = Color.white;
            }

            //build and play button
            GUILayout.BeginHorizontal();
            if (Builder.Building)
            {
                GUI.color = new Color(1f, 1f, 1f, 0.3f);

                GUILayout.Button("Build", EditorStyles.miniButtonLeft, GUILayout.Height(20));
                GUILayout.Button("Build + Play", EditorStyles.miniButtonMid, GUILayout.Height(20));

                GUI.color = Color.white;
            }
            else
            {
                if (GUILayout.Button("Build", EditorStyles.miniButtonLeft, GUILayout.Height(20)))
                {
                    Builder.Build(platform);
                }
                if (GUILayout.Button("Build + Play", EditorStyles.miniButtonMid, GUILayout.Height(20)))
                {
                    Builder.BuildAndPlay(platform);
                }
            }
            if (Builder.PlayExists(platform))
            {
                if (GUILayout.Button("Play", EditorStyles.miniButtonRight, GUILayout.Height(20)))
                {
                    Builder.Play(platform);
                }
            }
            else
            {
                GUI.color = new Color(1f, 1f, 1f, 0.3f);

                GUILayout.Button("Play", EditorStyles.miniButtonRight, GUILayout.Height(20));

                GUI.color = Color.white;
            }
            GUILayout.EndHorizontal();

            //draw the message window
            GUILayout.Space(50);
            var rect = GUILayoutUtility.GetLastRect();

            Window.DrawHeader("Log", "", rect.yMax);

            float width = Mathf.Max(60f, Screen.width / 3f);

            if (GUI.Button(new Rect(Screen.width - width, rect.yMax, width, 17), "Clear", EditorStyles.toolbarButton))
            {
                Builder.ClearLog();
            }

            GUILayout.Space(20);
            foreach (var(text, type) in Builder.Log)
            {
                EditorGUILayout.HelpBox(text, type);
            }
        }
Exemple #3
0
 /// <summary>
 /// Save the prefs to EditorPrefs.
 /// </summary>
 public void Save()
 {
     EditorPrefs.SetString(UniqueIDWindowPrefsKey, JsonUtility.ToJson(this));
 }
        private void OnGUI()
        {
            m_Scroll = GUILayout.BeginScrollView(m_Scroll);

            EditorGUILayout.LabelField("Resolution", EditorStyles.boldLabel);
            m_ResWidth      = EditorGUILayout.IntField("Width", m_ResWidth);
            m_ResHeight     = EditorGUILayout.IntField("Height", m_ResHeight);
            m_IsTransparent = EditorGUILayout.Toggle("Transparent Background", m_IsTransparent);

            m_Scale = EditorGUILayout.IntSlider("Scale", m_Scale, 1, 15);

            // Save Path control.
            float kButtonWidth  = 60;
            Rect  contentRect   = EditorGUI.PrefixLabel(EditorGUILayout.GetControlRect(), new GUIContent("Save Path"));
            Rect  textFieldRect = new Rect(contentRect.x, contentRect.y, contentRect.width - kButtonWidth, contentRect.height);
            Rect  buttonRect    = new Rect(textFieldRect.x + textFieldRect.width, textFieldRect.y, kButtonWidth, textFieldRect.height);

            EditorGUI.TextField(textFieldRect, m_Path);
            if (GUI.Button(buttonRect, "Browse"))
            {
                GetPath();
            }

            // Camera
            m_ScreenshotCamera = EditorGUILayout.ObjectField("Camera", m_ScreenshotCamera, typeof(Camera), true) as Camera;

            if (m_ScreenshotCamera == null)
            {
                m_ScreenshotCamera = FindObjectOfType <Camera>();
            }

            EditorGUILayout.LabelField("Default Options", EditorStyles.boldLabel);
            GUILayout.BeginHorizontal();

            float halfButtonWidth = EditorGUIUtility.currentViewWidth / 2 - 6;

            // Screen Size button
            if (GUILayout.Button("Set To Screen Size", GUILayout.Width(halfButtonWidth)))
            {
                Vector2 gameView = Handles.GetMainGameViewSize();
                m_ResWidth  = (int)gameView.x;
                m_ResHeight = (int)gameView.y;
            }

            // Default Size button
            if (GUILayout.Button("Default Size", GUILayout.Width(halfButtonWidth)))
            {
                m_ResWidth  = 2560;
                m_ResHeight = 1440;
                m_Scale     = 1;
            }

            GUILayout.EndHorizontal();

            // Screenshot resolution info.
            EditorGUILayout.Space();
            EditorGUILayout.LabelField($"Screenshot will be taken at {m_ResWidth*m_Scale} x {m_ResHeight*m_Scale} px", EditorStyles.boldLabel);

            // Take Screenshot button.
            if (GUILayout.Button("Take Screenshot", GUILayout.MinHeight(60)))
            {
                if (m_Path == "" || !Directory.Exists(m_Path))
                {
                    m_Path = EditorUtility.SaveFolderPanel("Path to Save Images", m_Path, Application.dataPath);
                    EditorPrefs.SetString(kPrefKey, m_Path);
                    Debug.Log("Path Set");
                }

                TakeHiResShot();
            }
            EditorGUILayout.Space();

            EditorGUILayout.BeginHorizontal();

            // Open Last Screenshot button.
            GUI.enabled = m_LastScreenshot != "";
            if (GUILayout.Button("Open Last Screenshot", GUILayout.MinHeight(40), GUILayout.Width(halfButtonWidth)))
            {
                Application.OpenURL("file://" + m_LastScreenshot);
                Debug.Log("Opening File " + m_LastScreenshot);
            }
            GUI.enabled = true;

            // Open Folder button.
            if (GUILayout.Button("Open Folder", GUILayout.MinHeight(40), GUILayout.Width(halfButtonWidth)))
            {
                Application.OpenURL("file://" + m_Path);
            }

            EditorGUILayout.EndHorizontal();

            if (m_TakeHiResShot)
            {
                int           resWidthN  = m_ResWidth * m_Scale;
                int           resHeightN = m_ResHeight * m_Scale;
                RenderTexture rt         = new RenderTexture(resWidthN, resHeightN, 24);
                m_ScreenshotCamera.targetTexture = rt;

                TextureFormat tFormat = m_IsTransparent ? TextureFormat.ARGB32 : TextureFormat.RGB24;

                Texture2D screenShot = new Texture2D(resWidthN, resHeightN, tFormat, false);
                m_ScreenshotCamera.Render();
                RenderTexture.active = rt;
                screenShot.ReadPixels(new Rect(0, 0, resWidthN, resHeightN), 0, 0);
                m_ScreenshotCamera.targetTexture = null;
                RenderTexture.active             = null;
                byte[] bytes    = screenShot.EncodeToPNG();
                string filename = ScreenShotName(resWidthN, resHeightN);

                File.WriteAllBytes(filename, bytes);
                Debug.Log($"Took screenshot to: {filename}");
                Application.OpenURL(filename);
                m_TakeHiResShot = false;
            }

            EditorGUILayout.HelpBox("Requires Unity Pro.", MessageType.Info);

            GUILayout.EndScrollView();
        }
Exemple #5
0
        ///----------------------------------------------------------------------------------------------

        //Save the prefs
        static void Save()
        {
            EditorPrefs.SetString(PREFS_KEY_NAME, JSONSerializer.Serialize(typeof(SerializedData), data));
        }
 public static void SkipUpdates(string releaseNotes)
 {
     EditorPrefs.SetString(SKIPPED_UPDATE_PREFS_KEY, FileAndPathUtils.ComputeNameHash(releaseNotes, "SHA1"));
 }
 public override void Set(string value)
 {
     EditorPrefs.SetString(Key, value);
 }
 public static void Save(string data)
 {
     EditorPrefs.SetString(prefsKey, data);
 }
 /// <summary>Handles the data from the update page</summary>
 static void UpdateCheckCompleted(string result)
 {
     EditorPrefs.SetString("AstarServerMessage", result);
     ParseServerMessage(result);
     ShowUpdateWindowIfRelevant();
 }
Exemple #10
0
    /// <summary>
    /// Converts Color to Hexadecmial for EditorPref string saving
    /// </summary>
    /// <param name="key">EditorPref Key</param>
    /// <param name="col">Color to convert</param>
    public static void SaveHexColour(string key, Color col)
    {
        string strCol = "#" + ColorUtility.ToHtmlStringRGBA(col);

        EditorPrefs.SetString(key, strCol);
    }
 public static void Save()
 {
     Rebuild();
     EditorPrefs.SetString(pathPlayerPrefsKey, JsonUtility.ToJson(Instance));
 }
 public void OnDispose()
 {
     EditorPrefs.SetBool(KEY_AUTOGENERATE_CLASS, mEnableGenerateClass);
     EditorPrefs.SetString(KEY_QAssetBundleBuilder_RESVERSION, mResVersion);
 }
Exemple #13
0
    public void OnGUI()
    {
        if (!guiInitialized)
        {
            GUISkin t_skin = EditorGUIUtility.GetBuiltinSkin(EditorGUIUtility.isProSkin ? EditorSkin.Scene : EditorSkin.Inspector);
            pbStyle.padding           = new RectOffset(2, 2, 1, 1);
            pbStyle.border            = new RectOffset(6, 6, 4, 4);
            pbStyle.normal.background = t_skin.GetStyle("Button").normal.background;
            pbStyle.margin            = new RectOffset(4, 2, 2, 2);
            pbStyle.contentOffset     = new Vector2(0, 0);
        }

        if (!EditorGUIUtility.isProSkin)
        {
            oldColor            = GUI.backgroundColor;
            GUI.backgroundColor = pgButtonColor;
        }

        EditorGUI.BeginChangeCheck();
        t_snapValue = EditorGUILayout.FloatField("", t_snapValue,
                                                 GUILayout.MinWidth(BUTTON_SIZE),
                                                 GUILayout.MaxWidth(BUTTON_SIZE));
        if (EditorGUI.EndChangeCheck())
        {
                        #if PRO
            // If user sets new snap value, make the default multiplier 100 again.
            SetSnapValue(snapUnit, t_snapValue, 100);
                        #endif
        }

        gc_SnapEnabled.image = snapEnabled ? gui_SnapEnabled_on : gui_SnapEnabled_off;
        if (GUILayout.Button(gc_SnapEnabled, pbStyle, GUILayout.MaxWidth(BUTTON_SIZE)))
        {
            SetSnapEnabled(!snapEnabled);
        }

        gc_GridEnabled.image = drawGrid ? gui_GridEnabled_on : gui_GridEnabled_off;
        if (GUILayout.Button(gc_GridEnabled, pbStyle, GUILayout.MaxWidth(BUTTON_SIZE)))
        {
            SetGridEnabled(!drawGrid);
        }

        // if(!ortho)	GUI.enabled = false;
        gc_AngleEnabled.image = drawAngles ? gui_AngleEnabled_on : gui_AngleEnabled_off;
        if (GUILayout.Button(gc_AngleEnabled, pbStyle, GUILayout.MaxWidth(BUTTON_SIZE)))
        {
            SetDrawAngles(!drawAngles);
        }

        EditorGUI.BeginChangeCheck();
        angleValue = EditorGUILayout.FloatField(gc_AngleValue, angleValue,
                                                GUILayout.MinWidth(BUTTON_SIZE),
                                                GUILayout.MaxWidth(BUTTON_SIZE));
        if (EditorGUI.EndChangeCheck())
        {
            SceneView.RepaintAll();
        }
        // GUI.enabled = true;

        if (GUILayout.Button(gc_SnapToGrid, pbStyle, GUILayout.MaxWidth(BUTTON_SIZE)))       //, GUILayout.MaxWidth(50), GUILayout.MinHeight(16)))
        {
            SnapToGrid(Selection.transforms);
        }

        GUILayout.Label(gui_Divider, GUILayout.MaxWidth(BUTTON_SIZE));

        gc_RenderPlaneX.image = (renderPlane & Axis.X) == Axis.X && !fullGrid ? gui_PlaneX_on : gui_PlaneX_off;
        if (GUILayout.Button(gc_RenderPlaneX, pbStyle, GUILayout.MaxWidth(BUTTON_SIZE)))
        {
            SetRenderPlane(Axis.X);
        }

        gc_RenderPlaneY.image = (renderPlane & Axis.Y) == Axis.Y && !fullGrid ? gui_PlaneY_on : gui_PlaneY_off;
        if (GUILayout.Button(gc_RenderPlaneY, pbStyle, GUILayout.MaxWidth(BUTTON_SIZE)))
        {
            SetRenderPlane(Axis.Y);
        }

        gc_RenderPlaneZ.image = (renderPlane & Axis.Z) == Axis.Z && !fullGrid ? gui_PlaneZ_on : gui_PlaneZ_off;
        if (GUILayout.Button(gc_RenderPlaneZ, pbStyle, GUILayout.MaxWidth(BUTTON_SIZE)))
        {
            SetRenderPlane(Axis.Z);
        }

        gc_RenderPerspectiveGrid.image = fullGrid ? gui_fullGrid_on : gui_fullGrid_off;
        if (GUILayout.Button(gc_RenderPerspectiveGrid, pbStyle, GUILayout.MaxWidth(BUTTON_SIZE)))
        {
            fullGrid    = !fullGrid;
            gridRepaint = true;
            EditorPrefs.SetBool(pg_Constant.PerspGrid, fullGrid);
            SceneView.RepaintAll();
        }

        gc_LockGrid.image = lockGrid ? gui_LockGrid_on : gui_LockGrid_off;
        if (GUILayout.Button(gc_LockGrid, pbStyle, GUILayout.MaxWidth(BUTTON_SIZE)))
        {
            lockGrid = !lockGrid;
            EditorPrefs.SetBool(pg_Constant.LockGrid, lockGrid);
            EditorPrefs.SetString(pg_Constant.LockedGridPivot, pivot.ToString());

            // if we've modified the nudge value, reset the pivot here
            if (!lockGrid)
            {
                offset = 0f;
            }

            gridRepaint = true;

            SceneView.RepaintAll();
        }

                #if PROFILE_TIMES
        if (GUILayout.Button("Times"))
        {
            profiler.DumpTimes();
        }
        if (GUILayout.Button("Reset"))
        {
            profiler.ClearValues();
        }
                #endif

        if (!EditorGUIUtility.isProSkin)
        {
            GUI.backgroundColor = oldColor;
        }
    }
Exemple #14
0
    /// <summary>
    /// Update Unity Editor Preferences
    static void UpdateUnityPreferences(bool enabled)
    {
        if (enabled)
        {
#if UNITY_EDITOR_OSX
            var newPath = "/Applications/Visual Studio Code.app";
#elif UNITY_EDITOR_WIN
            var newPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + Path.DirectorySeparatorChar + "Code" + Path.DirectorySeparatorChar + "bin" + Path.DirectorySeparatorChar + "code.cmd";
#else
            var newPath = "/usr/local/bin/code";
#endif

            // App
            if (EditorPrefs.GetString("kScriptsDefaultApp") != newPath)
            {
                EditorPrefs.SetString("VSCode_PreviousApp", EditorPrefs.GetString("kScriptsDefaultApp"));
            }
            EditorPrefs.SetString("kScriptsDefaultApp", newPath);

            // Arguments
            if (EditorPrefs.GetString("kScriptEditorArgs") != "-r -g \"$(File):$(Line)\"")
            {
                EditorPrefs.SetString("VSCode_PreviousArgs", EditorPrefs.GetString("kScriptEditorArgs"));
            }

            EditorPrefs.SetString("kScriptEditorArgs", "-r -g \"$(File):$(Line)\"");
            EditorPrefs.SetString("kScriptEditorArgs" + newPath, "-r -g \"$(File):$(Line)\"");


            // MonoDevelop Solution
            if (EditorPrefs.GetBool("kMonoDevelopSolutionProperties", false))
            {
                EditorPrefs.SetBool("VSCode_PreviousMD", true);
            }
            EditorPrefs.SetBool("kMonoDevelopSolutionProperties", false);

            // Support Unity Proj (JS)
            if (EditorPrefs.GetBool("kExternalEditorSupportsUnityProj", false))
            {
                EditorPrefs.SetBool("VSCode_PreviousUnityProj", true);
            }
            EditorPrefs.SetBool("kExternalEditorSupportsUnityProj", false);

            // Attach to Editor
            if (!EditorPrefs.GetBool("AllowAttachedDebuggingOfEditor", false))
            {
                EditorPrefs.SetBool("VSCode_PreviousAttach", false);
            }
            EditorPrefs.SetBool("AllowAttachedDebuggingOfEditor", true);
        }
        else
        {
            // Restore previous app
            if (!string.IsNullOrEmpty(EditorPrefs.GetString("VSCode_PreviousApp")))
            {
                EditorPrefs.SetString("kScriptsDefaultApp", EditorPrefs.GetString("VSCode_PreviousApp"));
            }

            // Restore previous args
            if (!string.IsNullOrEmpty(EditorPrefs.GetString("VSCode_PreviousArgs")))
            {
                EditorPrefs.SetString("kScriptEditorArgs", EditorPrefs.GetString("VSCode_PreviousArgs"));
            }

            // Restore MD setting
            if (EditorPrefs.GetBool("VSCode_PreviousMD", false))
            {
                EditorPrefs.SetBool("kMonoDevelopSolutionProperties", true);
            }

            // Restore MD setting
            if (EditorPrefs.GetBool("VSCode_PreviousUnityProj", false))
            {
                EditorPrefs.SetBool("kExternalEditorSupportsUnityProj", true);
            }


            // Restore previous attach
            if (!EditorPrefs.GetBool("VSCode_PreviousAttach", true))
            {
                EditorPrefs.SetBool("AllowAttachedDebuggingOfEditor", false);
            }
        }

        FixUnityPreferences();
    }
Exemple #15
0
 public static void SaveString(this Property <string> selfProperty, string key)
 {
     EditorPrefs.SetString(key, selfProperty.Value);
 }
Exemple #16
0
    /// <summary>
    /// Builds a single APK and places it in the build folder.
    /// </summary>
    /// <param name="settings">Description of the APK to build.</param>
    public static void BuildAPK(APKSettings settings)
    {
        // Don't make any permanent changes to the player settings!
        Texture2D[] oldIcons            = PlayerSettings.GetIconsForTargetGroup(BuildTargetGroup.Android);
        string      oldKeystoreName     = PlayerSettings.Android.keystoreName;
        string      oldkeyaliasName     = PlayerSettings.Android.keyaliasName;
        string      oldKeystorePass     = PlayerSettings.Android.keystorePass;
        string      oldKeyaliasPass     = PlayerSettings.Android.keyaliasPass;
        string      oldProductName      = PlayerSettings.productName;
        string      oldBundleIdentifier = PlayerSettings.bundleIdentifier;
        string      oldAndroidSdkRoot   = EditorPrefs.GetString("AndroidSdkRoot");

        // make sure the product folder exists
        System.IO.Directory.CreateDirectory(BUILD_APK_DIRECTORY_W_SLASH);

        // set icons (Android currently supports 6 sizes)
        Texture2D icon = (Texture2D)AssetDatabase.LoadMainAssetAtPath(ASSET_DIRECTORY_W_SLASH + settings.Icon);

        PlayerSettings.SetIconsForTargetGroup(BuildTargetGroup.Android,
                                              new Texture2D[] { icon, icon, icon, icon, icon, icon });

        string keystoreDir = FindKeystoreDirectory();

        if (keystoreDir != null)
        {
            string keystorePass = ReadKeystorePassword(keystoreDir + "/trailmix-release-key-password.txt");

            PlayerSettings.Android.keystoreName = keystoreDir + "/trailmix-release-key.keystore";
            PlayerSettings.Android.keyaliasName = "alias_name";
            PlayerSettings.Android.keystorePass = PlayerSettings.Android.keyaliasPass = keystorePass;
        }

        // set name and ids
        PlayerSettings.productName      = settings.ProjectName;
        PlayerSettings.bundleIdentifier = settings.BundleIdentifier;

        // Unity won't remember where the Android SDK was when built on Jenkins
        string sdkRoot = Environment.GetEnvironmentVariable("ANDROID_SDK_ROOT");

        if (sdkRoot != String.Empty)
        {
            EditorPrefs.SetString("AndroidSdkRoot", sdkRoot);
        }

        // and finally... build it!
        string[] scenesUnityPath = new string[settings.Scenes.Length];
        for (int it = 0; it != settings.Scenes.Length; ++it)
        {
            scenesUnityPath[it] = ASSET_DIRECTORY_W_SLASH + settings.Scenes[it];
        }
        BuildPipeline.BuildPlayer(scenesUnityPath, BUILD_APK_DIRECTORY_W_SLASH + settings.ProjectName + ".apk",
                                  BuildTarget.Android, BuildOptions.None);

        // Restore player settings
        PlayerSettings.SetIconsForTargetGroup(BuildTargetGroup.Android, oldIcons);
        PlayerSettings.Android.keystoreName = oldKeystoreName;
        PlayerSettings.Android.keyaliasName = oldkeyaliasName;
        PlayerSettings.Android.keystorePass = oldKeystorePass;
        PlayerSettings.Android.keyaliasPass = oldKeyaliasPass;
        PlayerSettings.productName          = oldProductName;
        PlayerSettings.bundleIdentifier     = oldBundleIdentifier;
        EditorPrefs.SetString("AndroidSdkRoot", oldAndroidSdkRoot);
    }
 private static void SaveLastCheckTime(DateTime time)
 {
     EditorPrefs.SetString(LAST_UPDATE_PREFS_KEY, time.Ticks.ToString());
 }
Exemple #18
0
 /// <summary>
 /// Saves the microsoft translator settings in EditorPrefs
 /// Keys = cws_mtCliendID, cws_mtCliendSecret
 /// </summary>
 private void SaveMicrosoftTranslatorSettings()
 {
     EditorPrefs.SetString("cws_mtClientID", mtCliendID);
     EditorPrefs.SetString("cws_mtClientSecret", mtCliendSecret);
     EditorPrefs.SetBool("cws_mtKeepAuthenticated", keepTranslatorAuthenticated);
 }
Exemple #19
0
    /// <summary>
    /// Save the specified string value in settings.
    /// </summary>

    static public void SetString(string name, string val)
    {
        EditorPrefs.SetString(name, val);
    }
Exemple #20
0
    override public void OnInspectorGUI()
    {
        mFont = target as UIFont;
        EditorGUIUtility.LookLikeControls(80f);

        NGUIEditorTools.DrawSeparator();

        if (mFont.replacement != null)
        {
            mType        = FontType.Reference;
            mReplacement = mFont.replacement;
        }
        else if (mFont.dynamicFont != null)
        {
            mType = FontType.Dynamic;
        }

        GUILayout.BeginHorizontal();
        FontType fontType = (FontType)EditorGUILayout.EnumPopup("Font Type", mType);

        GUILayout.Space(18f);
        GUILayout.EndHorizontal();

        if (mType != fontType)
        {
            if (fontType == FontType.Normal)
            {
                OnSelectFont(null);
            }
            else
            {
                mType = fontType;
            }

            if (mType != FontType.Dynamic && mFont.dynamicFont != null)
            {
                mFont.dynamicFont = null;
            }
        }

        if (mType == FontType.Reference)
        {
            ComponentSelector.Draw <UIFont>(mFont.replacement, OnSelectFont);

            NGUIEditorTools.DrawSeparator();
            GUILayout.Label("You can have one font simply point to\n" +
                            "another one. This is useful if you want to be\n" +
                            "able to quickly replace the contents of one\n" +
                            "font with another one, for example for\n" +
                            "swapping an SD font with an HD one, or\n" +
                            "replacing an English font with a Chinese\n" +
                            "one. All the labels referencing this font\n" +
                            "will update their references to the new one.");

            if (mReplacement != mFont && mFont.replacement != mReplacement)
            {
                NGUIEditorTools.RegisterUndo("Font Change", mFont);
                mFont.replacement = mReplacement;
                UnityEditor.EditorUtility.SetDirty(mFont);
            }
            return;
        }
        else if (mType == FontType.Dynamic)
        {
#if UNITY_3_5
            EditorGUILayout.HelpBox("Dynamic fonts require Unity 4.0 or higher.", MessageType.Error);
#else
            NGUIEditorTools.DrawSeparator();
            Font fnt = EditorGUILayout.ObjectField("TTF Font", mFont.dynamicFont, typeof(Font), false) as Font;

            if (fnt != mFont.dynamicFont)
            {
                NGUIEditorTools.RegisterUndo("Font change", mFont);
                mFont.dynamicFont = fnt;
            }

            GUILayout.BeginHorizontal();
            int       size  = EditorGUILayout.IntField("Size", mFont.dynamicFontSize, GUILayout.Width(120f));
            FontStyle style = (FontStyle)EditorGUILayout.EnumPopup(mFont.dynamicFontStyle);
            GUILayout.Space(18f);
            GUILayout.EndHorizontal();

            if (size != mFont.dynamicFontSize)
            {
                NGUIEditorTools.RegisterUndo("Font change", mFont);
                mFont.dynamicFontSize = size;
            }

            if (style != mFont.dynamicFontStyle)
            {
                NGUIEditorTools.RegisterUndo("Font change", mFont);
                mFont.dynamicFontStyle = style;
            }

            Material mat = EditorGUILayout.ObjectField("Material", mFont.material, typeof(Material), false) as Material;

            if (mFont.material != mat)
            {
                NGUIEditorTools.RegisterUndo("Font Material", mFont);
                mFont.material = mat;
            }
#endif
        }
        else
        {
            NGUIEditorTools.DrawSeparator();

            ComponentSelector.Draw <UIAtlas>(mFont.atlas, OnSelectAtlas);

            if (mFont.atlas != null)
            {
                if (mFont.bmFont.isValid)
                {
                    NGUIEditorTools.AdvancedSpriteField(mFont.atlas, mFont.spriteName, SelectSprite, false);
                }
                EditorGUILayout.Space();
            }
            else
            {
                // No atlas specified -- set the material and texture rectangle directly
                Material mat = EditorGUILayout.ObjectField("Material", mFont.material, typeof(Material), false) as Material;

                if (mFont.material != mat)
                {
                    NGUIEditorTools.RegisterUndo("Font Material", mFont);
                    mFont.material = mat;
                }
            }

            // For updating the font's data when importing from an external source, such as the texture packer
            bool resetWidthHeight = false;

            if (mFont.atlas != null || mFont.material != null)
            {
                TextAsset data = EditorGUILayout.ObjectField("Import Data", null, typeof(TextAsset), false) as TextAsset;

                if (data != null)
                {
                    NGUIEditorTools.RegisterUndo("Import Font Data", mFont);
                    BMFontReader.Load(mFont.bmFont, NGUITools.GetHierarchy(mFont.gameObject), data.bytes);
                    mFont.MarkAsDirty();
                    resetWidthHeight = true;
                    Debug.Log("Imported " + mFont.bmFont.glyphCount + " characters");
                }
            }

            if (mFont.bmFont.isValid)
            {
                Color     green = new Color(0.4f, 1f, 0f, 1f);
                Texture2D tex   = mFont.texture;

                if (tex != null)
                {
                    if (mFont.atlas == null)
                    {
                        // Pixels are easier to work with than UVs
                        Rect pixels = NGUIMath.ConvertToPixels(mFont.uvRect, tex.width, tex.height, false);

                        // Automatically set the width and height of the rectangle to be the original font texture's dimensions
                        if (resetWidthHeight)
                        {
                            pixels.width  = mFont.texWidth;
                            pixels.height = mFont.texHeight;
                        }

                        // Font sprite rectangle
                        GUI.backgroundColor = green;
                        pixels = EditorGUILayout.RectField("Pixel Rect", pixels);
                        GUI.backgroundColor = Color.white;

                        // Create a button that can make the coordinates pixel-perfect on click
                        GUILayout.BeginHorizontal();
                        {
                            Rect corrected = NGUIMath.MakePixelPerfect(pixels);

                            if (corrected == pixels)
                            {
                                GUI.color = Color.grey;
                                GUILayout.Button("Make Pixel-Perfect");
                                GUI.color = Color.white;
                            }
                            else if (GUILayout.Button("Make Pixel-Perfect"))
                            {
                                pixels      = corrected;
                                GUI.changed = true;
                            }
                        }
                        GUILayout.EndHorizontal();

                        // Convert the pixel coordinates back to UV coordinates
                        Rect uvRect = NGUIMath.ConvertToTexCoords(pixels, tex.width, tex.height);

                        if (mFont.uvRect != uvRect)
                        {
                            NGUIEditorTools.RegisterUndo("Font Pixel Rect", mFont);
                            mFont.uvRect = uvRect;
                        }
                        //NGUIEditorTools.DrawSeparator();
                        EditorGUILayout.Space();
                    }
                }
            }
        }

        // The font must be valid at this point for the rest of the options to show up
        if (mFont.isDynamic || mFont.bmFont.isValid)
        {
            // Font spacing
            GUILayout.BeginHorizontal();
            {
                EditorGUIUtility.LookLikeControls(0f);
                GUILayout.Label("Spacing", GUILayout.Width(60f));
                GUILayout.Label("X", GUILayout.Width(12f));
                int x = EditorGUILayout.IntField(mFont.horizontalSpacing);
                GUILayout.Label("Y", GUILayout.Width(12f));
                int y = EditorGUILayout.IntField(mFont.verticalSpacing);
                GUILayout.Space(18f);
                EditorGUIUtility.LookLikeControls(80f);

                if (mFont.horizontalSpacing != x || mFont.verticalSpacing != y)
                {
                    NGUIEditorTools.RegisterUndo("Font Spacing", mFont);
                    mFont.horizontalSpacing = x;
                    mFont.verticalSpacing   = y;
                }
            }
            GUILayout.EndHorizontal();

            if (mFont.atlas == null)
            {
                mView      = View.Font;
                mUseShader = false;

                float pixelSize = EditorGUILayout.FloatField("Pixel Size", mFont.pixelSize, GUILayout.Width(120f));

                if (pixelSize != mFont.pixelSize)
                {
                    NGUIEditorTools.RegisterUndo("Font Change", mFont);
                    mFont.pixelSize = pixelSize;
                }
            }
            EditorGUILayout.Space();
        }

        // Preview option
        if (!mFont.isDynamic && mFont.atlas != null)
        {
            GUILayout.BeginHorizontal();
            {
                mView = (View)EditorGUILayout.EnumPopup("Preview", mView);
                GUILayout.Label("Shader", GUILayout.Width(45f));
                mUseShader = EditorGUILayout.Toggle(mUseShader, GUILayout.Width(20f));
            }
            GUILayout.EndHorizontal();
        }

        // Dynamic fonts don't support emoticons
        if (!mFont.isDynamic && mFont.bmFont.isValid)
        {
            if (mFont.atlas != null)
            {
                NGUIEditorTools.DrawHeader("Symbols and Emoticons");

                List <BMSymbol> symbols = mFont.symbols;

                for (int i = 0; i < symbols.Count;)
                {
                    BMSymbol sym = symbols[i];

                    GUILayout.BeginHorizontal();
                    GUILayout.Label(sym.sequence, GUILayout.Width(40f));
                    if (NGUIEditorTools.SimpleSpriteField(mFont.atlas, sym.spriteName, ChangeSymbolSprite))
                    {
                        mSelectedSymbol = sym;
                    }

                    if (GUILayout.Button("Edit", GUILayout.Width(40f)))
                    {
                        if (mFont.atlas != null)
                        {
                            EditorPrefs.SetString("NGUI Selected Sprite", sym.spriteName);
                            NGUIEditorTools.Select(mFont.atlas.gameObject);
                        }
                    }

                    GUI.backgroundColor = Color.red;

                    if (GUILayout.Button("X", GUILayout.Width(22f)))
                    {
                        NGUIEditorTools.RegisterUndo("Remove symbol", mFont);
                        mSymbolSequence = sym.sequence;
                        mSymbolSprite   = sym.spriteName;
                        symbols.Remove(sym);
                        mFont.MarkAsDirty();
                    }
                    GUI.backgroundColor = Color.white;
                    GUILayout.EndHorizontal();
                    GUILayout.Space(4f);
                    ++i;
                }

                if (symbols.Count > 0)
                {
                    NGUIEditorTools.DrawSeparator();
                }

                GUILayout.BeginHorizontal();
                mSymbolSequence = EditorGUILayout.TextField(mSymbolSequence, GUILayout.Width(40f));
                NGUIEditorTools.SimpleSpriteField(mFont.atlas, mSymbolSprite, SelectSymbolSprite);

                bool isValid = !string.IsNullOrEmpty(mSymbolSequence) && !string.IsNullOrEmpty(mSymbolSprite);
                GUI.backgroundColor = isValid ? Color.green : Color.grey;

                if (GUILayout.Button("Add", GUILayout.Width(40f)) && isValid)
                {
                    NGUIEditorTools.RegisterUndo("Add symbol", mFont);
                    mFont.AddSymbol(mSymbolSequence, mSymbolSprite);
                    mFont.MarkAsDirty();
                    mSymbolSequence = "";
                    mSymbolSprite   = "";
                }
                GUI.backgroundColor = Color.white;
                GUILayout.EndHorizontal();

                if (symbols.Count == 0)
                {
                    EditorGUILayout.HelpBox("Want to add an emoticon to your font? In the field above type ':)', choose a sprite, then hit the Add button.", MessageType.Info);
                }
                else
                {
                    GUILayout.Space(4f);
                }
            }
        }
    }
 private void GetPath()
 {
     m_Path = EditorUtility.SaveFolderPanel("Path to Save Images", m_Path, string.IsNullOrEmpty(m_Path) ? Application.dataPath : m_Path);
     EditorPrefs.SetString(kPrefKey, m_Path);
     Debug.Log("Path Set");
 }
 private void SaveUserPrefs()
 {
     EditorPrefs.SetBool("TCP2SMU_mAlwaysOverwrite", mAlwaysOverwrite);
     EditorPrefs.SetBool("TCP2SMU_mCustomDirectory", mCustomDirectory);
     EditorPrefs.SetString("TCP2SMU_mCustomDirectoryPath", mCustomDirectoryPath);
 }
Exemple #23
0
 protected virtual void SaveParams()
 {
     EditorPrefs.SetString(EditorApplication.applicationPath, string.Join(",", instances.ToArray()));
 }
Exemple #24
0
 public override void Save()
 {
     EditorPrefs.SetString(namespacedKey, value.Serialize().json);
 }
Exemple #25
0
        /// <summary>
        /// Update Unity Editor Preferences
        /// </summary>
        /// <param name="enabled">Should we turn on this party!</param>
        static void UpdateUnityPreferences(bool enabled)
        {
            if (enabled)
            {
                // App
                if (EditorPrefs.GetString("kScriptsDefaultApp") != CodePath)
                {
                    EditorPrefs.SetString("VSCode_PreviousApp", EditorPrefs.GetString("kScriptsDefaultApp"));
                }
                EditorPrefs.SetString("kScriptsDefaultApp", CodePath);

                // Arguments
                if (EditorPrefs.GetString("kScriptEditorArgs") != "-r -g `$(File):$(Line)`")
                {
                    EditorPrefs.SetString("VSCode_PreviousArgs", EditorPrefs.GetString("kScriptEditorArgs"));
                }

                EditorPrefs.SetString("kScriptEditorArgs", "-r -g `$(File):$(Line)`");
                EditorPrefs.SetString("kScriptEditorArgs" + CodePath, "-r -g `$(File):$(Line)`");


                // MonoDevelop Solution
                if (EditorPrefs.GetBool("kMonoDevelopSolutionProperties", false))
                {
                    EditorPrefs.SetBool("VSCode_PreviousMD", true);
                }
                EditorPrefs.SetBool("kMonoDevelopSolutionProperties", false);

                // Support Unity Proj (JS)
                if (EditorPrefs.GetBool("kExternalEditorSupportsUnityProj", false))
                {
                    EditorPrefs.SetBool("VSCode_PreviousUnityProj", true);
                }
                EditorPrefs.SetBool("kExternalEditorSupportsUnityProj", false);

                if (!EditorPrefs.GetBool("AllowAttachedDebuggingOfEditor", false))
                {
                    EditorPrefs.SetBool("VSCode_PreviousAttach", false);
                }
                EditorPrefs.SetBool("AllowAttachedDebuggingOfEditor", true);
            }
            else
            {
                // Restore previous app
                if (!string.IsNullOrEmpty(EditorPrefs.GetString("VSCode_PreviousApp")))
                {
                    EditorPrefs.SetString("kScriptsDefaultApp", EditorPrefs.GetString("VSCode_PreviousApp"));
                }

                // Restore previous args
                if (!string.IsNullOrEmpty(EditorPrefs.GetString("VSCode_PreviousArgs")))
                {
                    EditorPrefs.SetString("kScriptEditorArgs", EditorPrefs.GetString("VSCode_PreviousArgs"));
                }

                // Restore MD setting
                if (EditorPrefs.GetBool("VSCode_PreviousMD", false))
                {
                    EditorPrefs.SetBool("kMonoDevelopSolutionProperties", true);
                }

                // Restore MD setting
                if (EditorPrefs.GetBool("VSCode_PreviousUnityProj", false))
                {
                    EditorPrefs.SetBool("kExternalEditorSupportsUnityProj", true);
                }

                // Always leave editor attaching on, I know, it solves the problem of needing to restart for this
                // to actually work
                EditorPrefs.SetBool("AllowAttachedDebuggingOfEditor", true);
            }

            FixUnityPreferences();
        }
Exemple #26
0
 public void SetPath(string path)
 {
     EditorPrefs.SetString(EditorPrefsKey(), path);
 }
 private void SaveToPreferences()
 {
     EditorPrefs.SetString(Animator.StringToHash(Application.dataPath + "uttTestScenes").ToString(), String.Join(",", m_IntegrationTestScenes.ToArray()));
     EditorPrefs.SetString(Animator.StringToHash(Application.dataPath + "uttBuildScenes").ToString(), String.Join(",", m_OtherScenesToBuild.ToArray()));
 }
Exemple #28
0
        public void SettingsGUI()
        {
            EditorGUILayout.BeginVertical(GUI.skin.box);
            {
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.PrefixLabel("Language");
                    EditorGUI.BeginChangeCheck();
                    settingLanguageType = (Language.LanguageType)GUILayout.Toolbar((int)settingLanguageType, Language.LanguageTypeString, EditorStyles.miniButton);
                    if (EditorGUI.EndChangeCheck())
                    {
                        EditorPrefs.SetInt("VeryAnimation_LanguageType", (int)(settingLanguageType));
                        Language.SetLanguage(settingLanguageType);
                        InternalEditorUtility.RepaintAllViews();
                    }
                    EditorGUILayout.EndHorizontal();
                }
                componentFoldout = EditorGUILayout.Foldout(componentFoldout, "Component", true);
                if (componentFoldout)
                {
                    EditorGUI.indentLevel++;
                    {
                        #region settingComponentSaveSettings
                        {
                            EditorGUI.BeginChangeCheck();
                            settingComponentSaveSettings = EditorGUILayout.Toggle(Language.GetContent(Language.Help.SettingsSaveSettings), settingComponentSaveSettings);
                            if (EditorGUI.EndChangeCheck())
                            {
                                EditorPrefs.SetBool("VeryAnimation_ComponentSaveSettings", settingComponentSaveSettings);
                            }
                        }
                        #endregion
                    }
                    EditorGUI.indentLevel--;
                }
                boneFoldout = EditorGUILayout.Foldout(boneFoldout, "Bone", true);
                if (boneFoldout)
                {
                    EditorGUI.indentLevel++;
                    {
                        #region Button Size
                        {
                            EditorGUI.BeginChangeCheck();
                            settingBoneButtonSize = EditorGUILayout.Slider("Button Size", settingBoneButtonSize, 1f, 32f);
                            if (EditorGUI.EndChangeCheck())
                            {
                                EditorPrefs.SetFloat("VeryAnimation_BoneButtonSize", settingBoneButtonSize);
                                InternalEditorUtility.RepaintAllViews();
                            }
                        }
                        #endregion
                        #region Button Normal Color
                        {
                            EditorGUI.BeginChangeCheck();
                            settingBoneNormalColor = EditorGUILayout.ColorField("Button Normal Color", settingBoneNormalColor);
                            if (EditorGUI.EndChangeCheck())
                            {
                                SetEditorPrefsColor("VeryAnimation_BoneNormalColor", settingBoneNormalColor);
                                InternalEditorUtility.RepaintAllViews();
                            }
                        }
                        #endregion
                        #region Button Active Color
                        {
                            EditorGUI.BeginChangeCheck();
                            settingBoneActiveColor = EditorGUILayout.ColorField("Button Active Color", settingBoneActiveColor);
                            if (EditorGUI.EndChangeCheck())
                            {
                                SetEditorPrefsColor("VeryAnimation_BoneActiveColor", settingBoneActiveColor);
                                InternalEditorUtility.RepaintAllViews();
                            }
                        }
                        #endregion
                        #region MuscleLimit
                        {
                            EditorGUI.BeginChangeCheck();
                            settingBoneMuscleLimit = EditorGUILayout.Toggle("Muscle Limit Gizmo", settingBoneMuscleLimit);
                            if (EditorGUI.EndChangeCheck())
                            {
                                EditorPrefs.SetBool("VeryAnimation_BoneMuscleLimit", settingBoneMuscleLimit);
                                InternalEditorUtility.RepaintAllViews();
                            }
                        }
                        #endregion
                    }
                    EditorGUI.indentLevel--;
                }
                skeletonFoldout = EditorGUILayout.Foldout(skeletonFoldout, "Skeleton", true);
                if (skeletonFoldout)
                {
                    EditorGUI.indentLevel++;
                    {
                        #region SkeletonType
                        {
                            EditorGUILayout.BeginHorizontal();
                            EditorGUI.BeginChangeCheck();
                            EditorGUILayout.PrefixLabel("Preview Type");
                            settingsSkeletonType = (SkeletonType)GUILayout.Toolbar((int)settingsSkeletonType, SkeletonTypeString);
                            if (EditorGUI.EndChangeCheck())
                            {
                                EditorPrefs.SetInt("VeryAnimation_SkeletonType", (int)settingsSkeletonType);
                                InternalEditorUtility.RepaintAllViews();
                            }
                            EditorGUILayout.EndHorizontal();
                        }
                        #endregion
                        #region Skeleton Color
                        {
                            EditorGUI.BeginChangeCheck();
                            settingSkeletonColor = EditorGUILayout.ColorField("Preview Color", settingSkeletonColor);
                            if (EditorGUI.EndChangeCheck())
                            {
                                SetEditorPrefsColor("VeryAnimation_SkeletonColor", settingSkeletonColor);
                                InternalEditorUtility.RepaintAllViews();
                            }
                        }
                        #endregion
                    }
                    EditorGUI.indentLevel--;
                }
                ikFoldout = EditorGUILayout.Foldout(ikFoldout, "IK", true);
                if (ikFoldout)
                {
                    EditorGUI.indentLevel++;
                    {
                        #region IK Target Size
                        {
                            EditorGUI.BeginChangeCheck();
                            settingIKTargetSize = EditorGUILayout.Slider("Button Size", settingIKTargetSize, 0.01f, 1f);
                            if (EditorGUI.EndChangeCheck())
                            {
                                EditorPrefs.SetFloat("VeryAnimation_IKTargetSize", settingIKTargetSize);
                                InternalEditorUtility.RepaintAllViews();
                            }
                        }
                        #endregion
                        #region IK Target Normal Color
                        {
                            EditorGUI.BeginChangeCheck();
                            settingIKTargetNormalColor = EditorGUILayout.ColorField("Button Normal Color", settingIKTargetNormalColor);
                            if (EditorGUI.EndChangeCheck())
                            {
                                SetEditorPrefsColor("VeryAnimation_IKTargetNormalColor", settingIKTargetNormalColor);
                                InternalEditorUtility.RepaintAllViews();
                            }
                        }
                        #endregion
                        #region IK Target Active Color
                        {
                            EditorGUI.BeginChangeCheck();
                            settingIKTargetActiveColor = EditorGUILayout.ColorField("Button Active Color", settingIKTargetActiveColor);
                            if (EditorGUI.EndChangeCheck())
                            {
                                SetEditorPrefsColor("VeryAnimation_IKTargetActiveColor", settingIKTargetActiveColor);
                                InternalEditorUtility.RepaintAllViews();
                            }
                        }
                        #endregion
                    }
                    EditorGUI.indentLevel--;
                }
                editorFoldout = EditorGUILayout.Foldout(editorFoldout, "Editor Window", true);
                if (editorFoldout)
                {
                    EditorGUI.indentLevel++;
                    {
                        #region Window Type
                        EditorGUILayout.BeginHorizontal();
                        EditorGUI.BeginChangeCheck();
                        EditorGUILayout.PrefixLabel("Window Style");
                        settingEditorWindowStyle = (EditorWindowStyle)GUILayout.Toolbar((int)settingEditorWindowStyle, EditorWindowStyleString, EditorStyles.miniButton);
                        if (EditorGUI.EndChangeCheck())
                        {
                            EditorPrefs.SetInt("VeryAnimation_EditorWindowStyle", (int)settingEditorWindowStyle);
                        }
                        EditorGUILayout.EndHorizontal();
                        #endregion
                    }
                    {
                        #region NameFieldWidth
                        {
                            EditorGUI.BeginChangeCheck();
                            settingEditorNameFieldWidth = EditorGUILayout.Slider("Name Field Width", settingEditorNameFieldWidth, 50f, 500f);
                            if (EditorGUI.EndChangeCheck())
                            {
                                EditorPrefs.SetFloat("VeryAnimation_EditorNameFieldWidth", settingEditorNameFieldWidth);
                                InternalEditorUtility.RepaintAllViews();
                            }
                        }
                        #endregion
                    }
                    EditorGUI.indentLevel--;
                }
                hierarchyFoldout = EditorGUILayout.Foldout(hierarchyFoldout, "Hierarchy", true);
                if (hierarchyFoldout)
                {
                    EditorGUI.indentLevel++;
                    {
                        #region ExpandSelectObject
                        {
                            EditorGUI.BeginChangeCheck();
                            settingHierarchyExpandSelectObject = EditorGUILayout.Toggle(new GUIContent("Expand select object"), settingHierarchyExpandSelectObject);
                            if (EditorGUI.EndChangeCheck())
                            {
                                EditorPrefs.SetBool("VeryAnimation_HierarchyExpandSelectObject", settingHierarchyExpandSelectObject);
                            }
                        }
                        #endregion
                    }
                    EditorGUI.indentLevel--;
                }
                mirrorFoldout = EditorGUILayout.Foldout(mirrorFoldout, "Mirror", true);
                if (mirrorFoldout)
                {
                    EditorGUI.indentLevel++;
                    {
                        EditorGUI.BeginChangeCheck();
                        settingGenericMirrorScale = EditorGUILayout.Toggle(Language.GetContent(Language.Help.SettingsMirrorScale), settingGenericMirrorScale);
                        if (EditorGUI.EndChangeCheck())
                        {
                            EditorPrefs.SetBool("VeryAnimation_GenericMirrorScale", settingGenericMirrorScale);
                        }
                    }

                    mirrorAutomapFoldout = EditorGUILayout.Foldout(mirrorAutomapFoldout, "Automap", true);
                    if (mirrorAutomapFoldout)
                    {
                        EditorGUI.indentLevel++;
                        {
                            EditorGUILayout.LabelField("Generic");
                            EditorGUI.indentLevel++;
                            {
                                #region settingGenericMirrorName
                                {
                                    EditorGUI.BeginChangeCheck();
                                    settingGenericMirrorName = EditorGUILayout.Toggle(Language.GetContent(Language.Help.SettingsSearchByName), settingGenericMirrorName);
                                    if (EditorGUI.EndChangeCheck())
                                    {
                                        EditorPrefs.SetBool("VeryAnimation_GenericMirrorName", settingGenericMirrorName);
                                    }
                                    if (settingGenericMirrorName)
                                    {
                                        EditorGUI.indentLevel++;
                                        #region settingGenericMirrorNameDifferentCharacters
                                        {
                                            EditorGUI.BeginChangeCheck();
                                            settingGenericMirrorNameDifferentCharacters = EditorGUILayout.TextField(new GUIContent("Characters", "Different Characters"), settingGenericMirrorNameDifferentCharacters);
                                            if (EditorGUI.EndChangeCheck())
                                            {
                                                EditorPrefs.SetString("VeryAnimation_GenericMirrorNameDifferentCharacters", settingGenericMirrorNameDifferentCharacters);
                                            }
                                        }
                                        #endregion
                                        #region settingGenericMirrorNameIgnoreCharacter
                                        {
                                            EditorGUILayout.BeginHorizontal();
                                            {
                                                EditorGUI.BeginChangeCheck();
                                                settingGenericMirrorNameIgnoreCharacter = EditorGUILayout.ToggleLeft(Language.GetContent(Language.Help.SettingsIgnoreUpToTheSpecifiedCharacter), settingGenericMirrorNameIgnoreCharacter);
                                                if (EditorGUI.EndChangeCheck())
                                                {
                                                    EditorPrefs.SetBool("VeryAnimation_GenericMirrorNameIgnoreCharacter", settingGenericMirrorNameIgnoreCharacter);
                                                }
                                            }
                                            if (settingGenericMirrorNameIgnoreCharacter)
                                            {
                                                EditorGUI.BeginChangeCheck();
                                                settingGenericMirrorNameIgnoreCharacterString = EditorGUILayout.TextField(settingGenericMirrorNameIgnoreCharacterString, GUILayout.Width(100));
                                                if (EditorGUI.EndChangeCheck())
                                                {
                                                    EditorPrefs.SetString("VeryAnimation_GenericMirrorNameIgnoreCharacterString", settingGenericMirrorNameIgnoreCharacterString);
                                                }
                                            }
                                            EditorGUILayout.EndHorizontal();
                                        }
                                        #endregion
                                        EditorGUI.indentLevel--;
                                    }
                                }
                                #endregion
                            }
                            EditorGUI.indentLevel--;

                            EditorGUILayout.LabelField("Blend Shape");
                            EditorGUI.indentLevel++;
                            {
                                #region settingBlendShapeMirrorName
                                {
                                    EditorGUI.BeginChangeCheck();
                                    settingBlendShapeMirrorName = EditorGUILayout.Toggle(Language.GetContent(Language.Help.SettingsSearchByName), settingBlendShapeMirrorName);
                                    if (EditorGUI.EndChangeCheck())
                                    {
                                        EditorPrefs.SetBool("VeryAnimation_BlendShapeMirrorName", settingBlendShapeMirrorName);
                                    }
                                    if (settingBlendShapeMirrorName)
                                    {
                                        EditorGUI.indentLevel++;
                                        #region settingBlendShapeMirrorNameDifferentCharacters
                                        {
                                            EditorGUI.BeginChangeCheck();
                                            settingBlendShapeMirrorNameDifferentCharacters = EditorGUILayout.TextField(new GUIContent("Characters", "Different Characters"), settingBlendShapeMirrorNameDifferentCharacters);
                                            if (EditorGUI.EndChangeCheck())
                                            {
                                                EditorPrefs.SetString("VeryAnimation_BlendShapeMirrorNameDifferentCharacters", settingBlendShapeMirrorNameDifferentCharacters);
                                            }
                                        }
                                        #endregion
                                        EditorGUI.indentLevel--;
                                    }
                                }
                                #endregion
                            }
                            EditorGUI.indentLevel--;
                        }
                        EditorGUI.indentLevel--;
                    }

                    EditorGUI.indentLevel--;
                }
#if VERYANIMATION_TIMELINE
                if (va.dummyObject != null)
                {
                    dummyObjectFoldout = EditorGUILayout.Foldout(dummyObjectFoldout, "Dummy Object", true);
                    if (dummyObjectFoldout)
                    {
                        EditorGUI.indentLevel++;
                        {
                            #region ChangeColor
                            {
                                EditorGUI.BeginChangeCheck();
                                settingDummyObjectColorChange = EditorGUILayout.Toggle("Change Color", settingDummyObjectColorChange);
                                if (EditorGUI.EndChangeCheck())
                                {
                                    EditorPrefs.SetBool("VeryAnimation_DummyObjectColorChange", settingDummyObjectColorChange);
                                    SetDummyObjectColor();
                                    InternalEditorUtility.RepaintAllViews();
                                }
                            }
                            #endregion
                            #region Color
                            EditorGUI.indentLevel++;
                            if (settingDummyObjectColorChange)
                            {
                                EditorGUI.BeginChangeCheck();
                                settingDummyObjectColor = EditorGUILayout.ColorField("Color", settingDummyObjectColor);
                                if (EditorGUI.EndChangeCheck())
                                {
                                    SetEditorPrefsColor("VeryAnimation_DummyObjectColor", settingDummyObjectColor);
                                    SetDummyObjectColor();
                                    InternalEditorUtility.RepaintAllViews();
                                }
                            }
                            EditorGUI.indentLevel--;
                            #endregion
                        }
                        if (va.uAw_2017_1.GetLinkedWithTimeline())
                        {
                            #region settingDummyPositionType
                            {
                                EditorGUILayout.BeginHorizontal();
                                EditorGUILayout.PrefixLabel("Position Type");
                                EditorGUI.BeginChangeCheck();
                                settingDummyPositionType = (DummyPositionType)GUILayout.Toolbar((int)settingDummyPositionType, DummyPositionTypeString);
                                if (EditorGUI.EndChangeCheck())
                                {
                                    EditorPrefs.SetInt("VeryAnimation_DummyPositionType", (int)settingDummyPositionType);
                                    va.SetUpdateResampleAnimation();
                                    va.SetSynchroIKtargetAll();
                                    InternalEditorUtility.RepaintAllViews();
                                }
                                EditorGUILayout.EndHorizontal();
                            }
                            #endregion
                            EditorGUI.indentLevel++;
                            {
                                #region Position
                                {
                                    EditorGUI.BeginChangeCheck();
                                    settingDummyObjectPosition = EditorGUILayout.Vector3Field(new GUIContent("Offset Position", "This is used to prevent objects from overlapping."), settingDummyObjectPosition);
                                    if (EditorGUI.EndChangeCheck())
                                    {
                                        SetEditorPrefsVector3("VeryAnimation_DummyObjectPosition", settingDummyObjectPosition);
                                        va.SetUpdateResampleAnimation();
                                        InternalEditorUtility.RepaintAllViews();
                                    }
                                }
                                #endregion
                            }
                            EditorGUI.indentLevel--;
                        }
                        EditorGUI.indentLevel--;
                    }
                }
#endif
                extraFoldout = EditorGUILayout.Foldout(extraFoldout, "Extra functions", true);
                if (extraFoldout)
                {
                    EditorGUI.indentLevel++;
                    {
                        #region SynchronizeAnimation
#if VERYANIMATION_TIMELINE
                        if (!EditorApplication.isPlaying && !va.uAw_2017_1.GetLinkedWithTimeline())
#else
                        if (!EditorApplication.isPlaying)
#endif
                        {
                            EditorGUI.BeginChangeCheck();
                            settingExtraSynchronizeAnimation = EditorGUILayout.ToggleLeft(Language.GetContent(Language.Help.SettingsSynchronizeAnimation), settingExtraSynchronizeAnimation);
                            if (EditorGUI.EndChangeCheck())
                            {
                                EditorPrefs.SetBool("VeryAnimation_ExtraSynchronizeAnimation", settingExtraSynchronizeAnimation);
                                va.SetSynchronizeAnimation(settingExtraSynchronizeAnimation);
                            }
                        }
                        #endregion
                        #region OnionSkin
                        {
                            EditorGUI.BeginDisabledGroup(va.prefabMode);
                            EditorGUI.BeginChangeCheck();
                            settingExtraOnionSkin = EditorGUILayout.ToggleLeft(Language.GetContent(Language.Help.SettingsOnionSkin), settingExtraOnionSkin);
                            if (EditorGUI.EndChangeCheck())
                            {
                                EditorPrefs.SetBool("VeryAnimation_ExtraOnionSkin", settingExtraOnionSkin);
                                va.onionSkin.Update();
                            }
                            EditorGUI.EndDisabledGroup();
                        }
                        if (settingExtraOnionSkin && !va.prefabMode)
                        {
                            EditorGUI.indentLevel++;
                            #region settingExtraOnionSkinMode
                            {
                                EditorGUILayout.BeginHorizontal();
                                EditorGUILayout.PrefixLabel("Mode");
                                EditorGUI.BeginChangeCheck();
                                settingExtraOnionSkinMode = (OnionSkinMode)GUILayout.Toolbar((int)settingExtraOnionSkinMode, OnionSkinModeStrings, EditorStyles.miniButton);
                                if (EditorGUI.EndChangeCheck())
                                {
                                    EditorPrefs.SetInt("VeryAnimation_ExtraOnionSkinMode", (int)(settingExtraOnionSkinMode));
                                    va.onionSkin.Update();
                                }
                                EditorGUILayout.EndHorizontal();

                                EditorGUI.indentLevel++;
                                #region settingExtraOnionSkinFrameIncrement
                                if (settingExtraOnionSkinMode == OnionSkinMode.Frames)
                                {
                                    EditorGUI.BeginChangeCheck();
                                    settingExtraOnionSkinFrameIncrement = EditorGUILayout.IntSlider("Frame Increment", settingExtraOnionSkinFrameIncrement, 1, 60);
                                    if (EditorGUI.EndChangeCheck())
                                    {
                                        EditorPrefs.SetInt("VeryAnimation_ExtraOnionSkinFrameIncrement", settingExtraOnionSkinFrameIncrement);
                                        va.onionSkin.Update();
                                    }
                                }
                                #endregion
                                EditorGUI.indentLevel--;
                            }
                            #endregion
                            #region Next
                            {
                                EditorGUI.BeginChangeCheck();
                                settingExtraOnionSkinNextCount = EditorGUILayout.IntSlider("Next", settingExtraOnionSkinNextCount, 0, 10);
                                if (EditorGUI.EndChangeCheck())
                                {
                                    EditorPrefs.SetInt("VeryAnimation_ExtraOnionSkinNextCount", settingExtraOnionSkinNextCount);
                                    va.onionSkin.Update();
                                }
                                EditorGUI.indentLevel++;
                                {
                                    EditorGUILayout.BeginHorizontal();
                                    EditorGUILayout.PrefixLabel(new GUIContent("Color", "Near Color + Far Alpha"));
                                    {
                                        EditorGUI.BeginChangeCheck();
                                        settingExtraOnionSkinNextColor = EditorGUILayout.ColorField(settingExtraOnionSkinNextColor, GUILayout.Width(80f));
                                        if (EditorGUI.EndChangeCheck())
                                        {
                                            SetEditorPrefsColor("VeryAnimation_ExtraOnionSkinNextColor", settingExtraOnionSkinNextColor);
                                            va.onionSkin.Update();
                                        }
                                    }
                                    {
                                        EditorGUI.BeginChangeCheck();
                                        settingExtraOnionSkinNextMinAlpha = EditorGUILayout.Slider(settingExtraOnionSkinNextMinAlpha, 0f, 1f);
                                        if (EditorGUI.EndChangeCheck())
                                        {
                                            EditorPrefs.SetFloat("VeryAnimation_ExtraOnionSkinNextMinAlpha", settingExtraOnionSkinNextMinAlpha);
                                            va.onionSkin.Update();
                                        }
                                    }
                                    EditorGUILayout.EndHorizontal();
                                }
                                EditorGUI.indentLevel--;
                            }
                            #endregion
                            #region Prev
                            {
                                EditorGUI.BeginChangeCheck();
                                settingExtraOnionSkinPrevCount = EditorGUILayout.IntSlider("Previous", settingExtraOnionSkinPrevCount, 0, 10);
                                if (EditorGUI.EndChangeCheck())
                                {
                                    EditorPrefs.SetInt("VeryAnimation_ExtraOnionSkinPrevCount", settingExtraOnionSkinPrevCount);
                                    va.onionSkin.Update();
                                }
                                EditorGUI.indentLevel++;
                                {
                                    EditorGUILayout.BeginHorizontal();
                                    EditorGUILayout.PrefixLabel(new GUIContent("Color", "Near Color + Far Alpha"));
                                    {
                                        EditorGUI.BeginChangeCheck();
                                        settingExtraOnionSkinPrevColor = EditorGUILayout.ColorField(settingExtraOnionSkinPrevColor, GUILayout.Width(80f));
                                        if (EditorGUI.EndChangeCheck())
                                        {
                                            SetEditorPrefsColor("VeryAnimation_ExtraOnionSkinPrevColor", settingExtraOnionSkinPrevColor);
                                            va.onionSkin.Update();
                                        }
                                    }
                                    {
                                        EditorGUI.BeginChangeCheck();
                                        settingExtraOnionSkinPrevMinAlpha = EditorGUILayout.Slider(settingExtraOnionSkinPrevMinAlpha, 0f, 1f);
                                        if (EditorGUI.EndChangeCheck())
                                        {
                                            EditorPrefs.SetFloat("VeryAnimation_ExtraOnionSkinPrevMinAlpha", settingExtraOnionSkinPrevMinAlpha);
                                            va.onionSkin.Update();
                                        }
                                    }
                                    EditorGUILayout.EndHorizontal();
                                }
                                EditorGUI.indentLevel--;
                            }
                            #endregion

                            EditorGUI.indentLevel--;
                        }
                        #endregion
                    }
                    EditorGUI.indentLevel--;
                }

                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.Space();
                    if (GUILayout.Button("Reset"))
                    {
                        Reset();
                    }
                    EditorGUILayout.Space();
                    EditorGUILayout.EndHorizontal();

                    GUILayout.Space(4);
                }

                #region RestartOnly
                if (settingEditorWindowStyleBefore != settingEditorWindowStyle)
                {
                    EditorGUILayout.HelpBox(Language.GetText(Language.Help.SettingsRestartOnly), MessageType.Warning);
                }
                #endregion
            }
            EditorGUILayout.EndVertical();
        }
Exemple #29
0
 public static void SetEditorPrefsValue(LocalizedStringReference reference, EditorPrefsValue value)
 {
     EditorPrefs.SetString(GetEditorPrefsKey(reference), JsonUtility.ToJson(value));
 }
 public void UpdateSettings(string id, string secret, int languageType)
 {
     EditorPrefs.SetString("translate_clientId", id);
     EditorPrefs.SetString("translate_clientSecret", secret);
     EditorPrefs.SetInt("translate_languageType", languageType);
 }