Exemplo n.º 1
0
 public StringOption(string key, string defaultValue) : base(key)
 {
     value = EditorPrefs.GetString(prefix + key, defaultValue);
 }
Exemplo n.º 2
0
 public static string GetString(string prefKey, string defaultValue = "")
 {
     return(EditorPrefs.GetString(GetPrefKey(prefKey), defaultValue));
 }
Exemplo n.º 3
0
        /// <summary>
        /// Get a string property.
        /// This falls back to application-wide settings to allow for users to transition
        /// from application to project level settings.
        /// </summary>
        /// <param name="name">Name of the value.</param>
        /// <param name="defaultValue">Default value of the property if it isn't set.</param>
        public string GetString(string name, string defaultValue = "")
        {
            var systemValue = EditorPrefs.GetString(name, defaultValue: defaultValue);

            return(UseProjectSettings ? Get(name, systemValue) : systemValue);
        }
Exemplo n.º 4
0
    // private bool lockOrthographic;

    public void LoadPreferences()
    {
        if ((EditorPrefs.HasKey(pg_Constant.PGVersion) ? EditorPrefs.GetInt(pg_Constant.PGVersion) : 0) < VERSION)
        {
            EditorPrefs.SetInt(pg_Constant.PGVersion, VERSION);

            if (RESET_PREFS_REQ)
            {
                pg_Preferences.ResetPrefs();
                // Debug.Log("Resetting Prefs");
            }
        }

        if (EditorPrefs.HasKey(pg_Constant.SnapEnabled))
        {
            snapEnabled = EditorPrefs.GetBool(pg_Constant.SnapEnabled);
        }

        SetSnapValue(
            EditorPrefs.HasKey(pg_Constant.GridUnit) ? (SnapUnit)EditorPrefs.GetInt(pg_Constant.GridUnit) : SnapUnit.Meter,
            EditorPrefs.HasKey(pg_Constant.SnapValue) ? EditorPrefs.GetFloat(pg_Constant.SnapValue) : 1,
            EditorPrefs.HasKey(pg_Constant.SnapMultiplier) ? EditorPrefs.GetInt(pg_Constant.SnapMultiplier) : 100
            );

        if (EditorPrefs.HasKey(pg_Constant.UseAxisConstraints))
        {
            useAxisConstraints = EditorPrefs.GetBool(pg_Constant.UseAxisConstraints);
        }

        lockGrid = EditorPrefs.GetBool(pg_Constant.LockGrid);

        if (lockGrid)
        {
            if (EditorPrefs.HasKey(pg_Constant.LockedGridPivot))
            {
                string   piv      = EditorPrefs.GetString(pg_Constant.LockedGridPivot);
                string[] pivsplit = piv.Replace("(", "").Replace(")", "").Split(',');

                float x, y, z;
                if (!float.TryParse(pivsplit[0], out x))
                {
                    goto NoParseForYou;
                }
                if (!float.TryParse(pivsplit[1], out y))
                {
                    goto NoParseForYou;
                }
                if (!float.TryParse(pivsplit[2], out z))
                {
                    goto NoParseForYou;
                }

                pivot.x = x;
                pivot.y = y;
                pivot.z = z;

NoParseForYou:
                ;                       // appease the compiler
            }
        }

        fullGrid = EditorPrefs.GetBool(pg_Constant.PerspGrid);

        renderPlane = EditorPrefs.HasKey(pg_Constant.GridAxis) ? (Axis)EditorPrefs.GetInt(pg_Constant.GridAxis) : Axis.Y;

        SharedProperties.useAxisConstraints = useAxisConstraints;

        alphaBump = (EditorPrefs.HasKey("pg_alphaBump")) ? EditorPrefs.GetFloat("pg_alphaBump") : pg_Preferences.ALPHA_BUMP;

        gridColorX         = (EditorPrefs.HasKey("gridColorX")) ? pg_Util.ColorWithString(EditorPrefs.GetString("gridColorX")) : pg_Preferences.GRID_COLOR_X;
        gridColorX_primary = new Color(gridColorX.r, gridColorX.g, gridColorX.b, gridColorX.a + alphaBump);
        gridColorY         = (EditorPrefs.HasKey("gridColorY")) ? pg_Util.ColorWithString(EditorPrefs.GetString("gridColorY")) : pg_Preferences.GRID_COLOR_Y;
        gridColorY_primary = new Color(gridColorY.r, gridColorY.g, gridColorY.b, gridColorY.a + alphaBump);
        gridColorZ         = (EditorPrefs.HasKey("gridColorZ")) ? pg_Util.ColorWithString(EditorPrefs.GetString("gridColorZ")) : pg_Preferences.GRID_COLOR_Z;
        gridColorZ_primary = new Color(gridColorZ.r, gridColorZ.g, gridColorZ.b, gridColorZ.a + alphaBump);

        drawGrid = (EditorPrefs.HasKey("showgrid")) ? EditorPrefs.GetBool("showgrid") : pg_Preferences.SHOW_GRID;
    }
 //NOTE: this belongs elsewhere
 public string getNGUISetLocalizationLanguageName()
 {
     return(EditorPrefs.GetString("Language"));
 }
Exemplo n.º 6
0
        private static bool IsShouldSkipVersion(string version)
        {
            string skipVersion = EditorPrefs.GetString(kPrefsKeySkipVersion);

            return(skipVersion == version);
        }
 public static string GetInstantUrl()
 {
     return(EditorPrefs.GetString(PlayInstantUrlKey));
 }
        void ExportForDCLGUI()
        {
            EditorGUILayout.BeginVertical("box");

            var foldout = EditorUtil.GUILayout.AutoSavedFoldout("DclExportForDCL", LabelLocalization.getString(LanguageStringValue.StandardExport), true, null);

            if (foldout)
            {
                GUILayout.Label(LabelLocalization.getString(LanguageStringValue.DCLProjectPath), EditorStyles.boldLabel);
                EditorGUILayout.BeginHorizontal();
                exportPath = EditorPrefs.GetString("DclExportPath");
                var newExportPath = EditorGUILayout.TextField(exportPath);
                if (GUILayout.Button("...", GUILayout.Width(24), GUILayout.Height(24)))
                {
                    newExportPath = EditorUtility.OpenFolderPanel(LabelLocalization.getString(LanguageStringValue.SelectDCLProjectPath), exportPath, "");
                    if (string.IsNullOrEmpty(newExportPath))
                    {
                        newExportPath = exportPath;
                    }
                }

                if (newExportPath != exportPath)
                {
                    exportPath = newExportPath;
                    EditorPrefs.SetString("DclExportPath", newExportPath);
                }

                EditorGUILayout.EndHorizontal();


                GUILayout.Space(SPACE_SIZE);

                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                var oriColor = GUI.backgroundColor;
                GUI.backgroundColor = Color.green;
                if (GUILayout.Button(LabelLocalization.getString(LanguageStringValue.Export), GUILayout.Width(220), GUILayout.Height(32)))
                {
                    Export();
                }

                GUI.backgroundColor = oriColor;
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();

                GUILayout.Space(SPACE_SIZE * 2);

                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                if (GUILayout.Button(LabelLocalization.getString(LanguageStringValue.InitProject), GUILayout.Width(105)))
                {
                    if (Directory.Exists(exportPath))
                    {
                        if (EditorUtility.DisplayDialog(LabelLocalization.getString(LanguageStringValue.ConfirmInitDCLProject),
                                                        string.Format(LabelLocalization.getString(LanguageStringValue.InitDCLProjectAreYouSure), exportPath), LabelLocalization.getString(LanguageStringValue.YES),
                                                        LabelLocalization.getString(LanguageStringValue.NO)))
                        {
                            DclCLI.DclInit(exportPath);
                        }
                    }
                    else
                    {
                        ShowNotification(new GUIContent(LabelLocalization.getString(LanguageStringValue.SelectValidProjectFolder)));
                    }
                }

                if (GUILayout.Button(LabelLocalization.getString(LanguageStringValue.RunProject), GUILayout.Width(105)))
                {
                    if (Directory.Exists(exportPath))
                    {
                        if (EditorUtility.DisplayDialog(LabelLocalization.getString(LanguageStringValue.ConfimRunDCLProject),
                                                        string.Format(LabelLocalization.getString(LanguageStringValue.RunDCLProjectAreYouSure), exportPath), LabelLocalization.getString(LanguageStringValue.YES),
                                                        LabelLocalization.getString(LanguageStringValue.NO)))
                        {
                            DclCLI.DclStart(exportPath);
                            ShowNotification(new GUIContent(LabelLocalization.getString(LanguageStringValue.DCLStartWait10Seconds)));
                        }
                    }
                    else
                    {
                        ShowNotification(new GUIContent(LabelLocalization.getString(LanguageStringValue.SelectValidProjectFolder)));
                    }
                }

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

                GUILayout.Space(SPACE_SIZE * 2);
            }

            EditorGUILayout.EndVertical();
        }
        void ExportForNowGUI()
        {
            EditorGUILayout.BeginVertical("box");

            var foldout = EditorUtil.GUILayout.AutoSavedFoldout("DclExportForNow", LabelLocalization.getString(LanguageStringValue.ExportForNowSh), true, null);

            if (foldout)
            {
                GUILayout.Label(LabelLocalization.getString(LanguageStringValue.DCLNowProjectPath), EditorStyles.boldLabel);
                EditorGUILayout.BeginHorizontal();
                exportPath = EditorPrefs.GetString("DclNowExportPath");
                var newExportPath = EditorGUILayout.TextField(exportPath);
                if (GUILayout.Button("...", GUILayout.Width(24), GUILayout.Height(24)))
                {
                    newExportPath = EditorUtility.OpenFolderPanel(LabelLocalization.getString(LanguageStringValue.SelectDCLProjectPath), exportPath, "");
                    if (string.IsNullOrEmpty(newExportPath))
                    {
                        newExportPath = exportPath;
                    }
                }

                if (newExportPath != exportPath)
                {
                    exportPath = newExportPath;
                    EditorPrefs.SetString("DclNowExportPath", newExportPath);
                }

                EditorGUILayout.EndHorizontal();

                GUILayout.Space(SPACE_SIZE);

                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                var oriColor = GUI.backgroundColor;
                GUI.backgroundColor = Color.green;
                if (GUILayout.Button(LabelLocalization.getString(LanguageStringValue.Export), GUILayout.Width(220), GUILayout.Height(32)))
                {
                    Export();

                    //Add package.json & so on files
                    var templateFolder = FileUtil.FindFolder("Editor/now_template");
                    var filesToCopy    = new string[]
                    {
                        "build.json",
                        "package.json",
                        "tsconfig.json",
                    };
                    foreach (var filename in filesToCopy)
                    {
                        UnityEditor.FileUtil.ReplaceFile(Path.Combine(templateFolder, filename), Path.Combine(exportPath, filename));
                    }
                }

                GUI.backgroundColor = oriColor;
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();

                GUILayout.Space(SPACE_SIZE * 2);
            }

            EditorGUILayout.EndVertical();
        }
