Exemple #1
0
        public static void AddButton(string name, string textureName, string tip, string letter)
        {
            if (!isInit)
            {
                Init();
            }

            BtnInfo btn = new BtnInfo(textureName, tip, letter);

            btns.Add(name, btn);
        }
Exemple #2
0
        public static bool IconButton(Rect rect, string name)
        {
            BtnInfo info = GetBtnInfo(name);

            Texture2D icon = PDResources.GetImage(info.textureName);

            if (icon == null)
            {
                return(GUI.Button(rect, new GUIContent(info.letter, info.tip), EditorStyles.miniButton));
            }
            else
            {
                GUIStyle style = new GUIStyle();
                style.normal.background = icon;
                style.hover.background  = icon;
                style.active.background = icon;
                return(GUI.Button(rect, new GUIContent("", info.tip), style));
            }
        }