public DataManager( GraphicsDevice graphicsDevice, string contentPath ) { m_textureHandler = new TextureHandler(graphicsDevice); m_tileLayerHandler = new TileLayerHandler(); m_texturePreviewHandler = new TexturePreviewHandler(); //initialize any content the data manager will need (textures etc...) InitializeContent( graphicsDevice, contentPath); }
public Tuple<string, List<string>> HandleExistingLayer(string fileName, TextureHandler textureHandler, TexturePreviewHandler texturePreviewHandler) { try { //Make sure file doesn't already exist string trimmedFileName = Utility.FileUtility.GetFileNameWithParentFolder(fileName); if (!m_tileLayerDictionary.ContainsKey(trimmedFileName)) { //Get the tile layer data object EditorTileLayerDO openedTileLayerDO = FileHandling.LayerFileHandler.OpenEditorLayer(fileName, textureHandler, texturePreviewHandler); if (openedTileLayerDO != null) { m_tileLayerDictionary.Add(trimmedFileName, openedTileLayerDO.EditorTileLayer); //we grabbed necessary information from the layer data object, now simply return a layer tuple, that contains the layer name, //and a list of all the layers texture names return new Tuple<string, List<string>>(trimmedFileName, openedTileLayerDO.LayerTextureNameList); } } //if it does exist, or the layer file could not be handled properly just return an empty tuple return new Tuple<string, List<string>>(string.Empty, null); } catch (Exception e) { throw e; } }