Exemplo n.º 10
0
 public EditorVariableString(string name, string labelName, string defaultValue) : base(name, labelName, defaultValue)
 {
     m_value = EditorPrefs.GetString(name, m_defaultValue);
 }
Exemplo n.º 11
0
    /// <summary>
    /// Get the previously saved string value.
    /// </summary>

    static public string GetString(string name, string defaultValue)
    {
        return(EditorPrefs.GetString(name, defaultValue));
    }
Exemplo n.º 12
0
        private void AssetBuilderMenu()
        {
            scroll1 = GUILayout.BeginScrollView(scroll1); //SCROLL 1 START
            if (streamingAssetsDirectory == "")
            {
                streamingAssetsDirectory = EditorPrefs.GetString("streamingassetsDir", streamingAssetsDirectory);
            }

            //Displays header text 1
            GUILayout.Label(new GUIContent("Select the following asset bundles to export"), new GUIStyle("BoldLabel"));
            GUILayout.Space(5);

            //Displays asset bundle list

            foreach (string bundle in bundleNames)
            {
                GUILayout.BeginHorizontal();
                exportBundle[bundle] = GUILayout.Toggle(exportBundle[bundle], bundle);
                if (EditorPrefs.GetBool("ExportBundle" + bundle) != exportBundle[bundle])
                {
                    EditorPrefs.SetBool("ExportBundle" + bundle, exportBundle[bundle]);
                }
                EditorGUI.BeginDisabledGroup(!exportBundle[bundle] || streamingAssetsDirectory == null || streamingAssetsDirectory == "" || streamingAssetsDirectory.Substring(streamingAssetsDirectory.LastIndexOf('/') + 1, streamingAssetsDirectory.Length - streamingAssetsDirectory.LastIndexOf('/') - 1) != "StreamingAssets");

                GUILayout.BeginVertical();
                try
                {
                    if (modExportDirectories[bundle] == null || modExportDirectories[bundle] == "")
                    {
                        if (GUILayout.Button("Select target mod", new GUIStyle("DropDownButton")))
                        {
                            streamingAssetsDirectory = EditorPrefs.GetString("streamingassetsDir", streamingAssetsDirectory);
                            if (dropDownModDirSelect[bundle])
                            {
                                dropDownModDirSelect[bundle] = false;
                            }
                            else
                            {
                                dropDownModDirSelect[bundle] = true;
                            }
                        }
                    }
                    else
                    {
                        if (GUILayout.Button("Target mod: " + modExportDirectories[bundle].Substring(modExportDirectories[bundle].LastIndexOf('\\') + 1, modExportDirectories[bundle].Length - modExportDirectories[bundle].LastIndexOf('\\') - 1), new GUIStyle("DropDownButton")))
                        {
                            streamingAssetsDirectory = EditorPrefs.GetString("streamingassetsDir", streamingAssetsDirectory);
                            if (dropDownModDirSelect[bundle])
                            {
                                dropDownModDirSelect[bundle] = false;
                            }
                            else
                            {
                                dropDownModDirSelect[bundle] = true;
                            }
                        }
                    }
                    if (dropDownModDirSelect[bundle])
                    {
                        foreach (string file in Directory.EnumerateDirectories(streamingAssetsDirectory))
                        {
                            if (GUILayout.Button(file.Substring(file.LastIndexOf('\\') + 1, file.Length - file.LastIndexOf('\\') - 1), new GUIStyle("radio")))
                            {
                                modExportDirectories[bundle] = file;
                                EditorPrefs.SetString("ExportBundleDir" + bundle, modExportDirectories[bundle]);
                                dropDownModDirSelect[bundle] = false;
                            }
                        }
                    }
                }
                catch (Exception)
                {
                    dropDownModDirSelect[bundle] = false;
                    modExportDirectories[bundle] = EditorPrefs.GetString("ExportBundleDir" + bundle, null);
                }
                GUILayout.EndVertical();

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

            GUILayout.Space(10);

            buildAssetBundleOptions = (BuildAssetBundleOptions)EditorGUILayout.EnumPopup("Option", buildAssetBundleOptions);

            exportToModFolders = GUILayout.Toggle(exportToModFolders, "Export asset bundles to their respective Mod folders.");
            if (exportToModFolders != EditorPrefs.GetBool("exportToModFolders"))
            {
                EditorPrefs.SetBool("exportToModFolders", exportToModFolders);
            }
            GUILayout.Space(5);
            //Button that builds asset bundles
            if (exportToModFolders)
            {
                GUILayout.Label("Asset Bundles will be exported to " + assetBundleDirectory + " and to mod Folders");
            }
            else
            {
                GUILayout.Label("Asset Bundles will be exported to " + assetBundleDirectory + ".");
            }
            if (GUILayout.Button("Build Asset Bundles"))
            {
                BuildAllAssetBundles();
            }

            GUILayout.EndScrollView(); //SCROLL 1 END
        }
Exemplo n.º 13
0
        private void ModConfigOptions(FileInfo file)
        {
            if (file.Extension == ".json" && file.Name != "manifest.json" && file.Name.Substring(0, 5) == "Item_")
            {
                string ObjectKey = selectedModDirectory.Substring(selectedModDirectory.LastIndexOf('\\') + 1, selectedModDirectory.Length - selectedModDirectory.LastIndexOf('\\') - 1) + "-" + file.Name;
                ModObject[ObjectKey] = (GameObject)AssetDatabase.LoadAssetAtPath(EditorPrefs.GetString("Object" + ObjectKey), typeof(GameObject));
                string jsonContents = File.ReadAllText(file.FullName);

                if (jsonContents == "")
                {
                    return;
                }

                GUILayout.BeginHorizontal();
                if (jsonContents.Substring(jsonContents.IndexOf("\"id\": \"") + 7).Substring(0, jsonContents.Substring(jsonContents.IndexOf("\"id\": \"") + 7).IndexOf("\"")) == "")
                {
                    GUILayout.EndHorizontal();
                    return;
                }
                GUILayout.Label(jsonContents.Substring(jsonContents.IndexOf("\"id\": \"") + 7).Substring(0, jsonContents.Substring(jsonContents.IndexOf("\"id\": \"") + 7).IndexOf("\"")));
                GUILayout.BeginVertical();

                if (ModObject.ContainsKey(ObjectKey))
                {
                    ModObject[ObjectKey] = (GameObject)EditorGUILayout.ObjectField(ModObject[ObjectKey], typeof(GameObject), false);
                }

                if (ModObject[ObjectKey] && AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(ModObject[ObjectKey])).assetBundleName == "")
                {
                    GUILayout.Label("Prefab has no asset bundle assigned.");
                }
                GUILayout.EndVertical();
                if (ModObject[ObjectKey] && AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(ModObject[ObjectKey])).assetBundleName == "")
                {
                    GUILayout.Label(EditorGUIUtility.FindTexture("console.warnicon"));
                    EditorGUI.BeginDisabledGroup(true);
                    GUILayout.Button("Edit Weapon");
                    EditorGUI.EndDisabledGroup();
                }
                else
                { //EDIT EXISTING WEAPON JSON
                    if (!ModObject[ObjectKey])
                    {
                        GUI.enabled = false;
                    }
                    if (GUILayout.Button("Edit Weapon"))
                    {
                        openJson = file.FullName;
                        WeaponJsonBuilder.prefabKey = ObjectKey;
                        GetWindow <WeaponJsonBuilder>("Item JSON Builder");
                    }
                    GUI.enabled = true;
                }

                if (ModObject[ObjectKey])
                {
                    EditorPrefs.SetString("Object" + ObjectKey, AssetDatabase.GetAssetPath(ModObject[ObjectKey]));
                }
                try
                {
                    GUILayout.FlexibleSpace();
                }
                catch (Exception) { }
                GUILayout.EndHorizontal();
                GUILayout.Space(5);
            }
        }
