Beispiel #1
0
        public override string ToString()
        {
            string[] filters        = { minify.ToString(), magnify.ToString(), mip.ToString() };
            string[] filterPrefixes = { "Min", "Mag", "Mip" };

            string filter = "", filtPrefix = "", filtVal = "";

            for (int a = 0; a < 3; a++)
            {
                if (a == 0 || filters[a] == filters[a - 1])
                {
                    if (filtPrefix != "")
                    {
                        filtPrefix += "/";
                    }
                    filtPrefix += filterPrefixes[a];
                }
                else
                {
                    filter += filtPrefix + ": " + filtVal + ", ";

                    filtPrefix = filterPrefixes[a];
                }
                filtVal = filters[a];
            }

            filter += filtPrefix + ": " + filtVal;

            return(filter);
        }
Beispiel #2
0
        /// <summary>
        /// The part btn and or switch.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private void PartBtnSwitchAndOr(object sender, RoutedEventArgs e)
        {
            filterMode = filterMode == FilterMode.AND ? FilterMode.OR : FilterMode.AND;
            var tb = new TextBlock {
                FontSize = 8, Text = filterMode.ToString()
            };

            PART_BtnSwitchAndOr.Content = tb;
            filterModeHasChanged        = true;
            ApplySearchCriteria();
        }
Beispiel #3
0
        private void Save()
        {
            var data = _manager.GetConfigAsDictionary(_config);

            data[FilterModeConfigKey] = FilterMode.ToString();
            for (var i = 1; i < FilterList.Count; i++)
            {
                data[$"{FilterListConfigKey}:{i}"] = FilterList[i];
            }

            data[TrackingDelayConfigKey] = TrackingDelaySetting.Value.ToString();
            data[SavingDelayConfigKey]   = SavingDelaySetting.Value.ToString();
            data[DatabaseSizeConfigKey]  = DatabaseSizeSetting.Value.ToString();

            _manager.SaveConfiguration(data);
        }
Beispiel #4
0
        // Token: 0x060003DF RID: 991 RVA: 0x00034A6C File Offset: 0x00032C6C
        public static string GetFilterModeString(FilterMode value)
        {
            switch ((int)value)
            {
            case -1:
            case 1:
                return("Bilinear");

            case 0:
                return("Point");

            case 2:
                return("Trilinear");

            default:
                return(value.ToString());
            }
        }
