/// <summary> /// Loads a scene to memory from a file. /// The active scene is updated to this one if loaded with success. /// </summary> /// <param name="scenePath">The path of the scene to load</param> /// <returns>True if successfully loaded</returns> public static bool LoadScene(string scenePath, bool saveHistory) { try { #if WINDOWS GameScene gameScene = (GameScene)GibboHelper.DeserializeObject(scenePath); #elif WINRT GameScene gameScene = (GameScene)GibboHelper.DeserializeObject(typeof(GameScene), scenePath); #endif ActiveScene = gameScene; ActiveScenePath = scenePath; // Update last saved scene: if (GameProject != null && !scenePath.StartsWith("_") && saveHistory) { GameProject.EditorSettings.LastOpenScenePath = GibboHelper.MakeExclusiveRelativePath(GameProject.ProjectPath, ActiveScenePath); } // Load with success, notify: return(true); } catch (Exception exception) { Console.WriteLine("Error loading scene: " + exception.Message + "\n>" + exception.ToString()); // Not loaded, notify: return(false); } }
/// <summary> /// Loads a project and returns it /// </summary> /// <param name="filepath">The source filepath</param> /// <returns>A deserialized gibbo project</returns> public static GibboProject Load(string filepath) { #if WINDOWS GibboProject project = (GibboProject)GibboHelper.DeserializeObject(filepath); #elif WINRT string npath = filepath.Replace(Windows.ApplicationModel.Package.Current.InstalledLocation.Path + "\\", string.Empty); GibboProject project = (GibboProject)GibboHelper.DeserializeObject(typeof(GibboProject), npath); #endif // Update the project path: project.ProjectPath = System.IO.Path.GetDirectoryName(filepath); project.ProjectFilePath = filepath; // Load data files LoadData(ref project); // Create a virtual settings file: project.settings.ReloadPath(project.ProjectPath); return(project); }
internal static VisualScriptManager Load(string filepath) { VisualScriptManager manager = (VisualScriptManager)GibboHelper.DeserializeObject(filepath); return(manager); }