Exemplo n.º 14
0
 private void OnFocus()
 {
     streamingAssetsDirectory = EditorPrefs.GetString("streamingassetsDir", streamingAssetsDirectory);
     selectedModDirectory     = EditorPrefs.GetString("selectedMod", selectedModDirectory);
 }
 public void OnClick(GameObject[] affectedObjectsArray)
 {
     CustomModule.SHOW_StringInput("Find:", EditorPrefs.GetString("EModules/MultyRenamer/Find", ""), (find) =>
                                   { if (string.IsNullOrEmpty(find))
                                     {
                                         return;
                                     }
                                     EditorPrefs.SetString("EModules/MultyRenamer/Find", find);
                                     CustomModule.SHOW_StringInput("Replace:", EditorPrefs.GetString("EModules/MultyRenamer/Replace", ""), (replace) =>
                                                                   { EditorPrefs.SetString("EModules/MultyRenamer/Replace", replace);
                                   foreach (var item in affectedObjectsArray)
                                   {
                                       if (!item)
                                       {
                                           continue;
                                       }
                                       Undo.RecordObject(item, "Multy Renamer");
                                       item.name = item.name.Replace(find, replace);
                                       EditorUtility.SetDirty(item);
                                   }
                                                                   }); });
 }
Exemplo n.º 16
0
 private static void FinalCall()
 {
     PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup, EditorPrefs.GetString(DefineKey));
     EditorPrefs.DeleteKey(DefineKey);
 }
