Example #1
0
    static UseLocalDataSettingStartup()
    {
        var str = EditorUserSettings.GetConfigValue("UseLocalDataSettingWindow_SelectDLCType");

        if (string.IsNullOrEmpty(str))
        {
            return;
        }

        int SelectDLCType = 0;

        if (!int.TryParse(str, out SelectDLCType))
        {
            SelectDLCType = 0;
        }

        if (SelectDLCType == 0)
        {
            var symbols = "DEFINE_DEVELOP;";
            PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup, symbols);
        }
        else if (SelectDLCType == 1)
        {
            var symbols = "DEFINE_DEVELOP;USE_LOCAL_DATA;";
            PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup, symbols);
        }
    }
Example #2
0
    public static void Test()
    {
        Debug.Log("old:" + EditorUserBuildSettings.GetPlatformSettings("", "metroPackageVersion"));
        Debug.Log("Test:" + EditorPrefs.GetString("metroPackageVersion"));

        Debug.Log(";;:" + EditorUserSettings.GetConfigValue("metroPackageVersion"));
    }
        public void LoadConfig()
        {
            string configtext = EditorUserSettings.GetConfigValue("MapDesignerConfig");

            this.brushes = JsonConvert.DeserializeObject <List <BlockBrush> >(configtext);
            Debug.Log("Load Config");
        }
Example #4
0
        private static void UpdateHandler(string apiResult)
        {
            GitJson git     = JsonUtility.FromJson <GitJson>(apiResult);
            string  version = git.tag_name;

            EditorUserSettings.SetConfigValue(remotever, version);
        }
Example #5
0
        /// <summary>
        /// プリセットファイル読み込み
        /// </summary>
        /// <param name="owner"></param>
        /// <param name="clothParam"></param>
        private static void LoadPreset(MonoBehaviour owner, ClothParams clothParam)
        {
            // フォルダを読み込み
            string folder = EditorUserSettings.GetConfigValue(configName);

            // 読み込みダイアログ
            string path = UnityEditor.EditorUtility.OpenFilePanel("Load Preset", folder, "json");

            if (string.IsNullOrEmpty(path))
            {
                return;
            }

            // フォルダを記録
            folder = Path.GetDirectoryName(path);
            EditorUserSettings.SetConfigValue(configName, folder);

            // json
            Debug.Log("Load preset file:" + path);
            string json = File.ReadAllText(path);

            // load
            LoadClothParam(owner, clothParam, json);

            Debug.Log("Complete.");
        }
Example #6
0
        static void CheckVersion()
        {
            if (EditorApplication.isPlayingOrWillChangePlaymode)
            {
                return;
            }
            Debug.Log("[Arktoon] Checking local version.");
            string localVersion = EditorUserSettings.GetConfigValue("arktoon_version_local") ?? "";

            if (!localVersion.Equals(version))
            {
                // 直前のバージョンと異なるか新規インポートなので、とりあえずReimportを走らせる
                Debug.Log("[Arktoon] Version change detected : Force reimport.");
                string guidArktoonManager   = AssetDatabase.FindAssets("ArktoonManager t:script")[0];
                string pathToArktoonManager = AssetDatabase.GUIDToAssetPath(guidArktoonManager);
                string pathToShaderDir      = Directory.GetParent(Path.GetDirectoryName(pathToArktoonManager)) + "/Shaders";
                AssetDatabase.ImportAsset(pathToShaderDir, ImportAssetOptions.ForceUpdate | ImportAssetOptions.ImportRecursive);
            }

            // 更新後ローカルバージョンをセット
            EditorUserSettings.SetConfigValue("arktoon_version_local", version);
            Debug.Log("[Arktoon] Checking remote version.");
            www = UnityWebRequest.Get(url);

            #if UNITY_2017_OR_NEWER
            www.SendWebRequest();
            #else
            #pragma warning disable 0618
            www.Send();
            #pragma warning restore 0618
            #endif

            EditorApplication.update += EditorUpdate;
        }
        void ApplySerializewindowLayouts(PostLayoutEvent evt)
        {
            UnregisterCallback <PostLayoutEvent>(ApplySerializewindowLayouts);

            m_FloatingWindowsLayoutKey = "UnityEditor.ShaderGraph.FloatingWindowsLayout";
            string serializedWindowLayout = EditorUserSettings.GetConfigValue(m_FloatingWindowsLayoutKey);

            if (!String.IsNullOrEmpty(serializedWindowLayout))
            {
                m_FloatingWindowsLayout = JsonUtility.FromJson <FloatingWindowsLayout>(serializedWindowLayout);

                m_FloatingWindowsLayout.defaultPreviewLayout.CalculateDockingCornerAndOffset(m_MasterPreviewView.layout, layout);
                m_FloatingWindowsLayout.defaultBlackboardLayout.CalculateDockingCornerAndOffset(m_BlackboardProvider.blackboard.layout, layout);

                m_MasterPreviewView.layout             = m_FloatingWindowsLayout.previewLayout.GetLayout(layout);
                m_BlackboardProvider.blackboard.layout = m_FloatingWindowsLayout.blackboardLayout.GetLayout(layout);

                m_MasterPreviewView.UpdateRenderTextureOnNextLayoutChange();
            }
            else
            {
                m_FloatingWindowsLayout = new FloatingWindowsLayout();
                m_FloatingWindowsLayout.defaultPreviewLayout.CalculateDockingCornerAndOffset(m_MasterPreviewView.layout, layout);
                m_FloatingWindowsLayout.defaultBlackboardLayout.CalculateDockingCornerAndOffset(m_BlackboardProvider.blackboard.layout, layout);
            }
        }