Beispiel #5
0
        private static int window_size = 5; // Arbitrary window size!

        /// <summary>
        /// Returns a list of player actions. This filter operates on the basis of the given filter
        /// mode, which is one of the following:
        /// INACTIVE, which does not filter anything.
        /// WINDOWED, which returns the last $window_size$ actions of the player log.
        /// COGNITIVE, which returns the actions deemed to be active in the mind of the player
        /// according to some cognitive model (Indexter for the moment.)
        /// </summary>
        /// <param name="playerLog">A queue of player actions.</param>
        /// <param name="mode">The desired mode of operation of this filter.</param>
        /// <returns>A list of player actions.</returns>
        public static List <IOperator> filter(Queue <IOperator> playerLog, FilterMode mode)
        {
            switch (mode)
            {
            case FilterMode.INACTIVE:
                return(playerLog.ToList <IOperator>());

            case FilterMode.WINDOWED:
                int window_range = Math.Max(0, playerLog.Count() - window_size);
                return(playerLog.Skip(window_range).ToList <IOperator>());

            case FilterMode.COGNITIVE:
                // This mode is not supported yet! Collection returned unchanged.
                List <IOperator> cognitive = new List <IOperator>();
                return(cognitive);

            default:
                throw new ArgumentException(mode.ToString());
            }
        }
 /// <summary>
 /// The part btn and or switch.
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="e">
 /// The e.
 /// </param>
 private void PartBtnSwitchAndOr(object sender, RoutedEventArgs e)
 {
     filterMode = filterMode == FilterMode.AND ? FilterMode.OR : FilterMode.AND;
     var tb = new TextBlock {FontSize = 8, Text = filterMode.ToString()};
     PART_BtnSwitchAndOr.Content = tb;
     filterModeHasChanged = true;
     ApplySearchCriteria();
 }
    public override void DrawImportSettings()
    {
        string          path            = AssetDatabase.GUIDToAssetPath(guid);
        TextureImporter textureImporter = AssetImporter.GetAtPath(path) as TextureImporter;

        //If importer is still null, asset can't be found at path
        if (textureImporter == null)
        {
            GUILayout.Label("Texture Asset with GUID: " + guid + " no longer exists.");
        }
        else
        {
            //Name
            GUILayout.Label("Name: " + name);
            //Path
            GUILayout.Label("Path: " + path);
            //GUID
            GUILayout.Label("GUID: " + guid);

            //Aniso level
            GUILayout.Label("Aniso level: " + anisoLevel.ToString(), textureImporter.anisoLevel != anisoLevel ? AssetSettingsWindow.singleton.redTextStyle : EditorStyles.label);
            //Border mipmap
            GUILayout.Label("Border mipmap: " + borderMipmap.ToString(), textureImporter.borderMipmap != borderMipmap ? AssetSettingsWindow.singleton.redTextStyle : EditorStyles.label);
            //Convert to normal map
            GUILayout.Label("Conver to normal map: " + convertToNormalmap.ToString(), textureImporter.convertToNormalmap != convertToNormalmap ? AssetSettingsWindow.singleton.redTextStyle : EditorStyles.label);
            //Correct gamma
            GUILayout.Label("Correct gamma: " + generateMipsInLinearSpace.ToString(), textureImporter.generateMipsInLinearSpace != generateMipsInLinearSpace ? AssetSettingsWindow.singleton.redTextStyle : EditorStyles.label);
            //Fadeout
            GUILayout.Label("Fadeout: " + fadeout.ToString(), textureImporter.fadeout != fadeout ? AssetSettingsWindow.singleton.redTextStyle : EditorStyles.label);
            //Filter mode
            GUILayout.Label("Filter mode: " + filterMode.ToString(), textureImporter.filterMode != filterMode ? AssetSettingsWindow.singleton.redTextStyle : EditorStyles.label);
            //Generate cubemap
            GUILayout.Label("Generate cubemap: " + generateCubemap.ToString(), textureImporter.generateCubemap != generateCubemap ? AssetSettingsWindow.singleton.redTextStyle : EditorStyles.label);
            //Heightmap scale
            GUILayout.Label("Heightmap scale: " + heightmapScale.ToString(), textureImporter.heightmapScale != heightmapScale ? AssetSettingsWindow.singleton.redTextStyle : EditorStyles.label);
            //Is readable
            GUILayout.Label("Is readable: " + isReadable.ToString(), textureImporter.isReadable != isReadable ? AssetSettingsWindow.singleton.redTextStyle : EditorStyles.label);
            //Lightmap
            GUILayout.Label("Lightmap: " + lightmap.ToString(), textureImporter.lightmap != lightmap ? AssetSettingsWindow.singleton.redTextStyle : EditorStyles.label);
            //Max texture size
            GUILayout.Label("Max texture size: " + maxTextureSize.ToString(), textureImporter.maxTextureSize != maxTextureSize ? AssetSettingsWindow.singleton.redTextStyle : EditorStyles.label);
            //Mipmap bias
            GUILayout.Label("Mipmap bias: " + mipMapBias.ToString(), textureImporter.mipMapBias != mipMapBias ? AssetSettingsWindow.singleton.redTextStyle : EditorStyles.label);
            //Mipmap enabled
            GUILayout.Label("Mipmap enabled: " + mipmapEnabled.ToString(), textureImporter.mipmapEnabled != mipmapEnabled ? AssetSettingsWindow.singleton.redTextStyle : EditorStyles.label);
            //Mipmap fade distance start
            GUILayout.Label("Mipmap fade distance start: " + mipmapFadeDistanceStart.ToString(), textureImporter.mipmapFadeDistanceStart != mipmapFadeDistanceStart ? AssetSettingsWindow.singleton.redTextStyle : EditorStyles.label);
            //Mipmap fade distance end
            GUILayout.Label("Mipmap fade distance end: " + mipmapFadeDistanceEnd.ToString(), textureImporter.mipmapFadeDistanceEnd != mipmapFadeDistanceEnd ? AssetSettingsWindow.singleton.redTextStyle : EditorStyles.label);
            //Mipmap filter
            GUILayout.Label("Mipmap filter: " + mipmapFilter.ToString(), textureImporter.mipmapFilter != mipmapFilter ? AssetSettingsWindow.singleton.redTextStyle : EditorStyles.label);
            //Normalmap
            GUILayout.Label("Normalmap: " + normalmap.ToString(), textureImporter.normalmap != normalmap ? AssetSettingsWindow.singleton.redTextStyle : EditorStyles.label);
            //Normalmap filter
            GUILayout.Label("Normalmap filter: " + normalmapFilter.ToString(), textureImporter.normalmapFilter != normalmapFilter ? AssetSettingsWindow.singleton.redTextStyle : EditorStyles.label);
            //NPOT scale
            GUILayout.Label("NPOT scale: " + npotScale.ToString(), textureImporter.npotScale != npotScale ? AssetSettingsWindow.singleton.redTextStyle : EditorStyles.label);
            //Texture format
            GUILayout.Label("Texture format: " + textureFormat.ToString(), textureImporter.textureFormat != textureFormat ? AssetSettingsWindow.singleton.redTextStyle : EditorStyles.label);
            //Texture type
            GUILayout.Label("Texture type: " + textureType.ToString(), textureImporter.textureType != textureType ? AssetSettingsWindow.singleton.redTextStyle : EditorStyles.label);
            //Wrap mode
            GUILayout.Label("Wrap mode: " + wrapMode.ToString(), textureImporter.wrapMode != wrapMode ? AssetSettingsWindow.singleton.redTextStyle : EditorStyles.label);
        }
    }
