private void FillViewContent()
        {
            var data = BuildObjectRemoverSettingsProvider.LoadSettings();

            foreach (var item in data)
            {
                buildTypesConteiners.TryGetValue(item.buildTarget, out VisualElement container);
                AddValue((container ?? AddBuildTargetContainer(item.buildTarget)).Q("contentTags"), item);
            }
        }
示例#2
0
        private List <RemoveTagData> GetTagsToRemove(BuildReport report)
        {
            var buildType    = GetBuildType(report);
            var buildTarget  = GetBuildTarget(report);
            var tagsToRemove = BuildObjectRemoverSettingsProvider.LoadSettings()
                               .Where(x => (x.enable &&
                                            ((RemoverState)x.runType).HasFlag(buildType) &&
                                            (x.buildTarget == buildTarget || x.buildTarget == BuildTarget.NoTarget)))
                               .GroupBy(x => x.tag)
                               .Select(x => x.First()).ToList();

            return(tagsToRemove);
        }
        public override void OnActivate(string searchContext, VisualElement rootElement)
        {
            rootVisualElement = rootElement;

            containerTemplate = AssetDatabase.LoadAssetAtPath <VisualTreeAsset>(BuildObjectRemoverConstants.PACKAGE_PATH + "/SettingsBuildTargetContainerTemplate.uxml");
            rowTemplate       = AssetDatabase.LoadAssetAtPath <VisualTreeAsset>(BuildObjectRemoverConstants.PACKAGE_PATH + "/SettingsTagViewTemplate.uxml");

            SetupView(rootElement);

            if (!BuildObjectRemoverSettingsProvider.HasSettings())
            {
                AddDefaultTag();
            }

            FillViewContent();

            base.OnActivate(searchContext, rootElement);
        }
        private void AddDefaultTag()
        {
            string defaultTag = "DevelopmentOnly";

            if (!UnityEditorInternal.InternalEditorUtility.tags.Contains(defaultTag))
            {
                UnityEditorInternal.InternalEditorUtility.AddTag(defaultTag);
            }

            var defaultRemove = new RemoveTagData
            {
                buildTarget = BuildTarget.NoTarget,
                enable      = true,
                runType     = (int)RemoverState.Release,
                tag         = defaultTag
            };

            BuildObjectRemoverSettingsProvider.SaveSettings(new List <RemoveTagData>()
            {
                defaultRemove
            });
        }
 private void ApplyChanges()
 {
     BuildObjectRemoverSettingsProvider.SaveSettings(rowsData.Select(x => x.GetData()).ToList());
 }