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); }
private IEnumerator LoadCoroutine() { yield return(null); MapFileReader reader = new MapFileReader(SelectedMap.Instance().mapName); try { reader.Read(null, GetComponent <VoxelArray>(), false); } catch (MapReadException) { SceneManager.LoadScene("editScene"); // TODO: this is a very bad solution } loadingText.enabled = false; }
static void Main(string[] args) { var mapReader = new MapFileReader(args[0]); Maze maze = mapReader.Read(); var pathFinder = new PathFinder(new MapConverter()); IEnumerable <DataEdge> path = pathFinder.Find(maze); var pathHandler = new PathHandler(); string commands = pathHandler.Run(new DataCommandFormater(), path); string edgeOrder = pathHandler.Run(new EdgeInfoFormater <DataEdge>(), path); var reportBuilder = new ConsoleReportBuilder(); reportBuilder.AppendMessage("The commands", commands); reportBuilder.AppendMessage(nameof(edgeOrder), edgeOrder); reportBuilder.AppendSeparator(); Console.WriteLine(reportBuilder.Build()); }