Exemplo n.º 17
0
        // ================================================================================
        //  save and load user values
        // --------------------------------------------------------------------------------

        private void LoadUserConfig()
        {
            if (EditorPrefs.HasKey(PREFS_PREFIX + "asepritePath"))
            {
                _asepritePath = EditorPrefs.GetString(PREFS_PREFIX + "asepritePath");
            }
            else
            {
                _asepritePath = AsepriteImporter.standardApplicationPath;

                if (!File.Exists(_asepritePath))
                {
                    _asepritePath = "";
                }
            }

            if (EditorPrefs.HasKey(PREFS_PREFIX + "spritePixelsPerUnit"))
            {
                _spritePixelsPerUnit = EditorPrefs.GetFloat(PREFS_PREFIX + "spritePixelsPerUnit");
            }
            if (EditorPrefs.HasKey(PREFS_PREFIX + "spriteAlignment"))
            {
                _spriteAlignment = (SpriteAlignment)EditorPrefs.GetInt(PREFS_PREFIX + "spriteAlignment");
            }
            if (EditorPrefs.HasKey(PREFS_PREFIX + "spriteAlignmentCustomX"))
            {
                _spriteAlignmentCustomX = EditorPrefs.GetFloat(PREFS_PREFIX + "spriteAlignmentCustomX");
            }
            if (EditorPrefs.HasKey(PREFS_PREFIX + "spriteAlignmentCustomY"))
            {
                _spriteAlignmentCustomY = EditorPrefs.GetFloat(PREFS_PREFIX + "spriteAlignmentCustomY");
            }

            if (EditorPrefs.HasKey(PREFS_PREFIX + "saveSpritesToSubfolder"))
            {
                _saveSpritesToSubfolder = EditorPrefs.GetBool(PREFS_PREFIX + "saveSpritesToSubfolder");
            }
            if (EditorPrefs.HasKey(PREFS_PREFIX + "saveAnimationsToSubfolder"))
            {
                _saveAnimationsToSubfolder = EditorPrefs.GetBool(PREFS_PREFIX + "saveAnimationsToSubfolder");
            }

            if (EditorPrefs.HasKey(PREFS_PREFIX + "baseControllerPath"))
            {
                string baseControllerPath = EditorPrefs.GetString(PREFS_PREFIX + "baseControllerPath");
                if (!string.IsNullOrEmpty(baseControllerPath))
                {
                    _baseController = AssetDatabase.LoadAssetAtPath <RuntimeAnimatorController>(baseControllerPath);
                }
            }

            if (EditorPrefs.HasKey(PREFS_PREFIX + "nonLoopCount"))
            {
                _animationNamesThatDoNotLoop = new List <string>();
                int count = EditorPrefs.GetInt(PREFS_PREFIX + "nonLoopCount");

                for (int i = 0; i < count; i++)
                {
                    if (EditorPrefs.HasKey(PREFS_PREFIX + "nonLoopCount" + i.ToString()))
                    {
                        _animationNamesThatDoNotLoop.Add(EditorPrefs.GetString(PREFS_PREFIX + "nonLoopCount" + i.ToString()));
                    }
                }
            }

            CheckIfApplicationIsValid();
        }
        public void OnPostBuildPlayerScriptDLLs(BuildReport report)
        {
            BurstPlatformAotSettings aotSettingsForTarget = BurstPlatformAotSettings.GetOrCreateSettings(report.summary.platform);

            // Early exit if burst is not activated or the platform is not supported
            if (aotSettingsForTarget.DisableBurstCompilation || !IsSupportedPlatform(report.summary.platform))
            {
                return;
            }

            // Collect all method signatures
            var methodsToCompile = BurstReflection.FindExecuteMethods(AssembliesType.Player);

            if (methodsToCompile.Count == 0)
            {
                return; // Nothing to do
            }

            // Prepare options

            // We are grouping methods per their compiler options (float precision...etc)
            var methodGroups = new Dictionary <string, List <string> >();

            for (var i = 0; i < methodsToCompile.Count; i++)
            {
                var burstCompileTarget = methodsToCompile[i];
                if (!burstCompileTarget.IsSupported)
                {
                    continue;
                }

                var methodStr           = BurstCompilerService.GetMethodSignature(burstCompileTarget.Method);
                var methodFullSignature = methodStr + "--" + Hash128.Compute(methodStr);

                if (aotSettingsForTarget.DisableOptimisations)
                {
                    burstCompileTarget.Options.DisableOptimizations = true;
                }

                burstCompileTarget.Options.EnableBurstSafetyChecks = !aotSettingsForTarget.DisableSafetyChecks;

                string optionsAsStr;
                if (burstCompileTarget.TryGetOptionsAsString(false, out optionsAsStr))
                {
                    List <string> methodOptions;
                    if (!methodGroups.TryGetValue(optionsAsStr, out methodOptions))
                    {
                        methodOptions = new List <string>();
                        methodGroups.Add(optionsAsStr, methodOptions);
                    }
                    methodOptions.Add(GetOption(OptionAotMethod, methodFullSignature));
                }
            }

            var methodGroupOptions = new List <string>();

            // We should have something like this in the end:
            //
            // --group                1st group of method with the following shared options
            // --float-mode=xxx
            // --method=...
            // --method=...
            //
            // --group                2nd group of methods with the different shared options
            // --float-mode=yyy
            // --method=...
            // --method=...
            if (methodGroups.Count == 1)
            {
                var methodGroup = methodGroups.FirstOrDefault();
                // No need to create a group if we don't have multiple
                methodGroupOptions.Add(methodGroup.Key);
                foreach (var methodOption in methodGroup.Value)
                {
                    methodGroupOptions.Add(methodOption);
                }
            }
            else
            {
                foreach (var methodGroup in methodGroups)
                {
                    methodGroupOptions.Add(GetOption(OptionGroup));
                    methodGroupOptions.Add(methodGroup.Key);
                    foreach (var methodOption in methodGroup.Value)
                    {
                        methodGroupOptions.Add(methodOption);
                    }
                }
            }

            var commonOptions  = new List <string>();
            var targetCpu      = TargetCpu.Auto;
            var targetPlatform = GetTargetPlatformAndDefaultCpu(report.summary.platform, out targetCpu);

            commonOptions.Add(GetOption(OptionPlatform, targetPlatform));

            // TODO: Add support for configuring the optimizations/CPU
            // TODO: Add support for per method options

            var stagingFolder = Path.GetFullPath(TempStagingManaged);
            //Debug.Log($"Burst CompileAot - To Folder {stagingFolder}");

            // Prepare assembly folder list
            var assemblyFolders = new List <string>();

            assemblyFolders.Add(stagingFolder);

            var playerAssemblies = CompilationPipeline.GetAssemblies(AssembliesType.Player);

            foreach (var assembly in playerAssemblies)
            {
                foreach (var assemblyRef in assembly.compiledAssemblyReferences)
                {
                    // Exclude folders with assemblies already compiled in the `folder`
                    var assemblyName = Path.GetFileName(assemblyRef);
                    if (assemblyName != null && File.Exists(Path.Combine(stagingFolder, assemblyName)))
                    {
                        continue;
                    }

                    var directory = Path.GetDirectoryName(assemblyRef);
                    if (directory != null)
                    {
                        var fullPath = Path.GetFullPath(directory);
                        if (IsMonoReferenceAssemblyDirectory(fullPath) || IsDotNetStandardAssemblyDirectory(fullPath))
                        {
                            // Don't pass reference assemblies to burst because they contain methods without implementation
                            // If burst accidentally resolves them, it will emit calls to burst_abort.
                            fullPath = Path.Combine(EditorApplication.applicationContentsPath, "MonoBleedingEdge/lib/mono/unityaot");
                            fullPath = Path.GetFullPath(fullPath); // GetFullPath will normalize path separators to OS native format
                            if (!assemblyFolders.Contains(fullPath))
                            {
                                assemblyFolders.Add(fullPath);
                            }

                            fullPath = Path.Combine(fullPath, "Facades");
                            if (!assemblyFolders.Contains(fullPath))
                            {
                                assemblyFolders.Add(fullPath);
                            }
                        }
                        else if (!assemblyFolders.Contains(fullPath))
                        {
                            assemblyFolders.Add(fullPath);
                        }
                    }
                }
            }

            commonOptions.AddRange(assemblyFolders.Select(folder => GetOption(OptionAotAssemblyFolder, folder)));

            var combinations = new List <BurstOutputCombination>();

            if (targetPlatform == TargetPlatform.macOS)
            {
                // NOTE: OSX has a special folder for the plugin
                // Declared in GetStagingAreaPluginsFolder
                // PlatformDependent\OSXPlayer\Extensions\Managed\OSXDesktopStandalonePostProcessor.cs
                combinations.Add(new BurstOutputCombination("UnityPlayer.app/Contents/Plugins", targetCpu));
            }
            else if (targetPlatform == TargetPlatform.iOS)
            {
                var targetArchitecture = (IOSArchitecture)UnityEditor.PlayerSettings.GetArchitecture(report.summary.platformGroup);
                if (targetArchitecture == IOSArchitecture.ARMv7 || targetArchitecture == IOSArchitecture.Universal)
                {
                    // PlatformDependent\iPhonePlayer\Extensions\Common\BuildPostProcessor.cs
                    combinations.Add(new BurstOutputCombination("StaticLibraries", TargetCpu.ARMV7A_NEON32, DefaultLibraryName + "32"));
                }
                if (targetArchitecture == IOSArchitecture.ARM64 || targetArchitecture == IOSArchitecture.Universal)
                {
                    // PlatformDependent\iPhonePlayer\Extensions\Common\BuildPostProcessor.cs
                    combinations.Add(new BurstOutputCombination("StaticLibraries", TargetCpu.ARMV8A_AARCH64, DefaultLibraryName + "64"));
                }
            }
            else if (targetPlatform == TargetPlatform.Android)
            {
                // Set the ANDROID_NDK_ROOT so BCL knows where to find the Android toolchain
                if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("ANDROID_NDK_ROOT")))
                {
                    var ndkRoot = EditorPrefs.GetString("AndroidNdkRoot");
                    if (!string.IsNullOrEmpty(ndkRoot))
                    {
                        Environment.SetEnvironmentVariable("ANDROID_NDK_ROOT", ndkRoot);
                    }
                }

                var androidTargetArch = UnityEditor.PlayerSettings.Android.targetArchitectures;
                if ((androidTargetArch & AndroidArchitecture.ARMv7) != 0)
                {
                    combinations.Add(new BurstOutputCombination("libs/armeabi-v7a", TargetCpu.ARMV7A_NEON32));
                }
                if ((androidTargetArch & AndroidArchitecture.ARM64) != 0)
                {
                    combinations.Add(new BurstOutputCombination("libs/arm64-v8a", TargetCpu.ARMV8A_AARCH64));
                }
                if ((androidTargetArch & AndroidArchitecture.X86) != 0)
                {
                    combinations.Add(new BurstOutputCombination("libs/x86", TargetCpu.X86_SSE2));
                }
            }
            else if (targetPlatform == TargetPlatform.UWP)
            {
                // TODO: Make it configurable for x86 (sse2, sse4)
                combinations.Add(new BurstOutputCombination("Plugins/x64", TargetCpu.X64_SSE4));
                combinations.Add(new BurstOutputCombination("Plugins/x86", TargetCpu.X86_SSE2));
                combinations.Add(new BurstOutputCombination("Plugins/ARM", TargetCpu.THUMB2_NEON32));
                combinations.Add(new BurstOutputCombination("Plugins/ARM64", TargetCpu.ARMV8A_AARCH64));
            }
            else
            {
                combinations.Add(new BurstOutputCombination("Data/Plugins/", targetCpu));
            }

            foreach (var combination in combinations)
            {
                // Gets the output folder
                var stagingOutputFolder = Path.GetFullPath(Path.Combine(TempStaging, combination.OutputPath));
                var outputFilePrefix    = Path.Combine(stagingOutputFolder, combination.LibraryName);

                var options = new List <string>(commonOptions);
                options.Add(GetOption(OptionAotOutputPath, outputFilePrefix));
                options.Add(GetOption(OptionTarget, combination.TargetCpu));

                if (targetPlatform == TargetPlatform.iOS)
                {
                    options.Add(GetOption(OptionStaticLinkage));
                }

                // finally add method group options
                options.AddRange(methodGroupOptions);

                var responseFile = Path.GetTempFileName();
                File.WriteAllLines(responseFile, options);

                //Debug.Log("Burst compile with response file: " + responseFile);

                try
                {
                    Runner.RunManagedProgram(Path.Combine(BurstLoader.RuntimePath, BurstAotCompilerExecutable), "--debug=true " + "@" + responseFile, Application.dataPath + "/..", new BclParser(), null);
                }
                catch (Exception e)
                {
                    Debug.LogError(e.ToString());
                }
            }
        }
Exemplo n.º 19
0
        /// <summary>
        /// Update Unity Editor Preferences
        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();
        }
