public void saveAll(Model model) { projectAssets.toJsonPath(model.getGame(), ProjectAssets.GAME_FILE); projectAssets.toJsonPath(model.getProject(), ProjectAssets.PROJECT_FILE); for (Map.Entry<String, Scene> e : model.getScenes().entrySet()) { projectAssets.toJsonPath(e.getValue(), projectAssets.convertSceneNameToPath(e.getKey())); } }
public void load(String loadingPath, boolean internal) { project = null; game = null; scenes.clear(); projectAssets.setLoadingPath(loadingPath, internal); projectAssets.loadGame(this); FileHandle scenesPath = projectAssets.resolve(ProjectAssets.SCENES_PATH); for (FileHandle sceneFile : scenesPath.list()) { projectAssets.loadScene(sceneFile.nameWithoutExtension(), this); } projectAssets.loadProject(this); }
@Override public void finishedLoading(AssetManager assetManager, String fileName, Class type) { if (type == Game.class) { game = assetManager.get(fileName); } else if (type == Scene.class) { String sceneName = projectAssets.resolve(fileName).nameWithoutExtension(); Scene scene = assetManager.get(fileName); scenes.put(sceneName, scene); } else if (type == Project.class) { project = assetManager.get(fileName); // Project is the last thing loaded, generate command controller.command(new ModelCommand(controller.getModel(), game, project, scenes)); } }