/// <summary> /// Use this method to draw a label /// </summary> /// <remarks> /// Use this method to draw a label with a specified style. /// </remarks> /// <param name="theText">the text inside the label</param> /// <param name="theStyleLabel">the style of the label</param> /// <param name="theLayout">GUILayout options</param> public static void Label(string theText, eStyleLabel theStyleLabel, params GUILayoutOption[] theLayout) { Label(theText,null,theStyleLabel,theLayout); }
/// <summary> /// Use this method to draw a label with text and an icon /// </summary> /// <remarks> /// Use this method to draw a label with a specified style and an icon. /// </remarks> /// <param name="theText">the text inside the label</param> /// <param name="theImage">the icon inside the label</param> /// <param name="theStyleLabel">the style of the label</param> /// <param name="theLayout">GUILayout options</param> public static void Label(string theText, Texture2D theImage, eStyleLabel theStyleLabel, params GUILayoutOption[] theLayout) { Init(); GUIContent aGuiContent = null; if(theImage != null) { aGuiContent = new GUIContent(theText, theImage); } else { aGuiContent = new GUIContent(theText); } if(itsSkinIndex == -1) { GUILayout.Label(aGuiContent, theLayout); } else { GUILayout.Label(aGuiContent, GetStyleLabel(theStyleLabel), theLayout); } }
/// <summary> /// returns the requested guistyle for a label /// </summary> /// <param name="theStyleSeparator">the type of the label</param> /// <returns>returns the requested label style. Returns the default label style if no custom style was found.</returns> public static GUIStyle GetStyleLabel(eStyleLabel theStyleLabel) { if(itsSkinIndex == -1) return GUI.skin.label; Init(); if (theStyleLabel == eStyleLabel.eLabel && itsStyleLabel[itsSkinIndex] != null) { return itsStyleLabel[itsSkinIndex]; } if (theStyleLabel == eStyleLabel.eLabelFitIntoBox && itsStyleLabelFitInToBox[itsSkinIndex] != null) { return itsStyleLabelFitInToBox[itsSkinIndex]; } if (theStyleLabel == eStyleLabel.eLabelMultiline && itsStyleLabelMultiline[itsSkinIndex] != null) { return itsStyleLabelMultiline[itsSkinIndex]; } if (theStyleLabel == eStyleLabel.eLabelTitle && itsStyleLabelTitle[itsSkinIndex] != null) { return itsStyleLabelTitle[itsSkinIndex]; } return GUI.skin.box; }