Example #8
0
        private void OnEnable()
        {
            if (string.IsNullOrEmpty(_releaseParameter.BranchName))
            {
                _releaseParameter.BranchName = EditorUserSettings.GetConfigValue(GetSaveKey(SaveKeyType.Branch));
            }

            if (string.IsNullOrEmpty(_releaseParameter.TagName))
            {
                _releaseParameter.TagName = EditorUserSettings.GetConfigValue(GetSaveKey(SaveKeyType.TagName));
            }

            if (string.IsNullOrEmpty(_releaseParameter.UserName))
            {
                _releaseParameter.UserName = EditorUserSettings.GetConfigValue(GetSaveKey(SaveKeyType.UserName));
            }


            if (string.IsNullOrEmpty(_releaseParameter.TokenValue))
            {
                _releaseParameter.TokenValue = EditorUserSettings.GetConfigValue(GetSaveKey(SaveKeyType.Token));
            }


            if (_releaseSetting == null)
            {
                _releaseSetting       = Utility.FindAssetFromType <ReleaseExecutorSetting>();
                _releaseSettingEditor = Editor.CreateEditor(_releaseSetting);
            }
        }
Example #9
0
 static void Save()
 {
     foreach (var kvp in s_Cache)
     {
         EditorUserSettings.SetConfigValue(kvp.Key, JsonSerialization.ToJson(kvp.Value));
     }
 }
Example #10
0
 static void InitializeOnLoad()
 {
     if (EditorUserSettings.GetConfigValue("Opened") != "1" || (check && EditorUserSettings.GetConfigValue("VRMCheckCaution") != "1"))
     {
         Open();
     }
 }
Example #11
0
        public static void Open()
        {
            EditorUserSettings.SetConfigValue("Opened", "1");

            var window = GetWindow <Tutorial>();

            window.maxSize = new Vector2(400, 400);
            window.minSize = window.maxSize;

            anim.value        = 0.001f;
            anim.speed        = 10f;
            anim.target       = 0.001f;
            anim.valueChanged = null;
            page    = 1;
            texture = null;

            //バージョンチェック
            if (check)
            {
                EditorUserSettings.SetConfigValue("VRMCheckCaution", "1");
                page = 0;
            }
            else
            {
                EditorUserSettings.SetConfigValue("VRMCheckCaution", "0");
            }
        }
Example #12
0
        void OnEnable()
        {
            _targets = Selection.objects.ToList();
            string path = EditorUserSettings.GetConfigValue(Key_LastFolderPath);

            _folder = AssetDatabase.LoadAssetAtPath <DefaultAsset>(path);
        }