Exemplo n.º 20
0
    void OnGUI()
    {
        if (remembersettings)
        {
            if (tosavegozz.Count == 0)
            {
                if (EditorPrefs.HasKey("tosaveZZOG"))
                {
                    string mysavezz911911;
                    mysavezz911911 = EditorPrefs.GetString("tosaveZZOG");
                    Debug.Log(mysavezz911911);
                    if (mysavezz911911 == null)
                    {
                        tosavegozz = (List <PMGameObject>)JSONExt.Deserialize(mysavezz911911);
                    }
                }
            }
            else
            {
                string tosaveGOZZ6969 = JSONExt.Serialize(tosavegozz);
                Debug.Log(tosaveGOZZ6969);
                EditorPrefs.SetString("tosaveZZOG", tosaveGOZZ6969);
            }
        }
        EditorApplication.playModeStateChanged -= ChangedPM;
        EditorApplication.playModeStateChanged += ChangedPM;
        if (whitendblack == null)
        {
            whitendblack                   = new GUIStyle();
            whitendblack.fontSize          = 16;
            whitendblack.normal.background = MakeTex(2, 2, Color.white);
            whitendblack.normal.textColor  = Color.black;
        }
        showcomponents   = GUILayout.Toggle(showcomponents, "Show Components");
        showfields       = GUILayout.Toggle(showfields, "Show Fields");
        serializefields  = GUILayout.Toggle(serializefields, "Serialize All Fields");
        serializeChildzz = GUILayout.Toggle(serializefields, "Serialize Children");
        GUILayout.Label("Tags to Save", EditorStyles.boldLabel);
        ShowList(ref tagzz911420, ",", ref sotbox);
        GUILayout.Label("Layers to Save", EditorStyles.boldLabel);
        ShowList(ref layerzz911420, ",", ref sotbox22);
        for (int curi8778 = 1; curi8778 < tagzz911420.Count + 1; curi8778++)
        {
            try
            {
                List <GameObject> tagzzobzz6996;
                tagzzobzz6996 = GameObject.FindGameObjectsWithTag(tagzz911420[curi8778 - 1]).ToList <GameObject>();
                for (int curi9449 = 1; curi9449 < tosavegozz.Count + 1; curi9449++)
                {
                    if (!ContainsGMObjects(tosavegozz, tagzzobzz6996[curi9449]))
                    {
                        tosavegozz.Add(new PMGameObject(tagzzobzz6996[curi9449], true));
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
        List <GameObject> layerzzobzz6996;

        GUILayout.Label("GameObjects to Save", EditorStyles.boldLabel);
        List <PMGameObject> toremove9969 = new List <PMGameObject>();

        for (int curi = 1; curi < tosavegozz.Count + 1; curi++)
        {
            PMGameObject gmobj;
            gmobj = tosavegozz[curi - 1];
            EditorGUI.indentLevel = 0;
            gmobj.enabled         = EditorGUILayout.BeginToggleGroup("Object #" + curi.ToString() + " - " + gmobj.myobject.name, gmobj.enabled);
            foreach (Component gmcomp in gmobj.myobject.GetComponents <Component>())
            {
                if (gmobj.mycomponents.Where(x => x.mycomponent == gmcomp).Count() == 0)
                {
                    PMComponent mycomp9886;
                    mycomp9886 = new PMComponent(gmcomp, true);
                    foreach (FieldInfo fld6991113373371 in gmcomp.GetType().GetFields())
                    {
                        mycomp9886.myproperties.Add(new PMProperty(fld6991113373371.Name, true, PMPropertyTypeTeh.Field));
                    }
                    foreach (PropertyInfo prop3371133791169 in gmcomp.GetType().GetProperties())
                    {
                        if (prop3371133791169.CanRead && prop3371133791169.CanWrite)
                        {
                            mycomp9886.myproperties.Add(new PMProperty(prop3371133791169.Name, true, PMPropertyTypeTeh.Property));
                        }
                    }
                    gmobj.mycomponents.Add(mycomp9886);
                }
            }
            List <PMComponent> toremove6699 = new List <PMComponent>();
            foreach (PMComponent gmcomp22 in gmobj.mycomponents)
            {
                if (gmobj.myobject.GetComponents <Component>().Where(x => x == gmcomp22.mycomponent).Count() == 0)
                {
                    toremove6699.Add(gmcomp22);
                }
            }
            foreach (PMComponent gmremoveem in toremove6699)
            {
                //gmobj.mycomponents.Remove(gmremoveem);
            }
            if (showcomponents)
            {
                for (int curi3 = 1; curi3 < gmobj.mycomponents.Count + 1; curi3++)
                {
                    PMComponent gmcomp;
                    gmcomp = gmobj.mycomponents[curi3 - 1];
                    EditorGUI.indentLevel = 2;
                    gmcomp.enabled        = EditorGUILayout.BeginToggleGroup("Component #" + curi3.ToString() + " - " + gmcomp.mycomponent.GetType().FullName, gmcomp.enabled);
                    if (showfields)
                    {
                        for (int curi4 = 1; curi4 < gmcomp.myproperties.Count + 1; curi4++)
                        {
                            PMProperty gmprop;
                            gmprop = gmcomp.myproperties[curi4 - 1];
                            EditorGUI.indentLevel = 4;
                            gmprop.enabled        = EditorGUILayout.BeginToggleGroup("Field #" + curi4.ToString() + " - " + gmprop.name, gmprop.enabled);
                            EditorGUILayout.EndToggleGroup();
                        }
                        if (GUILayout.Button("Select All", new GUILayoutOption[] { GUILayout.ExpandWidth(false) }))
                        {
                            for (int curi4 = 1; curi4 < gmcomp.myproperties.Count + 1; curi4++)
                            {
                                PMProperty gmprop;
                                gmprop         = gmcomp.myproperties[curi4 - 1];
                                gmprop.enabled = true;
                            }
                        }
                        if (GUILayout.Button("Deselect All", new GUILayoutOption[] { GUILayout.ExpandWidth(false) }))
                        {
                            for (int curi4 = 1; curi4 < gmcomp.myproperties.Count + 1; curi4++)
                            {
                                PMProperty gmprop;
                                gmprop         = gmcomp.myproperties[curi4 - 1];
                                gmprop.enabled = false;
                            }
                        }
                    }
                    EditorGUILayout.EndToggleGroup();
                }
            }
            EditorGUILayout.EndToggleGroup();
            if (GUILayout.Button("-", whitendblack, new GUILayoutOption[] { GUILayout.Width(21), GUILayout.Height(21) }))
            {
                toremove9969.Add(gmobj);
            }
            curi += 1;
        }
        foreach (PMGameObject gmgm911911 in toremove9969)
        {
            tosavegozz.Remove(gmgm911911);
        }
        if (GUIExt.DropArea(ref myobjzz, whitendblack, "+", 21, 21, false, false))
        {
            foreach (object myobjtmmt in myobjzz)
            {
                GameObject mb6969;
                mb6969 = (GameObject)myobjtmmt;
                tosavegozz.Add(new PMGameObject(mb6969, true));
            }
        }
    }
Exemplo n.º 21
0
    protected override void OnGUI()
    {
        mainHeaderText = GDEStrings.DefineDataHeader;
        headerColor    = EditorPrefs.GetString(GDEConstants.DefineDataColorKey, GDEConstants.DefineDataColor);

        base.OnGUI();

        DrawExpandCollapseAllFoldout(GDEItemManager.AllSchemas.Keys.ToArray(), GDEStrings.SchemaListHeader);

        float currentGroupHeightTotal = CalculateGroupHeightsTotal();

        scrollViewHeight          = HeightToBottomOfWindow();
        scrollViewY               = TopOfLine();
        verticalScrollbarPosition = GUI.BeginScrollView(new Rect(currentLinePosition, scrollViewY, FullWindowWidth(), scrollViewHeight),
                                                        verticalScrollbarPosition,
                                                        new Rect(currentLinePosition, scrollViewY, ScrollViewWidth(), currentGroupHeightTotal));

        foreach (KeyValuePair <string, Dictionary <string, object> > schema in GDEItemManager.AllSchemas)
        {
            // If we are filtered out, return
            if (ShouldFilter(schema.Key, schema.Value))
            {
                continue;
            }

            float currentGroupHeight;
            if (!groupHeights.TryGetValue(schema.Key, out currentGroupHeight))
            {
                currentGroupHeight = GDEConstants.LineHeight;
            }

            if (IsVisible(currentGroupHeight))
            {
                DrawEntry(schema.Key, schema.Value);
            }
            else
            {
                NewLine(currentGroupHeight / GDEConstants.LineHeight);
            }
        }
        GUI.EndScrollView();

        //Remove any schemas that were deleted
        foreach (string deletedSchemaKey in deletedSchemas)
        {
            Remove(deletedSchemaKey);
        }
        deletedSchemas.Clear();

        // Rename any schemas that were renamed
        string error;

        foreach (KeyValuePair <string, string> pair in renamedSchemas)
        {
            if (!GDEItemManager.RenameSchema(pair.Key, pair.Value, out error))
            {
                EditorUtility.DisplayDialog(GDEStrings.ErrorLbl, string.Format("Couldn't rename {0} to {1}: {2}", pair.Key, pair.Value, error), GDEStrings.OkLbl);
            }
        }
        renamedSchemas.Clear();
    }
Exemplo n.º 22
0
        private static void FixSDK()
        {
            //bool update = false;

            if (UnityEditorInternal.InternalEditorUtility.inBatchMode)
            {
                return;
            }

            try {
                /*string[] oldFiles1 = {
                 *      "Assets/GameSparks/Platforms/IOS",
                 *
                 *      "Assets/Plugins/GameSparks.Api.dll.mdb.meta",
                 *      "Assets/Plugins/GameSparks.Api.dll.mdb",
                 *
                 *      "Assets/Plugins/iOS/GameSparksWebSocket.h",
                 *      "Assets/Plugins/iOS/GameSparksWebSocket.m",
                 *      "Assets/Plugins/iOS/SRWebSocket.h",
                 *      "Assets/Plugins/iOS/SRWebSocket.m",
                 *      "Assets/Plugins/iOS/SocketController.h",
                 *      "Assets/Plugins/iOS/SocketController.m",
                 *
                 *      "Assets/GameSparks/Editor/GameSparksPostprocessScript.cs",
                 *      "Assets/GameSparks/Editor/mod_pbxproj.py",
                 *      "Assets/GameSparks/Editor/mod_pbxproj.pyc",
                 *      "Assets/GameSparks/Editor/post_process.py"
                 * };
                 *
                 * string[] oldFiles2 = {
                 *      "Assets/Plugins/gamesparksunityosx.bundle/Contents/_CodeSignature/CodeResources.meta",
                 *      "Assets/Plugins/gamesparksunityosx.bundle/Contents/_CodeSignature/CodeResources",
                 *      "Assets/Plugins/gamesparksunityosx.bundle/Contents/MacOS/gamesparksunityosx.meta",
                 *      "Assets/Plugins/gamesparksunityosx.bundle/Contents/MacOS/gamesparksunityosx",
                 *      "Assets/Plugins/gamesparksunityosx.bundle/Contents/Info.plist.meta",
                 *      "Assets/Plugins/gamesparksunityosx.bundle/Contents/Info.plist",
                 *      "Assets/Plugins/iOS/GSExternal.h.meta",
                 *      "Assets/Plugins/iOS/GSExternal.h",
                 *      "Assets/Plugins/iOS/GSExternal.m.meta",
                 *      "Assets/Plugins/iOS/GSExternal.m",
                 *      "Assets/Plugins/Metro/GameSparks.dll.meta",
                 *      "Assets/Plugins/Metro/GameSparks.dll",
                 *      "Assets/Plugins/Metro/GameSparks.pri.meta",
                 *      "Assets/Plugins/Metro/GameSparks.pri",
                 *      "Assets/Plugins/Metro/GameSparks.XML.meta",
                 *      "Assets/Plugins/Metro/GameSparks.XML",
                 *      "Assets/Plugins/Metro/GameSparksRT.dll.meta",
                 *      "Assets/Plugins/Metro/GameSparksRT.dll",
                 *      "Assets/Plugins/Metro/GameSparksRT.pri.meta",
                 *      "Assets/Plugins/Metro/GameSparksRT.pri",
                 *      "Assets/Plugins/Metro/GameSparksRT.xml.meta",
                 *      "Assets/Plugins/Metro/GameSparksRT.xml",
                 *      "Assets/Plugins/WebGL/GameSparks.jslib.meta",
                 *      "Assets/Plugins/WebGL/GameSparks.jslib",
                 *      "Assets/Plugins/WP8/GameSparks.dll.meta",
                 *      "Assets/Plugins/WP8/GameSparks.dll",
                 *      "Assets/Plugins/WP8/GameSparks.XML.meta",
                 *      "Assets/Plugins/WP8/GameSparks.XML",
                 *      "Assets/Plugins/x86_64/GameSparksNative.dll.meta",
                 *      "Assets/Plugins/x86_64/GameSparksNative.dll",
                 *      "Assets/Plugins/XboxOne/GameSparksNative.dll.meta",
                 *      "Assets/Plugins/XboxOne/GameSparksNative.dll",
                 *      "Assets/Plugins/BouncyCastle_GameSparks.dll.meta",
                 *      "Assets/Plugins/BouncyCastle_GameSparks.dll",
                 *      "Assets/Plugins/GameSparks.Api.dll.meta",
                 *      "Assets/Plugins/GameSparks.Api.dll",
                 *      "Assets/Plugins/GameSparks.Api.XML.meta",
                 *      "Assets/Plugins/GameSparks.Api.XML",
                 *      "Assets/Plugins/GameSparks.dll.meta",
                 *      "Assets/Plugins/GameSparks.dll",
                 *      "Assets/Plugins/GameSparks.XML.meta",
                 *      "Assets/Plugins/GameSparks.XML",
                 *      "Assets/Plugins/GameSparksRT.dll.meta",
                 *      "Assets/Plugins/GameSparksRT.dll",
                 *      "Assets/Plugins/GameSparksRT.xml.meta",
                 *      "Assets/Plugins/GameSparksRT.xml"
                 * };
                 *
                 * foreach (string oldFile in oldFiles1) {
                 *      if (File.Exists (oldFile)) {
                 *              File.Delete (oldFile);
                 *
                 *              update = true;
                 *      } else if (Directory.Exists (oldFile)) {
                 *              Directory.Delete (oldFile, true);
                 *
                 *              update = true;
                 *      }
                 * }
                 *
                 * if (!update) {
                 *      foreach (string oldFile in oldFiles2) {
                 *              if (File.Exists (oldFile) || Directory.Exists (oldFile)) {
                 *                      update = true;
                 *
                 *                      break;
                 *              }
                 *      }
                 * }*/

                if (/*update ||*/ !EditorPrefs.GetBool(PlayerSettings.productName + "_GameSparksPopUpSeen", false) ||
                    !EditorPrefs.GetString(PlayerSettings.productName + "_GameSparksVersion").Equals(GameSparks.Core.GS.Version))
                {
                    EditorPrefs.SetBool(PlayerSettings.productName + "_GameSparksPopUpSeen", true);
                    EditorPrefs.SetString(PlayerSettings.productName + "_GameSparksVersion", GameSparks.Core.GS.Version);

                    /*string baseDir = "Plugins";
                     * string targetDir = "Assets/GameSparks/Plugins";
                     * DirectoryInfo dirInfo = new DirectoryInfo (targetDir);
                     * DirectoryInfo dirInfo2 = new DirectoryInfo ("Assets/" + baseDir);
                     *
                     * if (!dirInfo.Exists) {
                     *      Directory.CreateDirectory (dirInfo.ToString ());
                     * }
                     *
                     * foreach (string file in oldFiles2) {
                     *      try {
                     *              FileInfo fileInfo = new FileInfo (file);
                     *
                     *              string relativePath = fileInfo.DirectoryName;
                     *
                     *              int index = relativePath.IndexOf (baseDir);
                     *
                     *              if (index + baseDir.Length < relativePath.Length) {
                     *                      index++;
                     *              }
                     *
                     *              relativePath = relativePath.Substring (index + baseDir.Length);
                     *
                     *              DirectoryInfo dirInfo3 = new DirectoryInfo (dirInfo + "/" + relativePath);
                     *
                     *              if (!dirInfo3.Exists) {
                     *                      Directory.CreateDirectory (dirInfo3.ToString ());
                     *              }
                     *
                     *              if ((new FileInfo (dirInfo3 + "/" + fileInfo.Name)).Exists) {
                     *                      if (fileInfo.Exists) {
                     *                              fileInfo.Delete ();
                     *                      }
                     *              } else {
                     *                      fileInfo.MoveTo (dirInfo3 + "/" + fileInfo.Name);
                     *              }
                     *      } catch {
                     *      }
                     * }*/

                    AssetDatabase.Refresh();

                    //RecursiveDeleteFolders (dirInfo2);

                    var assembly = Assembly.GetAssembly(typeof(UnityEditor.ActiveEditorTracker));
#if UNITY_2017_1_OR_NEWER
                    var type = assembly.GetType("UnityEditor.LogEntries");
#else
                    var type = assembly.GetType("UnityEditorInternal.LogEntries");
#endif
                    var method = type.GetMethod("Clear");
                    method.Invoke(new object(), null);

                    Selection.activeObject = GetOrCreateSettingsAsset();

                    ShowInspector();

                    GameSparksPopUp.Init();
                }
            } catch {
            }
        }
Exemplo n.º 23
0
        internal void LoadPreferences()
        {
            if (EditorPrefs.GetInt(PreferenceKeys.StoredPreferenceVersion, k_CurrentPreferencesVersion) != k_CurrentPreferencesVersion)
            {
                EditorPrefs.SetInt(PreferenceKeys.StoredPreferenceVersion, k_CurrentPreferencesVersion);
                Preferences.ResetPrefs();
            }

            string snapSettingsJson = EditorPrefs.GetString(PreferenceKeys.SnapSettings);

            m_SnapSettings = new SnapSettings();
            JsonUtility.FromJsonOverwrite(snapSettingsJson, m_SnapSettings);

            m_SnapMethod = (SnapMethod)EditorPrefs.GetInt(PreferenceKeys.SnapMethod, (int)Defaults.SnapMethod);

#if !SHORTCUT_MANAGER
            m_AxisConstraintKey = EditorPrefs.HasKey(PreferenceKeys.ToggleAxisConstraint)
                                ? (KeyCode)EditorPrefs.GetInt(PreferenceKeys.ToggleAxisConstraint)
                                : KeyCode.S;
            m_TempDisableKey = EditorPrefs.HasKey(PreferenceKeys.ToggleDisable)
                                ? (KeyCode)EditorPrefs.GetInt(PreferenceKeys.ToggleDisable)
                                : KeyCode.D;
            m_IncreaseGridSizeShortcut = EditorPrefs.HasKey(PreferenceKeys.IncreaseGridSize)
                                ? (KeyCode)EditorPrefs.GetInt(PreferenceKeys.IncreaseGridSize)
                                : KeyCode.Equals;
            m_DecreaseGridSizeShortcut = EditorPrefs.HasKey(PreferenceKeys.DecreaseGridSize)
                                ? (KeyCode)EditorPrefs.GetInt(PreferenceKeys.DecreaseGridSize)
                                : KeyCode.Minus;
            m_NudgePerspectiveBackwardShortcut = EditorPrefs.HasKey(PreferenceKeys.NudgePerspectiveBackward)
                                ? (KeyCode)EditorPrefs.GetInt(PreferenceKeys.NudgePerspectiveBackward)
                                : KeyCode.LeftBracket;
            m_NudgePerspectiveForwardShortcut = EditorPrefs.HasKey(PreferenceKeys.NudgePerspectiveForward)
                                ? (KeyCode)EditorPrefs.GetInt(PreferenceKeys.NudgePerspectiveForward)
                                : KeyCode.RightBracket;
            m_ResetGridShortcutModifiers = EditorPrefs.HasKey(PreferenceKeys.ResetGridShortcutModifiers)
                                ? (KeyCode)EditorPrefs.GetInt(PreferenceKeys.ResetGridShortcutModifiers)
                                : KeyCode.Alpha0;
            m_CyclePerspectiveShortcut = EditorPrefs.HasKey(PreferenceKeys.CyclePerspective)
                                ? (KeyCode)EditorPrefs.GetInt(PreferenceKeys.CyclePerspective)
                                : KeyCode.Backslash;
#endif

            m_GridIsLocked = EditorPrefs.GetBool(PreferenceKeys.LockGrid);

            menuOpen = EditorPrefs.GetBool(PreferenceKeys.ProGridsIsExtended, true);

            if (m_GridIsLocked)
            {
                if (EditorPrefs.HasKey(PreferenceKeys.LockedGridPivot))
                {
                    string   piv      = EditorPrefs.GetString(PreferenceKeys.LockedGridPivot);
                    string[] pivsplit = piv.Replace("(", "").Replace(")", "").Split(',');

                    float x, y, z;

                    if (float.TryParse(pivsplit[0], out x) &&
                        float.TryParse(pivsplit[1], out y) &&
                        float.TryParse(pivsplit[2], out z))
                    {
                        m_Pivot.x = x;
                        m_Pivot.y = y;
                        m_Pivot.z = z;
                    }
                }
            }

            FullGridEnabled = EditorPrefs.GetBool(PreferenceKeys.PerspGrid);

            m_RenderPlane    = EditorPrefs.HasKey(PreferenceKeys.GridAxis) ? (Axis)EditorPrefs.GetInt(PreferenceKeys.GridAxis) : Axis.Y;
            m_DrawGrid       = EditorPrefs.GetBool(PreferenceKeys.ShowGrid, Defaults.ShowGrid);
            m_PredictiveGrid = EditorPrefs.GetBool(PreferenceKeys.PredictiveGrid, Defaults.PredictiveGrid);
        }
Exemplo n.º 24
0
 public static string LoadString(string key)
 {
     return(EditorPrefs.GetString(key, string.Empty));
 }
Exemplo n.º 25
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)\"");

                // 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);
                }
            }
        }
