public static void TryToShow(string windowTitle, TutorialWelcomePage welcomePage, Action onClose) { if (Visible) { return; } var window = GetWindow <TutorialModalWindow>(utility: true, windowTitle); window.onClose = onClose; var pos = window.position; window.minSize = window.maxSize = new Vector2(kWidth, kHeight); window.CenterOnMainWin(); window.m_WelcomePage = welcomePage; var styles = window.m_Styles; foreach (var paragraph in window.m_WelcomePage.paragraphs) { window.m_Paragraphs.Add( new TutorialParagraphView(paragraph, window, styles.orderedListDelimiter, styles.unorderedListBullet, -1) ); } window.Show(); if (MaskingEnabled) { window.Mask(); } }
/// <summary> /// Creates a default Close button. /// </summary> public static ButtonData CreateCloseButton(TutorialWelcomePage page) { var data = new ButtonData { Text = "Close", OnClick = new UnityEvent() }; UnityEventTools.AddVoidPersistentListener(data.OnClick, page.CloseCurrentModalDialog); data.OnClick.SetPersistentListenerState(0, UnityEventCallState.EditorAndRuntime); return(data); }
public static void TryToShow(TutorialWelcomePage welcomePage, bool drawAsCompleted, Action onClose) { if (m_IsShowing) { return; } var window = GetWindow <TutorialModalWindow>(); window.m_WelcomePage = welcomePage; window.onClose = onClose; window.m_DrawAsCompleted = drawAsCompleted; window.ShowAuxWindow(); m_IsShowing = true; EditorGUIUtility.PingObject(window); }