public void IsTutorialStep(int[] indices, TutorialStepDelegate StepDelegate, ColorBoxType boxType = ColorBoxType.Tutorial) { for (int i = 0; i < indices.Length; i++) { if (indices[i] == CurrentTutorialIndex) { IsTutorialStep(CurrentTutorialIndex, StepDelegate, boxType); } } }
public static GUIStyle GetColoredHelpBoxStyle(ColorBoxType boxType = ColorBoxType.Tutorial) { GUIStyle buttonStyle = new GUIStyle(EditorStyles.helpBox); if (boxType != ColorBoxType.Normal) { buttonStyle.normal.background = MakeTex(2, 2, GetBoxColor(boxType, ColorUsageState.Normal)); } buttonStyle.fontSize = CompactMode ? 12 : 14; return(buttonStyle); }
public static GUIStyle GetColoredButtonStyle(ColorBoxType boxType = ColorBoxType.Tutorial) { GUIStyle buttonStyle = new GUIStyle(EditorStyles.toolbarButton); buttonStyle.fixedHeight = CompactMode ? 19 : 20; if (boxType != ColorBoxType.Normal) { buttonStyle.normal.background = MakeTex(2, 2, GetBoxColor(boxType, ColorUsageState.Normal)); buttonStyle.active.background = MakeTex(2, 2, GetBoxColor(boxType, ColorUsageState.Active)); } buttonStyle.fontSize = CompactMode ? 12 : 14; return(buttonStyle); }
public static void OpenHorizontal(MessageType messageType, bool ExpandWidth = true) { ColorBoxType type = ColorBoxType.Normal; if (messageType == MessageType.Error) { type = ColorBoxType.Error; } if (messageType == MessageType.Warning) { type = ColorBoxType.Warning; } if (messageType == MessageType.None) { type = ColorBoxType.Tutorial; } OpenHorizontal(type, ExpandWidth); }
public static Color GetBoxColor(ColorBoxType boxColor, ColorUsageState usageState) { if (boxColor == ColorBoxType.Tutorial) { return(GetTutorialColor(usageState)); } else if (boxColor == ColorBoxType.Warning) { return(GetWarningColor(usageState)); } else if (boxColor == ColorBoxType.Error) { return(GetErrorColor(usageState)); } else if (boxColor == ColorBoxType.Black) { return(GetBlackColor(usageState)); } Debug.LogError("We shouldn't encounter this segment of code.\nThe intended purpose of ColorBoxType.Normal is to not overwrite the color of the default box (which screws up the box borders)\n"); return(GetNormalColor(usageState)); }
/// <summary> /// Recommended values: 1, 3 or 4 /// </summary> /// <param name="height">Hand in 1, 3 or 4 generally.</param> public static void DrawDivider(ColorBoxType col, float height = 1) { GUILayout.Box("", GetColoredHelpBoxStyle(col), new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.Height(height) }); }
public static bool TutorialToolbarButton(bool disabledWhenTrue, string content, ColorBoxType colorBox = ColorBoxType.Tutorial) { return(ColoredToolbarButton(disabledWhenTrue, new GUIContent(content), colorBox)); }
public static bool ColoredToolbarButton(bool disabledWhenTrue, GUIContent content, ColorBoxType colorBox = ColorBoxType.Tutorial) { OpenHorizontal(); bool returnValue = false; using (new EditorGUI.DisabledGroupScope(disabledWhenTrue)) { GUIStyle buttonStyle = GetColoredButtonStyle(colorBox); returnValue = GUILayout.Button(content, buttonStyle); } CloseHorizontal(); return(returnValue); }
public static void OpenHorizontal(ColorBoxType boxType, bool ExpandWidth = true) { GUILayout.BeginHorizontal("", GetColoredHelpBoxStyle(boxType), new GUILayoutOption[] { GUILayout.ExpandWidth(true) }); }
/// <summary> /// Draws the actual tutorial box content. /// Does not check if it should or shouldn't display. Call IsTutorialStep instead. /// </summary> /// <param name="StepDelegate">The content to execute when this tutorial box is displayed</param> /// <param name="tutorialStepNumber">-1 will not show step number information</param> public void TutorialStepBox(TutorialStepDelegate StepDelegate, int tutorialStepNumber = -1, ColorBoxType boxType = ColorBoxType.Tutorial) { EditorGUILayout.BeginVertical("Box"); EditorGUILayout.BeginVertical(NSEditorStyles.GetColoredHelpBoxStyle(boxType)); StepDelegate(); if (tutorialStepNumber != -1) { EditorGUILayout.BeginHorizontal(); NSEditorStyles.DrawLabel("[" + tutorialStepNumber + "]"); EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndVertical(); EditorGUILayout.EndVertical(); }
public void IsTutorialStep(int tutorialStepNumber, bool ShouldDisplayTutorial, TutorialStepDelegate StepDelegate, ColorBoxType boxType = ColorBoxType.Tutorial) { bool returnVal = false; if (CurrentTutorialIndex == tutorialStepNumber) { //Draw tutorial content. returnVal = true; } if (tutorialStepNumber > LargestTutorialIndex) { LargestTutorialIndex = tutorialStepNumber; } if (!TutorialModeActive) { returnVal = false; } if (returnVal && ShouldDisplayTutorial) { TutorialStepBox(StepDelegate, tutorialStepNumber, boxType); } }
public void IsTutorialStep(int tutorialStepNumber, TutorialStepDelegate StepDelegate, ColorBoxType boxType = ColorBoxType.Tutorial) { IsTutorialStep(tutorialStepNumber, true, StepDelegate, boxType); }
/// <summary> /// This function ALWAYS calls the StepDelegate, but highlights the Delegate Element when told too. /// Will not highlight outside of tutorial mode /// </summary> /// <param name="shouldHighlight"></param> /// <param name="StepDelegate"></param> /// <param name="boxType"></param> public void TutorialHighlight(bool shouldHighlight, TutorialStepDelegate StepDelegate, ColorBoxType boxType = ColorBoxType.Tutorial) { if (shouldHighlight && TutorialModeActive) { //EditorGUILayout.BeginVertical("Box"); EditorGUILayout.BeginVertical(NSEditorStyles.GetColoredHelpBoxStyle(boxType)); } StepDelegate(); if (shouldHighlight && TutorialModeActive) { //EditorGUILayout.EndVertical(); EditorGUILayout.EndVertical(); } }
/// <summary> /// This function ALWAYS calls the StepDelegate, but highlights the Delegate Element during the indicated step. /// Only highlights when it is BOTH that step and shouldHightlight is true. /// </summary> /// <param name="tutorialStepNumber"></param> /// <param name="shouldHightlight"></param> /// <param name="StepDelegate"></param> /// <param name="boxType"></param> public void TutorialHighlight(int tutorialStepNumber, bool shouldHightlight, TutorialStepDelegate StepDelegate, ColorBoxType boxType = ColorBoxType.Tutorial) { TutorialHighlight(IsTutorialStep(tutorialStepNumber) && shouldHightlight, StepDelegate, boxType); }
/// <summary> /// This function ALWAYS calls the StepDelegate, but highlights the Delegate Element during tutorials /// </summary> /// <param name="StepDelegate"></param> /// <param name="boxType"></param> public void TutorialHighlight(TutorialStepDelegate StepDelegate, ColorBoxType boxType = ColorBoxType.Tutorial) { TutorialHighlight(TutorialModeActive, StepDelegate, boxType); }