Beispiel #1
0
    public static void Load()
    {
        defaultSpaceBefore = EditorPrefs.GetInt("StoredDefault_SpaceBefore", 10);
        defaultHeight      = EditorPrefs.GetInt("StoredDefault_Height", 2);
        defaultSpaceAfter  = EditorPrefs.GetInt("StoredDefault_SpaceAfter", 5);
        defaultWidth       = EditorPrefs.GetInt("StoredDefault_Width", 10);
        defaultInnerWidth  = EditorPrefs.GetInt("StoredDefault_InnerWidth", 15);

        ///

        defaultAnchor = (TextAnchor)System.Enum.Parse(typeof(TextAnchor),
                                                      EditorPrefs.GetString("StoredDefault_Anchor", "LowerLeft"));

        defaultStyle = (FontStyle)System.Enum.Parse(typeof(FontStyle),
                                                    EditorPrefs.GetString("StoredDefault_Style", "BoldAndItalic"));

        defaultSize = EditorPrefs.GetInt("StoredDefault_Size", 12);

        boxEnabled = EditorPrefs.GetBool("StoredDefault_Box", true);

        defaultColor = (ShowInfoColor)System.Enum.Parse(typeof(ShowInfoColor),
                                                        EditorPrefs.GetString("StoredDefault_FontColor", "Black"));

        defaultBoxColor = (ShowInfoColor)System.Enum.Parse(typeof(ShowInfoColor),
                                                           EditorPrefs.GetString("StoredDefault_BoxColor", "White"));
    }
Beispiel #2
0
    public static Color ConfigColor(ShowInfoColor colors)
    {
        switch ((int)colors)
        {
        case 00: return(new Color(1.00f, 1.00f, 1.00f));     // White

        case 01: return(new Color(0.75f, 0.75f, 0.75f));     // GrayLight

        case 02: return(new Color(0.50f, 0.50f, 0.50f));     // Gray

        case 03: return(new Color(0.25f, 0.25f, 0.25f));     // GrayDark

        case 04: return(new Color(0.00f, 0.00f, 0.00f));     // Black

        case 05: return(new Color(0.60f, 0.60f, 0.50f));     // GrayCream

        case 06: return(new Color(0.50f, 0.50f, 0.60f));     // GrayBlue

        case 07: return(new Color(0.50f, 0.60f, 0.50f));     // GrayGreen

        case 08: return(new Color(0.60f, 0.50f, 0.50f));     // GrayPink

        case 09: return(new Color(0.00f, 0.00f, 1.00f));     // BlueFull

        case 10: return(new Color(0.00f, 0.00f, 0.50f));     // BlueFull Dark

        case 11: return(new Color(0.00f, 0.50f, 1.00f));     // BlueSky

        case 12: return(new Color(0.00f, 0.25f, 0.50f));     // BlueSky Dark

        case 13: return(new Color(0.00f, 1.00f, 1.00f));     // Cyan

        case 14: return(new Color(0.00f, 0.75f, 0.75f));     // Cyan Dark

        case 15: return(new Color(0.00f, 1.00f, 0.75f));     // GreenWater

        case 16: return(new Color(0.00f, 0.70f, 0.55f));     // GreenWater Dark

        case 17: return(new Color(0.00f, 1.00f, 0.00f));     // GreenFull

        case 18: return(new Color(0.00f, 0.50f, 0.00f));     // GreenFull Dark

        case 19: return(new Color(0.50f, 1.00f, 0.00f));     // GreenLemon

        case 20: return(new Color(0.25f, 0.50f, 0.00f));     // GreenLemon Dark

        case 21: return(new Color(1.00f, 1.00f, 0.00f));     // Yellow

        case 22: return(new Color(0.50f, 0.50f, 0.00f));     // Yellow Dark

        case 23: return(new Color(1.00f, 0.50f, 0.00f));     // Orange

        case 24: return(new Color(0.50f, 0.25f, 0.00f));     // Orange Dark

        case 25: return(new Color(0.60f, 0.45f, 0.30f));     // Brown

        case 26: return(new Color(0.30f, 0.22f, 0.15f));     // Brown Dark

        case 27: return(new Color(1.00f, 0.00f, 0.00f));     // RedFull

        case 28: return(new Color(0.50f, 0.00f, 0.00f));     // RedFull Dark

        case 29: return(new Color(0.80f, 0.00f, 1.00f));     // Purple

        case 30: return(new Color(0.40f, 0.00f, 0.50f));     // Purple Dark

        case 31: return(new Color(1.00f, 0.00f, 1.00f));     // Magenta

        case 32: return(new Color(0.50f, 0.00f, 0.50f));     // Magenta Dark

        case 33: return(new Color(0.50f, 0.00f, 1.00f));     // Indigo

        case 34: return(new Color(0.25f, 0.00f, 0.50f));     // Indigo Dark
        }

        return(Color.gray);
    }
