/// <summary> /// returns the requested guistyle for a box /// </summary> /// <param name="theStyleBox">the type of box style</param> /// <returns>returns the requested box style. Returns the default box style if no custom style was found.</returns> public static GUIStyle GetStyleBox(eStyleBox theStyleBox) { if(itsSkinIndex == -1) return GUI.skin.box; Init(); if(theStyleBox == eStyleBox.eBox && itsStyleBox[itsSkinIndex] != null) { return itsStyleBox[itsSkinIndex]; } else if(theStyleBox == eStyleBox.eBoxInvisible&& itsStyleBoxInvisible[itsSkinIndex] != null) { return itsStyleBoxInvisible[itsSkinIndex]; } else if(theStyleBox == eStyleBox.eBoxInteractive && itsStyleBox[itsSkinIndex] != null) { return itsStyleBoxInteractive[itsSkinIndex]; } else if(theStyleBox == eStyleBox.eBoxLeft && itsStyleBoxLeft[itsSkinIndex] != null) { return itsStyleBoxLeft[itsSkinIndex]; } else if(theStyleBox == eStyleBox.eBoxLeftInteractive && itsStyleBoxLeft[itsSkinIndex] != null) { return itsStyleBoxLeftInteractive[itsSkinIndex]; } else if(theStyleBox == eStyleBox.eBoxRight && itsStyleBoxRight[itsSkinIndex] != null) { return itsStyleBoxRight[itsSkinIndex]; } else if(theStyleBox == eStyleBox.eBoxRightInteractive && itsStyleBoxRight[itsSkinIndex] != null) { return itsStyleBoxRightInteractive[itsSkinIndex]; } else if(theStyleBox == eStyleBox.eBoxMiddleHorizontal && itsStyleBoxMiddleHorizontal[itsSkinIndex] != null) { return itsStyleBoxMiddleHorizontal[itsSkinIndex]; } else if(theStyleBox == eStyleBox.eBoxMiddleHorizontalInteractive && itsStyleBoxMiddleHorizontal[itsSkinIndex] != null) { return itsStyleBoxMiddleHorizontalInteractive[itsSkinIndex]; } else if(theStyleBox == eStyleBox.eBoxTop && itsStyleBoxTop[itsSkinIndex] != null) { return itsStyleBoxTop[itsSkinIndex]; } else if(theStyleBox == eStyleBox.eBoxTopInteractive && itsStyleBoxTop[itsSkinIndex] != null) { return itsStyleBoxTopInteractive[itsSkinIndex]; } else if(theStyleBox == eStyleBox.eBoxBottom && itsStyleBoxBottom[itsSkinIndex] != null) { return itsStyleBoxBottom[itsSkinIndex]; } else if(theStyleBox == eStyleBox.eBoxBottomInteractive && itsStyleBoxBottom[itsSkinIndex] != null) { return itsStyleBoxBottomInteractive[itsSkinIndex]; } else if(theStyleBox == eStyleBox.eBoxMiddleVertical && itsStyleBoxMiddleVertical[itsSkinIndex] != null) { return itsStyleBoxMiddleVertical[itsSkinIndex]; } else if(theStyleBox == eStyleBox.eBoxMiddleVerticalInteractive && itsStyleBoxMiddleVertical[itsSkinIndex] != null) { return itsStyleBoxMiddleVerticalInteractive[itsSkinIndex]; } else if(theStyleBox == eStyleBox.eBoxDark && itsStyleBoxDark[itsSkinIndex] != null) { return itsStyleBoxDark[itsSkinIndex]; } else if(theStyleBox == eStyleBox.eBoxDarkInteractive && itsStyleBoxDark[itsSkinIndex] != null) { return itsStyleBoxDarkInteractive[itsSkinIndex]; } else if(theStyleBox == eStyleBox.eBoxDarkLeft && itsStyleBoxDarkLeft[itsSkinIndex] != null) { return itsStyleBoxDarkLeft[itsSkinIndex]; } else if(theStyleBox == eStyleBox.eBoxDarkLeftInteractive && itsStyleBoxDarkLeft[itsSkinIndex] != null) { return itsStyleBoxDarkLeftInteractive[itsSkinIndex]; } else if(theStyleBox == eStyleBox.eBoxDarkRight && itsStyleBoxDarkRight[itsSkinIndex] != null) { return itsStyleBoxDarkRight[itsSkinIndex]; } else if(theStyleBox == eStyleBox.eBoxDarkRightInteractive && itsStyleBoxDarkRight[itsSkinIndex] != null) { return itsStyleBoxDarkRightInteractive[itsSkinIndex]; } else if(theStyleBox == eStyleBox.eBoxDarkMiddleHorizontal && itsStyleBoxDarkMiddleHorizontal[itsSkinIndex] != null) { return itsStyleBoxDarkMiddleHorizontal[itsSkinIndex]; } else if(theStyleBox == eStyleBox.eBoxDarkMiddleHorizontalInteractive && itsStyleBoxDarkMiddleHorizontal[itsSkinIndex] != null) { return itsStyleBoxDarkMiddleHorizontalInteractive[itsSkinIndex]; } else if(theStyleBox == eStyleBox.eBoxDarkTop && itsStyleBoxDarkTop[itsSkinIndex] != null) { return itsStyleBoxDarkTop[itsSkinIndex]; } else if(theStyleBox == eStyleBox.eBoxDarkTopInteractive && itsStyleBoxDarkTop[itsSkinIndex] != null) { return itsStyleBoxDarkTopInteractive[itsSkinIndex]; } else if(theStyleBox == eStyleBox.eBoxDarkBottom && itsStyleBoxDarkBottom[itsSkinIndex] != null) { return itsStyleBoxDarkBottom[itsSkinIndex]; } else if(theStyleBox == eStyleBox.eBoxDarkBottomInteractive && itsStyleBoxDarkBottom[itsSkinIndex] != null) { return itsStyleBoxDarkBottomInteractive[itsSkinIndex]; } else if(theStyleBox == eStyleBox.eBoxDarkMiddleVertical && itsStyleBoxDarkMiddleVertical[itsSkinIndex] != null) { return itsStyleBoxDarkMiddleVertical[itsSkinIndex]; } else if(theStyleBox == eStyleBox.eBoxDarkMiddleVerticalInteractive && itsStyleBoxDarkMiddleVertical[itsSkinIndex] != null) { return itsStyleBoxDarkMiddleVerticalInteractive[itsSkinIndex]; } else if(theStyleBox == eStyleBox.eBoxDecorated && itsStyleBoxDecorated[itsSkinIndex] != null) { return itsStyleBoxDecorated[itsSkinIndex]; } return GUI.skin.box; }
/// <summary> /// Use this method to draw a box /// </summary> /// <remarks> /// Use this method to draw a box. /// </remarks> /// <param name="theImage">the icon of the box</param> /// <param name="theText">the text inside the box</param> /// <param name="theStyleBox">the style of the box</param> /// <param name="theLayout">GUILayout options</param> public static void Box(Texture theImage, string theText, eStyleBox theStyleBox, params GUILayoutOption[] theLayout) { Init(); GUIContent aGuiContent = null; if(theImage != null) { aGuiContent = new GUIContent(theText, theImage); } else { aGuiContent = new GUIContent(theText); } if(itsSkinIndex == -1) { GUILayout.Box(aGuiContent, theLayout); } else { GUILayout.Box(aGuiContent, GetStyleBox(theStyleBox), theLayout); } }
/// <summary> /// Use this method to draw a box /// </summary> /// <remarks> /// Use this method to draw a box. /// </remarks> /// <param name="theText">the text inside the box</param> /// <param name="theStyleBox">the style of the box</param> /// <param name="theLayout">GUILayout options</param> public static void Box(string theText, eStyleBox theStyleBox, params GUILayoutOption[] theLayout) { Box(null, theText, theStyleBox, theLayout); }
/// <summary> /// Use this method to draw a box /// </summary> /// <remarks> /// Use this method to draw a box. /// </remarks> /// <param name="theText">the text inside the box</param> /// <param name="theStyleBox">the style of the box</param> /// <param name="theLayout">GUILayout options</param> public static void Box(Texture theImage, eStyleBox theStyleBox, params GUILayoutOption[] theLayout) { Box(theImage, "", theStyleBox, theLayout); }
/// <summary> /// Use this method to draw a vertical box /// </summary> /// <remarks> /// Use this method to draw a vertical box. For proper usage call EndVerticalBox() after using this function. /// </remarks> /// <param name="theStyleBox">the style of the box</param> /// <param name="theLayout">GUILayout options</param> public static void BeginVerticalBox(eStyleBox theStyleBox, params GUILayoutOption[] theLayout) { Init(); if(itsSkinIndex == -1) { GUILayout.BeginVertical(GUI.skin.box,theLayout); } else { GUILayout.BeginVertical(GetStyleBox(theStyleBox), theLayout); } }