void _removeSymbol(string symbol)
 {
     m_scriptingDefineSymbols.Remove(symbol);
     PlayerSettingsUtils.SetScriptingDefineSymbols(m_scriptingDefineSymbols);
     AssetDatabase.Refresh();
     RegisterFiles();
 }
        static void _set()
        {
            var lst   = PlayerSettingsUtils.GetScriptingDefineSymbolsAtList();
            var del   = new List <string>(128);
            var items = Utils.m_treeView_EditorSymbols.m_registerItems;

            foreach (var p in items)
            {
                var it = lst.Find(x => x == p.symbolName);
                if (it == null)
                {
                    continue;
                }

                if (p.enabled && p.GetBuildTargetFlag(UnityEditorEditorUserBuildSettings.activeBuildTargetGroup))
                {
                    continue;
                }

                lst.Remove(p.symbolName);
            }

            var setl = Utils.m_treeView_EditorSymbols.m_registerItems
                       .Where(x => x.enabled)
                       .Where(x => x.GetBuildTargetFlag(UnityEditorEditorUserBuildSettings.activeBuildTargetGroup))
                       .Select(x => x.symbolName)
                       .ToArray();

            //
            lst.AddRange(setl);
            var adds = lst.Distinct();

            //adds.Print();
            EditorApplication.delayCall += () => {
                PlayerSettingsUtils.SetScriptingDefineSymbols(adds);
                AssetDatabase.Refresh();
                Utils.m_treeView_EditorSymbols.RegisterFiles();
            };
        }
Example #3
0
        internal static void InternalApplySymbols()
        {
            try {
                Utils.changeSetting.Value = false;
                E.Load();

                var lst  = PlayerSettingsUtils.GetScriptingDefineSymbolsAtList();
                var work = new List <string>(lst);

                foreach (var p in E.i.m_autoSymbol)
                {
                    // シンボルが無効なのでスルー
                    if (p.symbolName.IsEmpty())
                    {
                        continue;
                    }

                    // 項目がが無効化されているのでスルー
                    if (!p.enable)
                    {
                        continue;
                    }

                    var path = p.GUID.ToAssetPath();
                    if (!path.IsExistsFile() && !path.IsExistsDirectory())
                    {
                        work.Remove(p.symbolName);
                    }
                    else
                    {
                        work.Add(p.symbolName);
                    }
                }
                work = work.Distinct().ToList();

                var work2 = new List <string>(lst);

                var  w1    = work.OrderBy(x => x).ToList();
                var  w2    = work2.OrderBy(x => x).ToList();
                bool check = false;
                for (int i = 0; i < w1.Count; i++)
                {
                    if (w2.Count <= i)
                    {
                        check = true;
                        continue;
                    }
                    if (w1[i] != w2[i])
                    {
                        check = true;
                        break;
                    }
                }

                if (!check)
                {
                    return;
                }
                EditorUtility.DisplayProgressBar(Package.nameNicify, S._Therewasautomaticsettingofsymbols_Compile_, 1.00f);
                PlayerSettingsUtils.SetScriptingDefineSymbols(work);
                AssetDatabase.Refresh();
                EditorUtility.ClearProgressBar();
            }
            catch (Exception e) {
                Debug.LogException(e);
            }
        }