Example #13
0
        private static void OnGuiHandler(Action <SerializedObject> onGUI,
                                         Action <SerializedObject> onGUIExtra)
        {
            T      foundInstance = GetInstance();
            Editor editor        = Editor.CreateEditor(foundInstance);

            using (EditorGUI.ChangeCheckScope scope = new EditorGUI.ChangeCheckScope())
            {
                SerializedObject serializedObject = editor.serializedObject;
                serializedObject.Update();
                if (onGUI != null)
                {
                    onGUI(serializedObject);
                }
                else
                {
                    editor.DrawDefaultInspector();
                }

                onGUIExtra?.Invoke(serializedObject);
                if (!scope.changed)
                {
                    return;
                }

                serializedObject.ApplyModifiedProperties();
                string json = EditorJsonUtility.ToJson(editor.target);
                EditorUserSettings.SetConfigValue(ConfigName, json);
            }
        }
 static void InitializeOnLoad()
 {
     if (EditorUserSettings.GetConfigValue("Opened") != "1")
     {
         Open();
     }
 }
        private static void CheckVersion()
        {
            if (EditorApplication.isPlayingOrWillChangePlaymode)
            {
                return;
            }

            // ローカルバージョンを確認
            Debug.Log("[Arktoon] Checking local version.");
            string localVersion = EditorUserSettings.GetConfigValue("arktoon_version_local") ?? "";

            if (!localVersion.Equals(version))
            {
                // Arktoonが更新または新規にインストールされているので、既存のマテリアルの更新を行う。
                ArktoonMigrator.Migrate();
            }
            // ローカルバージョンをセット
            EditorUserSettings.SetConfigValue("arktoon_version_local", version);

            // リモート(githubのpublic release)のバージョンを取得
            Debug.Log("[Arktoon] Checking remote version.");
            www = UnityWebRequest.Get(url);
            #if UNITY_2017_OR_NEWER
            www.SendWebRequest();
            #else
            #pragma warning disable 0618
            www.Send();
            #pragma warning restore 0618
            #endif

            EditorApplication.update += EditorUpdate;
        }
Example #16
0
        public static void PreferenceEditor()
        {
            var monoDir = MonoDirectory;

            using (new EditorGUILayout.HorizontalScope())
            {
                monoDir = EditorGUILayout.TextField("Mono Directory", monoDir);
                if (GUILayout.Button("選択", GUILayout.Width(35)))
                {
                    var defaultDir  = string.Empty;
                    var defaultName = string.Empty;
                    if (Directory.Exists(monoDir))
                    {
                        defaultDir  = Path.GetDirectoryName(monoDir);
                        defaultName = Path.GetFileName(monoDir);
                    }

                    var tmp = EditorUtility.OpenFolderPanel("Monoフォルダを選択してください", defaultDir, defaultName);
                    if (monoDir != tmp && !string.IsNullOrEmpty(tmp))
                    {
                        monoDir = tmp;
                    }
                }
            }

            if (MonoDirectory != monoDir)
            {
                MonoDirectory = monoDir.TrimEnd('/');
                EditorUserSettings.SetConfigValue("MONO_DIR", MonoDirectory);
            }
        }
Example #17
0
 public static void Build(PlatformType type, BuildOptions buildOptions, bool isBuildExe, bool clearFolder, bool isInject)
 {
     EditorUserSettings.SetConfigValue(AddressableTools.is_packing, "1");
     if (buildmap[type] == EditorUserBuildSettings.activeBuildTarget)
     {
         //pack
         BuildHandle(type, buildOptions, isBuildExe, clearFolder, isInject);
     }
     else
     {
         EditorUserBuildSettings.activeBuildTargetChanged = delegate()
         {
             if (EditorUserBuildSettings.activeBuildTarget == buildmap[type])
             {
                 //pack
                 BuildHandle(type, buildOptions, isBuildExe, clearFolder, isInject);
             }
         };
         if (buildGroupmap.TryGetValue(type, out var group))
         {
             EditorUserBuildSettings.SwitchActiveBuildTarget(group, buildmap[type]);
         }
         else
         {
             EditorUserBuildSettings.SwitchActiveBuildTarget(buildmap[type]);
         }
     }
 }