Beispiel #3
0
    //

    void OnGUI()
    {
        GUILayout.Label("Set the configuration for your custom Text Hint.");


        EditorGUILayout.Space();

        if (defaultSize < 10)
        {
            defaultSize = 10;
        }
        if (defaultSize > 100)
        {
            defaultSize = 100;
        }

        defaultSpaceBefore = EditorGUILayout.IntField("Space Before", defaultSpaceBefore);
        if (defaultSpaceBefore < -2)
        {
            defaultSpaceBefore = -2;
        }
        if (defaultSpaceBefore > 100)
        {
            defaultSpaceBefore = 100;
        }

        defaultHeight = EditorGUILayout.IntField("Height", defaultHeight);
        if (defaultHeight < -10)
        {
            defaultHeight = -10;
        }
        if (defaultHeight > 100)
        {
            defaultHeight = 100;
        }

        defaultSpaceAfter = EditorGUILayout.IntField("Space After", defaultSpaceAfter);
        if (defaultSpaceAfter < 0)
        {
            defaultSpaceAfter = 0;
        }
        if (defaultSpaceAfter > 100)
        {
            defaultSpaceAfter = 100;
        }

        EditorGUILayout.Space();

        defaultWidth = EditorGUILayout.IntField("Width", defaultWidth);
        if (defaultWidth < 0)
        {
            defaultWidth = 0;
        }
        if (defaultWidth > 100)
        {
            defaultWidth = 100;
        }

        defaultInnerWidth = EditorGUILayout.IntField("Inner Width", defaultInnerWidth);
        if (defaultInnerWidth < -50)
        {
            defaultInnerWidth = -50;
        }
        if (defaultInnerWidth > 100)
        {
            defaultInnerWidth = 100;
        }

        EditorGUILayout.Space();

        defaultAnchor = (TextAnchor)EditorGUILayout.EnumPopup("Anchor", defaultAnchor);
        defaultStyle  = (FontStyle)EditorGUILayout.EnumPopup("Style", defaultStyle);

        EditorGUILayout.Space();

        defaultSize = EditorGUILayout.IntField("Text Size", defaultSize);
        boxEnabled  = EditorGUILayout.Toggle("Show Box", boxEnabled);

        EditorGUILayout.Space();

        defaultColor    = (ShowInfoColor)EditorGUILayout.EnumPopup("Text Color", defaultColor);
        defaultBoxColor = (ShowInfoColor)EditorGUILayout.EnumPopup("Box Color", defaultBoxColor);

        EditorGUILayout.Space();

        sample = EditorGUILayout.TextField("Hint", sample);

        ///

        Rect lr = GUILayoutUtility.GetLastRect();

        int bugFix = 20;

        if (boxEnabled)
        {
            EditorGUI.DrawRect(new Rect(lr.position.x + defaultWidth,
                                        lr.position.y + bugFix + defaultSpaceBefore, lr.width - defaultWidth * 2,
                                        lr.height + defaultHeight + 2), ShowInfoStyles.ConfigColor(defaultBoxColor));
        }

        GUIStyle style = new GUIStyle(EditorStyles.label);

        style.fontStyle        = defaultStyle;
        style.alignment        = defaultAnchor;
        style.fontSize         = Mathf.RoundToInt(defaultSize);
        style.normal.textColor = ShowInfoStyles.ConfigColor(defaultColor);

        GUI.Label(new Rect(lr.position.x + defaultWidth + defaultInnerWidth,
                           lr.position.y + bugFix + defaultSpaceBefore, lr.width - defaultWidth - defaultInnerWidth,
                           lr.height + defaultHeight + 2), sample, style);

        EditorGUILayout.Space(defaultSpaceBefore + defaultHeight + defaultSpaceAfter + bugFix - 4);

        ///

        if (GUILayout.Button("Apply"))
        {
            Save();
        }

        EditorGUILayout.Space();

        if (GUILayout.Button("Clear Data"))
        {
            EditorPrefs.DeleteAll();
        }
    }