public void SaveProject() { Action <MessageResult> onComplete = (MessageResult result) => { if (result == MessageResult.Yes) { string mapJson = JsonUtility.ToJson(interactiveMap, false); File.WriteAllText(settings.StaticDataPath, mapJson); SimpleZipper zipper = new SimpleZipper(); string targetPath = settings.IsNewProject ? Path.ChangeExtension( Path.Combine( settings.StoragePath, settings.Name), "irm") : settings.MapFilePath; zipper.Zip(settings.StaticPath, targetPath); if (endingSession) { ClearAppData(); } Editor.SessionEnded(); } else { endingSession = false; } }; MessageBox.ShowMessage(MessageType.YesNoCancel, onComplete, OnSaveProjectMessage, OnSaveProjectCaption); }
private void LoadProjectFromPath() { try { SimpleZipper zipper = new SimpleZipper(); byte[] data = File.ReadAllBytes(settings.MapFilePath); zipper.Unzip(data, settings.StaticPath); string dataJson = File.ReadAllText(settings.StaticDataPath); interactiveMap = JsonUtility.FromJson <InteractiveMap>(dataJson); } catch (Exception ex) { Debug.LogError(ex.Message); Action <MessageResult> onComplete = (MessageResult result) => { Editor.GoToMainMenu(); }; MessageBox.ShowMessage(MessageType.OK, onComplete, OnLoadErrorMessage, OnLoadErrorCaption); } }