private void StartTutorial(TutorialPageFactory[] tutorial, bool openBlankMap = true) { TutorialGUI.StartTutorial(tutorial, gameObject, voxelArray, touchListener); if (openBlankMap && voxelArray == null) { OpenDemoWorld("Tutorial", "default"); } Destroy(this); }
private void StartTutorial(TutorialPageFactory[] tutorial, string worldName = null) { TutorialGUI.StartTutorial(tutorial, gameObject, voxelArray, touchListener); if (worldName != null && voxelArray == null) { OpenDemoWorld("Tutorial - " + worldName, "default"); } Destroy(this); }
private IEnumerator LoadCoroutine() { yield return null; string mapName = SelectedMap.Instance().mapName; Debug.unityLogger.Log("EditorFile", "Loading " + mapName); MapFileReader reader = new MapFileReader(mapName); List<string> warnings; try { warnings = reader.Read(cameraPivot, voxelArray, true); } catch (MapReadException e) { var dialog = loadingGUI.gameObject.AddComponent<DialogGUI>(); dialog.message = e.Message; dialog.yesButtonText = "Close"; dialog.yesButtonHandler = () => { voxelArray.unsavedChanges = false; Close(); }; // fix issue where message dialog doesn't use correct skin: dialog.guiSkin = loadingGUI.guiSkin; Destroy(loadingGUI); Debug.Log(e.InnerException); yield break; } // reading the file creates new voxels which sets the unsavedChanges flag // and clears existing voxels which sets the selectionChanged flag voxelArray.unsavedChanges = false; voxelArray.selectionChanged = false; Destroy(loadingGUI); foreach (MonoBehaviour b in enableOnLoad) b.enabled = true; if (warnings.Count > 0) { string message = "There were some issues with reading the world:\n\n • " + string.Join("\n • ", warnings.ToArray()); LargeMessageGUI.ShowLargeMessageDialog(loadingGUI.gameObject, message); } if (!PlayerPrefs.HasKey("last_editScene_version")) { var dialog = loadingGUI.gameObject.AddComponent<DialogGUI>(); dialog.message = "This is your first time using the app. Would you like a tutorial?"; dialog.yesButtonText = "Yes"; dialog.noButtonText = "No"; dialog.yesButtonHandler = () => { TutorialGUI.StartTutorial(Tutorials.INTRO_TUTORIAL, dialog.gameObject, voxelArray, touchListener); }; } PlayerPrefs.SetString("last_editScene_version", Application.version); }
public override void WindowGUI() { if (worldPaths.Count == 0) { GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); // copied from TemplatePickerGUI GUILayout.BeginVertical(GUI.skin.box, GUILayout.Width(900), GUILayout.Height(480)); GUILayout.Label("Welcome to N-Space\nFollowing the tutorial is recommended!", GUIUtils.LABEL_HORIZ_CENTERED.Value); int selection = GUILayout.SelectionGrid(-1, startOptions, 2, startButtonStyle.Value, GUILayout.ExpandHeight(true)); if (selection == 0) { TutorialGUI.StartTutorial(Tutorials.INTRO_TUTORIAL, null, null, null); HelpGUI.OpenDemoWorld("Tutorial - Introduction", "Templates/indoor"); } else if (selection == 1) { AskNewWorldTemplate(); } GUILayout.EndVertical(); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); } else { if (GUIUtils.HighlightedButton("New", GUIStyleSet.instance.buttonLarge)) { AskNewWorldTemplate(); } scroll = GUILayout.BeginScrollView(scroll); for (int i = 0; i < worldPaths.Count; i++) { string path = worldPaths[i]; string name = worldNames[i]; bool selected = worldOverflowMenu != null && path == selectedWorldPath; GUILayout.BeginHorizontal(); if (GUIUtils.HighlightedButton(name, GUIStyleSet.instance.buttonLarge, selected)) { OpenWorld(path, Scenes.EDITOR); } if (GUIUtils.HighlightedButton(GUIIconSet.instance.overflow, GUIStyleSet.instance.buttonLarge, selected, GUILayout.ExpandWidth(false))) { CreateWorldOverflowMenu(path); } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); } }
private void StartTutorial(TutorialPageFactory[] tutorial, string worldName = null, bool forceIndoor = false) { TutorialGUI.StartTutorial(tutorial, gameObject, voxelArray, touchListener); if (worldName != null && (voxelArray == null || (voxelArray.type != VoxelArray.WorldType.INDOOR && forceIndoor))) { OpenDemoWorld("Tutorial - " + worldName, "Templates/indoor"); } Destroy(this); }
private IEnumerator LoadCoroutine() { yield return(null); var guiGameObject = loadingGUI.gameObject; List <string> warnings; try { warnings = ReadWorldFile.Read(SelectedWorld.GetLoadStream(), cameraPivot, voxelArray, true); } catch (MapReadException e) { var dialog = guiGameObject.AddComponent <DialogGUI>(); dialog.message = e.Message; dialog.yesButtonText = "Close"; dialog.yesButtonHandler = () => { voxelArray.unsavedChanges = false; Close(); }; Destroy(loadingGUI); Debug.LogError(e); yield break; } // reading the file creates new voxels which sets the unsavedChanges flag // and clears existing voxels which sets the selectionChanged flag voxelArray.unsavedChanges = false; voxelArray.selectionChanged = false; Destroy(loadingGUI); foreach (MonoBehaviour b in enableOnLoad) { b.enabled = true; } if (PlayerPrefs.HasKey("last_editScene_version")) { string lastVersion = PlayerPrefs.GetString("last_editScene_version"); if (CompareVersions(lastVersion, "1.2.0") == -1) { var dialog = guiGameObject.AddComponent <DialogGUI>(); dialog.message = "N-Space has been updated with the ability to bevel edges! Would you like a tutorial?"; dialog.yesButtonText = "Yes"; dialog.noButtonText = "No"; dialog.yesButtonHandler = () => { TutorialGUI.StartTutorial(Tutorials.BEVEL_TUTORIAL, guiGameObject, voxelArray, touchListener); }; } else if (CompareVersions(lastVersion, "1.3.0") == -1) { LargeMessageGUI.ShowLargeMessageDialog(guiGameObject, "<b>Version 1.3.0 update</b>\n\n" + "N-Space has been updated with a new behavior for sound effects and music. Try it out!\n\n" + "Also, check the main menu for links to video tutorials and a subreddit."); } } PlayerPrefs.SetString("last_editScene_version", Application.version); if (warnings.Count > 0) { // avoids a bug where two dialogs created on the same frame will put the unfocused one on top // for some reason it's necessary to wait two frames yield return(null); yield return(null); string message = "There were some issues with reading the world:\n\n • " + string.Join("\n • ", warnings.ToArray()); LargeMessageGUI.ShowLargeMessageDialog(guiGameObject, message); } }