Beispiel #8
0
        /// <summary>
        /// When overridden in a derived class, is invoked whenever application code or internal processes call <see cref="M:System.Windows.FrameworkElement.ApplyTemplate"/>.
        /// </summary>
        public override void OnApplyTemplate()
        {
            if (PART_BtnSwitchAndOr != null)
            {
                PART_BtnSwitchAndOr.Click -= PartBtnSwitchAndOr;
            }

            if (PART_TxtInputs != null)
            {
                PART_TxtInputs.TextChanged -= TxtInputSsTextChanged;
            }

            if (PART_ToggleCpntVisibilityBtn != null)
            {
                PART_ToggleCpntVisibilityBtn.Click -= PartToggleCpntVisibilityBtnChecked;
            }

            base.OnApplyTemplate();

            PART_TxtInputs = GetTemplateChild("PART_TxtInputSs") as TextBox;
            PART_ToggleCpntVisibilityBtn = GetTemplateChild("PART_ToggleCpntVisibilityBtn") as ToggleButton;
            PART_BtnSwitchAndOr          = GetTemplateChild("PART_BtnSwitchAndOr") as Button;
            PART_LblSearch    = GetTemplateChild("PART_LblSearch") as TextBlock;
            PART_TxtNbResults = GetTemplateChild("PART_TxtNbResults") as TextBlock;

            if (PART_BtnSwitchAndOr != null)
            {
                PART_BtnSwitchAndOr.Click += PartBtnSwitchAndOr;
                var tb = new TextBlock {
                    FontSize = 8, Text = filterMode.ToString()
                };
                PART_BtnSwitchAndOr.Content = tb;
            }

            if (PART_TxtInputs != null)
            {
                PART_TxtInputs.TextChanged += TxtInputSsTextChanged;
            }

            if (PART_ToggleCpntVisibilityBtn != null)
            {
                PART_ToggleCpntVisibilityBtn.Click += PartToggleCpntVisibilityBtnChecked;
            }

            // Subscribe to each scope results notifications
            foreach (object item in Items)
            {
                var ssc = (SmartSearchScope)item;

                ssc.IncreaseResultsEvent += SscIncreaseResultsEvent;
            }

            // Initialize toggle button margins
            ManageToggleButtonMargins();

            switch (LayoutOption)
            {
            case LayoutConfigOption.Minimal:
                PART_LblSearch.Visibility = Visibility.Collapsed;
                PART_ToggleCpntVisibilityBtn.Visibility = Visibility.Collapsed;
                PART_BtnSwitchAndOr.Visibility          = Visibility.Collapsed;
                PART_TxtNbResults.Visibility            = Visibility.Collapsed;
                break;

            case LayoutConfigOption.Basic:
                PART_LblSearch.Visibility = Visibility.Visible;
                PART_ToggleCpntVisibilityBtn.Visibility = Visibility.Collapsed;
                PART_BtnSwitchAndOr.Visibility          = Visibility.Collapsed;
                PART_TxtNbResults.Visibility            = Visibility.Visible;
                break;

            case LayoutConfigOption.Intemediate:
                PART_LblSearch.Visibility = Visibility.Visible;
                PART_ToggleCpntVisibilityBtn.Visibility = Visibility.Collapsed;
                PART_BtnSwitchAndOr.Visibility          = Visibility.Visible;
                PART_TxtNbResults.Visibility            = Visibility.Visible;
                break;

            case LayoutConfigOption.Full:
                PART_LblSearch.Visibility = Visibility.Visible;
                PART_ToggleCpntVisibilityBtn.Visibility = Visibility.Visible;
                PART_BtnSwitchAndOr.Visibility          = Visibility.Visible;
                PART_TxtNbResults.Visibility            = Visibility.Visible;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Beispiel #9
0
        public void OnGUI()
        {
            EditorGUILayout.LabelField("This tool is designed for handling sprite collection import settings.", new GUIStyle(EditorStyles.label)
            {
                normal = { textColor = Color.green }
            });
            SpritesFolder       = EditorGUILayout.ObjectField(new GUIContent("Sprites (Folder):", "This should be sprites root folder."), SpritesFolder, typeof(UnityEngine.Object), false);
            ForceSingle         = EditorGUILayout.Toggle(new GUIContent("Set Sprite Mode To Single:", "Check to override sprite mode to Single (this may break a layout)."), ForceSingle);
            ForceFullRect       = EditorGUILayout.Toggle(new GUIContent("Set Mesh Type = Full Rect:", "Check to override mesh @type to Full Rect."), ForceFullRect);
            EnableReadWrite     = EditorGUILayout.Toggle(new GUIContent("Enable Read/Write:", ""), EnableReadWrite);
            PackingTag          = EditorGUILayout.TextField(new GUIContent("Set Packing Tag:", ""), PackingTag);
            FilterMode          = EditorGUILayout.TextField(new GUIContent("Filter Mode:", ""), FilterMode.ToString()).ToEnum <FilterMode>();
            MaxTextureSize      = EditorGUILayout.IntField(new GUIContent("Texture size (32, 64...):", ""), MaxTextureSize);
            Compression         = (TextureImporterCompression)EditorGUILayout.Popup(new GUIContent("Compression:", ""), (int)Compression, Enum.GetValues(typeof(TextureImporterCompression)).Cast <TextureImporterCompression>().Select(i => new GUIContent(i.ToString())).ToArray());
            CrunchedCompression = EditorGUILayout.Toggle(new GUIContent("Use Crunch Compression:", ""), CrunchedCompression);
            CompressionQuality  = EditorGUILayout.IntSlider(new GUIContent("Compressor Quality:", ""), CompressionQuality, 0, 100);

            if (GUILayout.Button("Setup"))
            {
                if (SpritesFolder == null)
                {
                    Debug.LogWarning("SpritesFolder is null");
                }
                else
                {
                    var root  = AssetDatabase.GetAssetPath(SpritesFolder);
                    var files = Directory.GetFiles(root, "*.png", SearchOption.AllDirectories).Union(Directory.GetFiles(root, "*.psd", SearchOption.AllDirectories)).ToList();

                    for (var i = 0; i < files.Count; i++)
                    {
                        var progress = (float)i / files.Count;

                        SetImportSettings(files[i], ForceSingle, ForceFullRect, PackingTag, EnableReadWrite, FilterMode, MaxTextureSize, Compression, CrunchedCompression, CompressionQuality);

                        if (EditorUtility.DisplayCancelableProgressBar("Processing sprites", $"[{(int)(100 * progress)}%] [{i}/{files.Count}] Processing {files[i]}", progress))
                        {
                            break;
                        }
                    }

                    EditorUtility.ClearProgressBar();
                }
            }
        }