<commit_before>﻿using UnityEditor;
using UnityEngine.UI;
using UnityEngine;

public class ButtonPreset
{
    [MenuItem("SpaceTrader/Apply button preset")]
    public static void ConfigureButton()
    {
        var selection = Selection.activeGameObject;
        if (!selection)
        {
            return;
        }

        var button = selection.GetComponent<Button>();
        if (!button)
        {
            return;
        }

        var font = AssetDatabase.LoadAssetAtPath<Font>("Assets/GUI/Coffee.ttf");

        var label = button.GetComponentInChildren<Text>();
        if (label)
        {
            label.font = font;
            label.fontSize = 24;
            label.color = Color.white;
            label.raycastTarget = false;
            label.supportRichText = false;
            label.horizontalOverflow = HorizontalWrapMode.Overflow;
            label.verticalOverflow = VerticalWrapMode.Overflow;

            if (!label.GetComponent<Outline>())
            {
                var outline = label.gameObject.AddComponent<Outline>();
                outline.effectColor = Color.black;
            }
        }

        var bg = AssetDatabase.LoadAssetAtPath<Sprite>("Assets/GUI/Backing Blur.psd");
        var bgImage = button.GetComponent<Image>();
        bgImage.type = Image.Type.Simple;
        bgImage.sprite = bg;
        button.targetGraphic = label;

        var colors = button.colors;
        colors.normalColor = new Color(1, 0.21f, 0.39f);
        colors.highlightedColor = new Color(1, 0.74f, 0.8f);
        colors.pressedColor = Color.white;
        colors.disabledColor = new Color(1, 0.21f, 0.39f, 0.5f);

        button.colors = colors;
    }
}<commit_msg>Increased button preset font size and made it work with multiple selections<commit_after>﻿using UnityEditor;
using UnityEngine.UI;
using UnityEngine;
using System.Linq;

public class ButtonPreset
{
    private static void ConfigureButton(Button button)
    {
        if (!button)
        {
            return;
        }

        var font = AssetDatabase.LoadAssetAtPath<Font>("Assets/GUI/Coffee.ttf");

        var label = button.GetComponentInChildren<Text>();
        if (label)
        {
            label.font = font;
            label.fontSize = 32;
            label.color = Color.white;
            label.raycastTarget = false;
            label.supportRichText = false;
            label.horizontalOverflow = HorizontalWrapMode.Overflow;
            label.verticalOverflow = VerticalWrapMode.Overflow;

            if (!label.GetComponent<Outline>())
            {
                var outline = label.gameObject.AddComponent<Outline>();
                outline.effectColor = Color.black;
            }
        }

        var bg = AssetDatabase.LoadAssetAtPath<Sprite>("Assets/GUI/Backing Blur.psd");
        var bgImage = button.GetComponent<Image>();
        bgImage.type = Image.Type.Simple;
        bgImage.sprite = bg;
        button.targetGraphic = label;

        var colors = button.colors;
        colors.normalColor = new Color(1, 0.21f, 0.39f);
        colors.highlightedColor = new Color(1, 0.74f, 0.8f);
        colors.pressedColor = Color.white;
        colors.disabledColor = new Color(1, 0.21f, 0.39f, 0.5f);

        button.colors = colors;

        var layout = button.GetComponent<LayoutElement>();
        if (layout)
        {
            layout.preferredHeight = 48;
        }
    }

    [MenuItem("SpaceTrader/Apply button preset")]
    public static void ConfigureSelection()
    {
        var selection = Selection.activeGameObject;
        if (!selection)
        {
            return;
        }

        foreach (var button in Selection.gameObjects
            .Select(o => o.GetComponent<Button>())
            .Where(button => button))
        {
            ConfigureButton(button);
        }
    }
}
{'fraction_non_alphanumeric': 0.10378096479791395, 'fraction_numerical': 0.01303780964797914, 'mean_word_length': 1.964451313755796, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5878922', 'n_tokens_mistral': 1102, 'n_tokens_neox': 1047, 'n_words': 218}