Example #18
0
    //=================================================================================
    //表示するGUIの設定
    //=================================================================================

    private void OnGUI()
    {
        //更新前のplayModeStartSceneに設定されてるシーンのパスを取得
        string beforeScenePath = "";//再生後に戻るシーン

        if (EditorSceneManager.playModeStartScene != null)
        {
            beforeScenePath = AssetDatabase.GetAssetPath(EditorSceneManager.playModeStartScene);
        }

        //GUIでシーンファイルを取得し、playModeStartSceneに設定する
        EditorSceneManager.playModeStartScene = (SceneAsset)EditorGUILayout.ObjectField(new GUIContent("Start Scene"),
                                                                                        EditorSceneManager.playModeStartScene,
                                                                                        typeof(SceneAsset),
                                                                                        false);

        //更新後のplayModeStartSceneに設定されてるシーンのパスを取得
        string afterScenePath = "";

        if (EditorSceneManager.playModeStartScene != null)
        {
            afterScenePath = AssetDatabase.GetAssetPath(EditorSceneManager.playModeStartScene);
        }

        //playModeStartSceneが変更されたらパスを保存
        if (beforeScenePath != afterScenePath)
        {
            EditorUserSettings.SetConfigValue(SAVE_KEY, afterScenePath);
        }
    }
Example #19
0
        static void UpdateExtensions()
        {
            var bytes = ObjectToByteArray(overwriter);

            EditorUserSettings.SetConfigValue(key, Convert.ToBase64String(bytes));
            RefreshExtensions();
        }
        void SerializeLayout()
        {
            windowDockingLayout.size = layout.size;
            var serializedLayout = JsonUtility.ToJson(windowDockingLayout);

            EditorUserSettings.SetConfigValue(layoutKey, serializedLayout);
        }
Example #21
0
        private static void CheckVersion()
        {
            if (EditorApplication.isPlayingOrWillChangePlaymode)
            {
                return;
            }
            int.TryParse(version.Substring(1), out int verint);
            versionInt = verint * 100;
            // Check Local Version
            string localVersion = EditorUserSettings.GetConfigValue(localver) ?? "";

            if (!localVersion.Equals(version))
            {
                // Update Materiams
                //ArktoonMigrator.Migrate();
            }
            // Set Local Version
            EditorUserSettings.SetConfigValue(localver, version);
            // Get Remote Version
            www = UnityWebRequest.Get(URL.GITHUB_VERCHECK);

#if UNITY_2017_OR_NEWER
            www.SendWebRequest();
#else
#pragma warning disable 0618
            www.Send();
#pragma warning restore 0618
#endif

            EditorApplication.update += EditorUpdate;
            EditorUserSettings.SetConfigValue(needUpdate, NeedUpdate().ToString());
        }
Example #22
0
    public static bool OnOpenAsset3(int instanceID, int line)
    {
        string luaFolderRoot = EditorUserSettings.GetConfigValue(LUA_PROJECT_ROOT_FOLDER_PATH_KEY);

        if (string.IsNullOrEmpty(luaFolderRoot))
        {
            SetLuaProjectRoot();
            luaFolderRoot = EditorUserSettings.GetConfigValue(LUA_PROJECT_ROOT_FOLDER_PATH_KEY);
        }
        string filePath;
        int    luaLine;
        string logText    = GetLogText();
        string startIndex = "LuaException: ";

        if (string.IsNullOrEmpty(logText) || logText.IndexOf(startIndex) == -1)
        {
            return(false);
        }
        int si = logText.LastIndexOf(startIndex) + startIndex.Length;

        logText  = logText.Substring(si, logText.Length - si);
        logText  = logText.Substring(0, logText.IndexOf(": "));
        filePath = logText.Split(':')[0];
        filePath = filePath.Replace(".", "/") + ".lua";
        luaLine  = int.Parse(logText.Split(':')[1]);
        filePath = GetAsset(luaFolderRoot, Path.GetFileNameWithoutExtension(filePath));
        filePath = filePath.Replace("\\", "/");
        return(OpenFileAtLineExternal(filePath, luaLine));
    }
