// Path: src/main/java/com/github/naoghuman/sokubanfx/resources/image/ImageLoader.java
// public class ImageLoader {
//     
//     private ObservableMap<String, Image> backgroundImages;
//     
//     public ImageLoader() {
//         this.init();
//     }
//     
//     private void init() {
//         backgroundImages = FXCollections.observableHashMap();
//     }
//     
//     public Image loadImage(String name) {
//         LoggerFacade.INSTANCE.debug(this.getClass(), "Load background image: " + name); // NOI18N
//         
//         final Image image = backgroundImages.computeIfAbsent(
//                 name,
//                 key -> {
//                     return this.load(key);
//                 });
//         
//         return image;
//     }
//     
//     private Image load(String image) {
//         LoggerFacade.INSTANCE.debug(this.getClass(), "Load image: " + image + " from resources"); // NOI18N
// 
//         Image img = null;
//         try {
//             final URI uri = this.getClass().getResource(image).toURI();
//             img = new Image(uri.toString(), 1280.0d, 720.0d, true, true);
//         } catch (URISyntaxException ex) {
//             LoggerFacade.INSTANCE.error(this.getClass(), "Can't load image: " + image, ex); // NOI18N
//         }
//         
//         return img;
//     }
//     
// }
// 
// Path: src/main/java/com/github/naoghuman/sokubanfx/resources/video/VideoLoader.java
// public class VideoLoader implements IVideoConfiguration {
//     
//     public MediaPlayer loadVideo(int videoIndex) {
//         LoggerFacade.INSTANCE.debug(this.getClass(), "Load video"); // NOI18N
//  
//         final StringBuilder sb = new StringBuilder();
//         sb.append(PREFIX__VIDEO);
//         sb.append(videoIndex);
//         sb.append(SUFFIX__FILE);
//         
//         final String video = PropertiesFacade.INSTANCE.getProperty(KEY__RESOURCE_BUNDLE__VIDEO, sb.toString());
//         try {
//             final Media media = new Media(this.getClass().getResource(video).toURI().toString());
//             final MediaPlayer mediaPlayer = new MediaPlayer(media);
//             mediaPlayer.setCycleCount(MediaPlayer.INDEFINITE);
//             mediaPlayer.setOnReady(() -> {
//                 mediaPlayer.play();
//             });
//             
//             return mediaPlayer;
//         } catch (URISyntaxException ex) {
//             LoggerFacade.INSTANCE.error(this.getClass(), "Can't load video: " + video, ex); // NOI18N
//         }
//         
//         return null;
//     }
//     
// }


import com.github.naoghuman.sokubanfx.resources.image.ImageLoader;
import com.github.naoghuman.sokubanfx.resources.video.VideoLoader;

/*
 * Copyright (C) 2016 Naoghuman
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.github.naoghuman.sokubanfx.resources;


/**
 *
 * @author Naoghuman
 */
public class ResourcesFacade {
    
    private static ResourcesFacade instance = null;
    
    public static ResourcesFacade getDefault() {
        if (instance == null) {
            instance = new ResourcesFacade();
        }
        
        return instance;
    }
    
    private ImageLoader imageLoader = null;
    private VideoLoader videoLoader = null;
    
    private ResourcesFacade() {
        this.init();
    }
    
    private void init() {
        imageLoader = new ImageLoader();
        videoLoader = new VideoLoader();
    }
    

// Path: src/main/java/com/github/naoghuman/sokubanfx/resources/image/ImageLoader.java
// public class ImageLoader {
//     
//     private ObservableMap<String, Image> backgroundImages;
//     
//     public ImageLoader() {
//         this.init();
//     }
//     
//     private void init() {
//         backgroundImages = FXCollections.observableHashMap();
//     }
//     
//     public Image loadImage(String name) {
//         LoggerFacade.INSTANCE.debug(this.getClass(), "Load background image: " + name); // NOI18N
//         
//         final Image image = backgroundImages.computeIfAbsent(
//                 name,
//                 key -> {
//                     return this.load(key);
//                 });
//         
//         return image;
//     }
//     
//     private Image load(String image) {
//         LoggerFacade.INSTANCE.debug(this.getClass(), "Load image: " + image + " from resources"); // NOI18N
// 
//         Image img = null;
//         try {
//             final URI uri = this.getClass().getResource(image).toURI();
//             img = new Image(uri.toString(), 1280.0d, 720.0d, true, true);
//         } catch (URISyntaxException ex) {
//             LoggerFacade.INSTANCE.error(this.getClass(), "Can't load image: " + image, ex); // NOI18N
//         }
//         
//         return img;
//     }
//     
// }
// 
// Path: src/main/java/com/github/naoghuman/sokubanfx/resources/video/VideoLoader.java
// public class VideoLoader implements IVideoConfiguration {
//     
//     public MediaPlayer loadVideo(int videoIndex) {
//         LoggerFacade.INSTANCE.debug(this.getClass(), "Load video"); // NOI18N
//  
//         final StringBuilder sb = new StringBuilder();
//         sb.append(PREFIX__VIDEO);
//         sb.append(videoIndex);
//         sb.append(SUFFIX__FILE);
//         
//         final String video = PropertiesFacade.INSTANCE.getProperty(KEY__RESOURCE_BUNDLE__VIDEO, sb.toString());
//         try {
//             final Media media = new Media(this.getClass().getResource(video).toURI().toString());
//             final MediaPlayer mediaPlayer = new MediaPlayer(media);
//             mediaPlayer.setCycleCount(MediaPlayer.INDEFINITE);
//             mediaPlayer.setOnReady(() -> {
//                 mediaPlayer.play();
//             });
//             
//             return mediaPlayer;
//         } catch (URISyntaxException ex) {
//             LoggerFacade.INSTANCE.error(this.getClass(), "Can't load video: " + video, ex); // NOI18N
//         }
//         
//         return null;
//     }
//     
// }


// Path: src/main/java/com/github/naoghuman/sokubanfx/resources/ResourcesFacade.java
import com.github.naoghuman.sokubanfx.resources.image.ImageLoader;
import com.github.naoghuman.sokubanfx.resources.video.VideoLoader;

/*
 * Copyright (C) 2016 Naoghuman
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.github.naoghuman.sokubanfx.resources;


/**
 *
 * @author Naoghuman
 */
public class ResourcesFacade {
    
    private static ResourcesFacade instance = null;
    
    public static ResourcesFacade getDefault() {
        if (instance == null) {
            instance = new ResourcesFacade();
        }
        
        return instance;
    }
    
    private ImageLoader imageLoader = null;
    private VideoLoader videoLoader = null;
    
    private ResourcesFacade() {
        this.init();
    }
    
    private void init() {
        imageLoader = new ImageLoader();
        videoLoader = new VideoLoader();
    }
    

    public ImageLoader getImageLoader() {