Exemplo n.º 26
0
    public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties)
    {
        IOUtils.Init();
        Material mat = materialEditor.target as Material;

        if (mat == null)
        {
            return;
        }

        m_instance = materialEditor;

        if (!m_initialized)
        {
            Init();
            m_initialized           = true;
            Undo.undoRedoPerformed += UndoRedoPerformed;
        }

        if (Event.current.type == EventType.Repaint &&
            mat.HasProperty(IOUtils.DefaultASEDirtyCheckId) &&
            mat.GetInt(IOUtils.DefaultASEDirtyCheckId) == 1)
        {
            mat.SetInt(IOUtils.DefaultASEDirtyCheckId, 0);
            UIUtils.ForceUpdateFromMaterial();
            //Event.current.Use();
        }

        if (materialEditor.isVisible)
        {
            GUILayout.BeginVertical();
            {
                GUILayout.Space(3);
                if (GUILayout.Button("Open in Shader Editor"))
                {
#if UNITY_2018_3_OR_NEWER
                    ASEPackageManagerHelper.SetupLateMaterial(mat);
#else
                    AmplifyShaderEditorWindow.LoadMaterialToASE(mat);
#endif
                }

                GUILayout.BeginHorizontal();
                {
                    if (GUILayout.Button(CopyButtonStr))
                    {
                        System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;

                        Shader shader        = mat.shader;
                        int    propertyCount = UnityEditor.ShaderUtil.GetPropertyCount(shader);
                        string allProperties = string.Empty;
                        for (int i = 0; i < propertyCount; i++)
                        {
                            UnityEditor.ShaderUtil.ShaderPropertyType type = UnityEditor.ShaderUtil.GetPropertyType(shader, i);
                            string name     = UnityEditor.ShaderUtil.GetPropertyName(shader, i);
                            string valueStr = string.Empty;
                            switch (type)
                            {
                            case UnityEditor.ShaderUtil.ShaderPropertyType.Color:
                            {
                                Color value = mat.GetColor(name);
                                valueStr = value.r.ToString() + IOUtils.VECTOR_SEPARATOR +
                                           value.g.ToString() + IOUtils.VECTOR_SEPARATOR +
                                           value.b.ToString() + IOUtils.VECTOR_SEPARATOR +
                                           value.a.ToString();
                            }
                            break;

                            case UnityEditor.ShaderUtil.ShaderPropertyType.Vector:
                            {
                                Vector4 value = mat.GetVector(name);
                                valueStr = value.x.ToString() + IOUtils.VECTOR_SEPARATOR +
                                           value.y.ToString() + IOUtils.VECTOR_SEPARATOR +
                                           value.z.ToString() + IOUtils.VECTOR_SEPARATOR +
                                           value.w.ToString();
                            }
                            break;

                            case UnityEditor.ShaderUtil.ShaderPropertyType.Float:
                            {
                                float value = mat.GetFloat(name);
                                valueStr = value.ToString();
                            }
                            break;

                            case UnityEditor.ShaderUtil.ShaderPropertyType.Range:
                            {
                                float value = mat.GetFloat(name);
                                valueStr = value.ToString();
                            }
                            break;

                            case UnityEditor.ShaderUtil.ShaderPropertyType.TexEnv:
                            {
                                Texture value = mat.GetTexture(name);
                                valueStr = AssetDatabase.GetAssetPath(value);
                                Vector2 offset = mat.GetTextureOffset(name);
                                Vector2 scale  = mat.GetTextureScale(name);
                                valueStr += IOUtils.VECTOR_SEPARATOR + scale.x.ToString() +
                                            IOUtils.VECTOR_SEPARATOR + scale.y.ToString() +
                                            IOUtils.VECTOR_SEPARATOR + offset.x.ToString() +
                                            IOUtils.VECTOR_SEPARATOR + offset.y.ToString();
                            }
                            break;
                            }

                            allProperties += name + IOUtils.FIELD_SEPARATOR + type + IOUtils.FIELD_SEPARATOR + valueStr;

                            if (i < (propertyCount - 1))
                            {
                                allProperties += IOUtils.LINE_TERMINATOR;
                            }
                        }
                        EditorPrefs.SetString(IOUtils.MAT_CLIPBOARD_ID, allProperties);
                        System.Threading.Thread.CurrentThread.CurrentCulture = System.Threading.Thread.CurrentThread.CurrentUICulture;
                    }

                    if (GUILayout.Button(PasteButtonStr))
                    {
                        System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
                        string propertiesStr = EditorPrefs.GetString(IOUtils.MAT_CLIPBOARD_ID, string.Empty);
                        if (!string.IsNullOrEmpty(propertiesStr))
                        {
                            string[] propertyArr = propertiesStr.Split(IOUtils.LINE_TERMINATOR);
                            bool     validData   = true;
                            try
                            {
                                for (int i = 0; i < propertyArr.Length; i++)
                                {
                                    string[] valuesArr = propertyArr[i].Split(IOUtils.FIELD_SEPARATOR);
                                    if (valuesArr.Length != 3)
                                    {
                                        Debug.LogWarning("Material clipboard data is corrupted");
                                        validData = false;
                                        break;
                                    }
                                    else if (mat.HasProperty(valuesArr[0]))
                                    {
                                        UnityEditor.ShaderUtil.ShaderPropertyType type = (UnityEditor.ShaderUtil.ShaderPropertyType)Enum.Parse(typeof(UnityEditor.ShaderUtil.ShaderPropertyType), valuesArr[1]);
                                        switch (type)
                                        {
                                        case UnityEditor.ShaderUtil.ShaderPropertyType.Color:
                                        {
                                            string[] colorVals = valuesArr[2].Split(IOUtils.VECTOR_SEPARATOR);
                                            if (colorVals.Length != 4)
                                            {
                                                Debug.LogWarning("Material clipboard data is corrupted");
                                                validData = false;
                                                break;
                                            }
                                            else
                                            {
                                                mat.SetColor(valuesArr[0], new Color(Convert.ToSingle(colorVals[0]),
                                                                                     Convert.ToSingle(colorVals[1]),
                                                                                     Convert.ToSingle(colorVals[2]),
                                                                                     Convert.ToSingle(colorVals[3])));
                                            }
                                        }
                                        break;

                                        case UnityEditor.ShaderUtil.ShaderPropertyType.Vector:
                                        {
                                            string[] vectorVals = valuesArr[2].Split(IOUtils.VECTOR_SEPARATOR);
                                            if (vectorVals.Length != 4)
                                            {
                                                Debug.LogWarning("Material clipboard data is corrupted");
                                                validData = false;
                                                break;
                                            }
                                            else
                                            {
                                                mat.SetVector(valuesArr[0], new Vector4(Convert.ToSingle(vectorVals[0]),
                                                                                        Convert.ToSingle(vectorVals[1]),
                                                                                        Convert.ToSingle(vectorVals[2]),
                                                                                        Convert.ToSingle(vectorVals[3])));
                                            }
                                        }
                                        break;

                                        case UnityEditor.ShaderUtil.ShaderPropertyType.Float:
                                        {
                                            mat.SetFloat(valuesArr[0], Convert.ToSingle(valuesArr[2]));
                                        }
                                        break;

                                        case UnityEditor.ShaderUtil.ShaderPropertyType.Range:
                                        {
                                            mat.SetFloat(valuesArr[0], Convert.ToSingle(valuesArr[2]));
                                        }
                                        break;

                                        case UnityEditor.ShaderUtil.ShaderPropertyType.TexEnv:
                                        {
                                            string[] texVals = valuesArr[2].Split(IOUtils.VECTOR_SEPARATOR);
                                            if (texVals.Length != 5)
                                            {
                                                Debug.LogWarning("Material clipboard data is corrupted");
                                                validData = false;
                                                break;
                                            }
                                            else
                                            {
                                                mat.SetTexture(valuesArr[0], AssetDatabase.LoadAssetAtPath <Texture>(texVals[0]));
                                                mat.SetTextureScale(valuesArr[0], new Vector2(Convert.ToSingle(texVals[1]), Convert.ToSingle(texVals[2])));
                                                mat.SetTextureOffset(valuesArr[0], new Vector2(Convert.ToSingle(texVals[3]), Convert.ToSingle(texVals[4])));
                                            }
                                        }
                                        break;
                                        }
                                    }
                                }
                            }
                            catch (Exception e)
                            {
                                Debug.LogException(e);
                                validData = false;
                            }


                            if (validData)
                            {
                                materialEditor.PropertiesChanged();
                                UIUtils.CopyValuesFromMaterial(mat);
                            }
                            else
                            {
                                EditorPrefs.SetString(IOUtils.MAT_CLIPBOARD_ID, string.Empty);
                            }
                        }
                        System.Threading.Thread.CurrentThread.CurrentCulture = System.Threading.Thread.CurrentThread.CurrentUICulture;
                    }
                }
                GUILayout.EndHorizontal();
                GUILayout.Space(5);
            }
            GUILayout.EndVertical();
        }
        EditorGUI.BeginChangeCheck();
        //base.OnGUI( materialEditor, properties );

        // Draw custom properties instead of calling BASE to use single line texture properties
        materialEditor.SetDefaultGUIWidths();

        if (m_infoField == null)
        {
            m_infoField = typeof(MaterialEditor).GetField("m_InfoMessage", BindingFlags.Instance | BindingFlags.NonPublic);
        }

        string info = m_infoField.GetValue(materialEditor) as string;
        if (!string.IsNullOrEmpty(info))
        {
            EditorGUILayout.HelpBox(info, MessageType.Info);
        }
        else
        {
            GUIUtility.GetControlID("EditorTextField".GetHashCode(), FocusType.Passive, new Rect(0f, 0f, 0f, 0f));
        }

        for (int i = 0; i < properties.Length; i++)
        {
            if ((properties[i].flags & (MaterialProperty.PropFlags.HideInInspector | MaterialProperty.PropFlags.PerRendererData)) == MaterialProperty.PropFlags.None)
            {
                if ((properties[i].flags & MaterialProperty.PropFlags.NoScaleOffset) == MaterialProperty.PropFlags.NoScaleOffset)
                {
                    object obj = MaterialPropertyHandlerEx.GetHandler(mat.shader, properties[i].name);
                    if (obj != null)
                    {
                        float height = MaterialPropertyHandlerEx.GetPropertyHeight(obj, properties[i], properties[i].displayName, materialEditor);
                        //Rect rect = (Rect)materialEditor.GetType().InvokeMember( "GetPropertyRect", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.InvokeMethod, null, materialEditor, new object[] { properties[ i ], properties[ i ].displayName, true } );
                        Rect rect = EditorGUILayout.GetControlRect(true, height, EditorStyles.layerMaskField);
                        MaterialPropertyHandlerEx.OnGUI(obj, ref rect, properties[i], new GUIContent(properties[i].displayName), materialEditor);

                        if (MaterialPropertyHandlerEx.PropertyDrawer(obj) != null)
                        {
                            continue;
                        }

                        rect = EditorGUILayout.GetControlRect(true, height, EditorStyles.layerMaskField);
                        materialEditor.TexturePropertyMiniThumbnail(rect, properties[i], properties[i].displayName, string.Empty);
                    }
                    else
                    {
                        materialEditor.TexturePropertySingleLine(new GUIContent(properties[i].displayName), properties[i]);
                    }
                }
                else
                {
                    float propertyHeight = materialEditor.GetPropertyHeight(properties[i], properties[i].displayName);
                    Rect  controlRect    = EditorGUILayout.GetControlRect(true, propertyHeight, EditorStyles.layerMaskField, new GUILayoutOption[0]);
                    materialEditor.ShaderProperty(controlRect, properties[i], properties[i].displayName);
                }
            }
        }

        EditorGUILayout.Space();
        materialEditor.RenderQueueField();
#if UNITY_5_6_OR_NEWER
        materialEditor.EnableInstancingField();
#endif
#if UNITY_5_6_2 || UNITY_5_6_3 || UNITY_5_6_4 || UNITY_2017_1_OR_NEWER
        materialEditor.DoubleSidedGIField();
#endif
        materialEditor.LightmapEmissionProperty();
        if (m_refreshOnUndo || EditorGUI.EndChangeCheck())
        {
            m_refreshOnUndo = false;

            string isEmissive = mat.GetTag("IsEmissive", false, "false");
            if (isEmissive.Equals("true"))
            {
                mat.globalIlluminationFlags &= (MaterialGlobalIlluminationFlags)3;
            }
            else
            {
                mat.globalIlluminationFlags |= MaterialGlobalIlluminationFlags.EmissiveIsBlack;
            }

            UIUtils.CopyValuesFromMaterial(mat);
        }

        if (materialEditor.RequiresConstantRepaint() && m_lastRenderedTime + 0.032999999821186066 < EditorApplication.timeSinceStartup)
        {
            this.m_lastRenderedTime = EditorApplication.timeSinceStartup;
            materialEditor.Repaint();
        }
    }