Example #23
0
    static bool OpenFileWith(string filepath, int line, int column)
    {
        string editorPath = EditorUserSettings.GetConfigValue(EDITOR_PATH);

        if (string.IsNullOrEmpty(editorPath) || !File.Exists(editorPath))
        {
            SetEditorPath();
            editorPath = EditorUserSettings.GetConfigValue(EDITOR_PATH);
            if (string.IsNullOrEmpty(editorPath))
            {
                return(false);
            }
        }
        string projectPath = EditorUserSettings.GetConfigValue(PROJECT_PATH);

        if (string.IsNullOrEmpty(projectPath) || !Directory.Exists(projectPath))
        {
            SetProjectPath();
            projectPath = EditorUserSettings.GetConfigValue(PROJECT_PATH);
            if (string.IsNullOrEmpty(projectPath))
            {
                return(false);
            }
        }
        //默认为VScode的启动参数
        var args = string.Format("\"{0}\" -g \"{1}\":{2}:{3}", projectPath, filepath, line, column);

        System.Diagnostics.Process proc = new System.Diagnostics.Process();
        proc.StartInfo.FileName  = editorPath;
        proc.StartInfo.Arguments = args;
        proc.Start();
        return(true);
    }
        //Called in Sync()
        protected override IEnumerator Pull(Action <List <Task> > callback)
        {
                        #if UNITY_EDITOR
            trelloToken   = EditorUserSettings.GetConfigValue(Trello.KEY_TOKEN);
            trelloBoardId = EditorUserSettings.GetConfigValue(Trello.KEY_BOARD);
                        #endif

            WWW www = new WWW(string.Format(APIURL_CARDS, listId, Trello.APIKEY, trelloToken));
            yield return(www);

            if (!string.IsNullOrEmpty(www.error))
            {
                Debug.Log(www.error);
                callback(null);
            }
            else if (!string.IsNullOrEmpty(www.text))
            {
                Debug.Log(www.text);
                IList json = (IList)MiniJSON.Json.Deserialize(www.text);

                List <Task> l = new List <Task> ();

                foreach (IDictionary b in json)
                {
                    Task t = Trello.TrelloCardToTask(b);
                    l.Add(t);
                }

                //l.Add (new Task ("hogehoge", new Vector3 (1, 0, 1), "ちくわ大明神", "ちくわ", "https://wararyo.com"));
                //l.Add (new Task ("piyopiyo", new Vector3 (10, 0, 10), "私たちはここにいます\nここには夢がちゃんとある", "わーい", "https://wararyo.com"));
                callback(l);
            }
        }
Example #25
0
        public static bool OnOpenAsset2(int instanceID, int line)
        {
            string logText = GetLogText();
            // get filePath
            Regex  regex    = new Regex(@"<filePath>.*<\/filePath>");
            Match  match    = regex.Match(logText);
            string filePath = match.Groups[0].Value.Trim();
            int    length   = filePath.Length - 10 - 12;

            filePath = filePath.Substring(10, length);
            filePath = filePath.Replace(".", "/");

            string luaFolderRoot = EditorUserSettings.GetConfigValue(LUA_PROJECT_ROOT_FOLDER_PATH_KEY);

            if (string.IsNullOrEmpty(luaFolderRoot))
            {
                SetLuaProjectRoot();
                luaFolderRoot = EditorUserSettings.GetConfigValue(LUA_PROJECT_ROOT_FOLDER_PATH_KEY);
            }

            filePath = luaFolderRoot.Trim() + "/" + filePath.Trim() + ".lua";

            // get line number
            Regex lineRegex = new Regex(@"<line>.*<\/line>");

            match = lineRegex.Match(logText);
            string luaLineString = match.Groups[0].Value;

            luaLineString.Trim();
            length        = luaLineString.Length - 6 - 11;
            luaLineString = luaLineString.Substring(10, length);
            int luaLine = int.Parse(luaLineString.Trim());

            return(OpenFileAtLineExternal(filePath, luaLine));
        }
