Beispiel #1
0
    public static bool List(Rect position, ref bool showList, ref int listEntry, ref Vector2 scrollPos, GUIContent buttonContent, GUIContent[] listContent, GUIStyle buttonStyle, GUIStyle boxStyle, GUIStyle listStyle)
    {
        Drawing.DrawRect(position, MenuComponent._OutlineBorderBlack, null);
        Drawing.DrawRect(MenuUtilities.Inline(position, 1), MenuComponent._OutlineBorderDarkGray, null);
        int   fontSize  = Prefab._TextStyle.fontSize;
        Color textColor = Prefab._TextStyle.normal.textColor;

        Prefab._TextStyle.fontSize         = 15;
        Prefab._TextStyle.normal.textColor = Prefab._TextStyle.onNormal.textColor;
        Prefab._TextStyle.alignment        = TextAnchor.MiddleLeft;
        GUI.Label(new Rect(position.x + position.height + 4f, position.y, position.width - position.height * 2f, position.height), buttonContent, Prefab._TextStyle);
        bool result = false;
        bool flag   = Prefab.AbsButton(new Rect(position.x, position.y, position.height, position.height), "<=", new GUILayoutOption[0]);

        if (flag)
        {
            result    = true;
            listEntry = Math.Max(0, listEntry - 1);
        }
        bool flag2 = Prefab.AbsButton(new Rect(position.x + position.width - position.height, position.y, position.height, position.height), "=>", new GUILayoutOption[0]);

        if (flag2)
        {
            result    = true;
            listEntry = Math.Min(listContent.Length - 1, listEntry + 1);
        }
        Prefab._TextStyle.alignment        = TextAnchor.UpperLeft;
        Prefab._TextStyle.fontSize         = fontSize;
        Prefab._TextStyle.normal.textColor = textColor;
        return(result);
    }
Beispiel #2
0
    public static bool Button(string text, float width, float height = 25f, params GUILayoutOption[] options)
    {
        List <GUILayoutOption> list = options.ToList <GUILayoutOption>();

        list.Add(GUILayout.Height(height));
        list.Add(GUILayout.Width(width));
        Rect rect = GUILayoutUtility.GetRect(width, height, list.ToArray());

        return(Prefab.AbsButton(rect, text, options));
    }