Exemplo n.º 27
0
        public void OnEnable()
        {
            var trigger = target as ConditionObserver;

            if (trigger == null)
            {
                return;
            }
            if (EditorTools.selectedDatabase == null)
            {
                EditorTools.selectedDatabase = EditorTools.FindInitialDatabase();
            }
            luaScriptWizard = new LuaScriptWizard(EditorTools.selectedDatabase);
            questPicker     = new QuestPicker(EditorTools.selectedDatabase, trigger.questName, trigger.useQuestNamePicker);
            questPicker.showReferenceDatabase = false;
            sendMessageList = new ReorderableList(serializedObject, serializedObject.FindProperty("sendMessages"), true, true, true, true);
            sendMessageList.drawHeaderCallback  = OnDrawSendMessageListHeader;
            sendMessageList.drawElementCallback = OnDrawSendMessageListElement;
            foldouts = EditorPrefs.HasKey(InspectorEditorPrefsKey) ? JsonUtility.FromJson <Foldouts>(EditorPrefs.GetString(InspectorEditorPrefsKey)) : new Foldouts();
        }
Exemplo n.º 28
0
 protected virtual void OnEnable()
 {
     newDatablockDir = EditorPrefs.GetString("newDatablockDir", "/Assets");
     DatablockManager.Instance.RefreshAssets();
 }
Exemplo n.º 29
0
 private static string LoadFromEditorPrefs(string key, string @default)
 {
     return(EditorPrefs.GetString($"{EditorPrefPrefix}{key}", @default));
 }
 protected virtual void OnEnable()
 {
     _search             = EditorPrefs.GetString(PREF_SEARCHSTRING, string.Empty);
     this.wantsMouseMove = true;
 }