Example #26
0
        private static void SaveClothParam(ClothParams clothParam)
        {
            // フォルダを読み込み
            string folder = EditorUserSettings.GetConfigValue(configName);

            // 保存ダイアログ
            string path = UnityEditor.EditorUtility.SaveFilePanelInProject(
                "Save Preset",
                "preset",
                "json",
                "Enter a name for the preset json.",
                folder
                );

            if (string.IsNullOrEmpty(path))
            {
                return;
            }

            // フォルダを記録
            folder = Path.GetDirectoryName(path);
            EditorUserSettings.SetConfigValue(configName, folder);

            Debug.Log("Save preset file:" + path);

            // json
            string json = JsonUtility.ToJson(clothParam);

            // save
            File.WriteAllText(path, json);

            AssetDatabase.Refresh();

            Debug.Log("Complete.");
        }
        public override void InitializeOnLoad(AppConfig.AppConfig buildConfig)
        {
            var settings = buildConfig.GetSettings <PerforceSettings>();

            if (settings == null)
            {
                return;
            }

            if (settings.autosetVersionControlToPerforce)
            {
                if (EditorSettings.externalVersionControl != "Perforce")
                {
                    EditorSettings.externalVersionControl = "Perforce";
                }

                EditorUserSettings.SetConfigValue("vcPerforceServer", settings.server);
            }

            //// // testing if we should set the p4ignore variable
            //// if (appSettings.SourceControl == SourceControlType.Perforce && appSettings.UseP4IgnoreFile && appSettings.SetP4IgnoreVariableAtStartup && appSettings.P4IgnoreFileName != GetCurrentP4IgnoreVariable())
            //// {
            ////     SetP4IgnoreFileVariable(appSettings.P4IgnoreFileName);
            //// }

            // TODO [bgish]: if source control is set to P4, but server isn't set, then set it here
            // TODO [bgish]: if autosetP4IgnoreVariable, then set p4ignore via command line

            // NOTE [bgish]: Future settings we could possible alter?
            // EditorUserSettings.GetConfigValue("vcPerforceUsername");
            // EditorUserSettings.GetConfigValue("vcPerforcePassword");
            // EditorUserSettings.GetConfigValue("vcPerforceWorkspace");
            // EditorUserSettings.GetConfigValue("vcPerforceHost");
            // EditorUserSettings.GetConfigValue("vcSharedLogLevel");
        }
Example #28
0
    static void AddAssetToAddressable(string assetPath)
    {
        //只将Assets/AssetsPackage目录下的资源挂addressable
        if (!assetPath.Contains("Assets/" + AddressableTools.Assets_Package))
        {
            return;
        }

        if (Directory.Exists(assetPath))
        {
            return;
        }

        if (assetPath.Contains("Atlas"))//图集
        {
            string is_atlas_model = EditorUserSettings.GetConfigValue(AddressableTools.is_atlas_model);
            if (is_atlas_model == "0")
            {
                AddressableTools.AddImportAssetToaddressable(assetPath);
            }
        }
        else
        {
            AddressableTools.AddImportAssetToaddressable(assetPath);
        }
    }
        /// <summary>
        /// アバターごとの変換設定を記録したXML文書を返します。
        /// </summary>
        /// <returns>まだ何も保存されていない場合、またはXMLパースエラーが発生した場合は、ルート要素のみ存在する文書を返します。</returns>
        private XmlDocument GetSettingsList()
        {
            var defaultDocument = new XmlDocument();

            defaultDocument.AppendChild(defaultDocument.CreateElement(qualifiedName: "list", namespaceURI: Wizard.EditorUserSettingsXmlNamespace));

            string configValue = EditorUserSettings.GetConfigValue(Wizard.EditorUserSettingsName);

            if (string.IsNullOrEmpty(configValue))
            {
                return(defaultDocument);
            }

            var document = new XmlDocument();

            try
            {
                document.LoadXml(xml: configValue);
            }
            catch (XmlException)
            {
                return(defaultDocument);
            }

            return(document);
        }
        //================================================================================
        // 関数(static)
        //================================================================================
        /// <summary>
        /// 設定から読み込みます
        /// </summary>
        public static TimeEntities LoadFromConfig()
        {
            var value    = EditorUserSettings.GetConfigValue(KEY);
            var entities = JsonUtility.FromJson <TimeEntities>(value) ?? new TimeEntities();

            return(entities);
        }