Ejemplo n.º 1
0
    protected void CopySelectedAssset()
    {
        string assetTypeDir;

        switch (fileType)
        {
        case FileType.SCENE_BACKGROUND:
            assetTypeDir = AssetsController.CATEGORY_BACKGROUND_FOLDER;
            break;

        case FileType.SCENE_FOREGROUND:
            assetTypeDir = AssetsController.CATEGORY_BACKGROUND_FOLDER;
            break;

        case FileType.SCENE_MUSIC:
        case FileType.EXIT_MUSIC:
        case FileType.CUTSCENE_MUSIC:
        case FileType.FRAME_MUSIC:
        case FileType.ITEM_DESCRIPTION_NAME_SOUND:
        case FileType.ITEM_DESCRIPTION_BRIEF_SOUND:
        case FileType.ITEM_DESCRIPTION_DETAILED_SOUND:
        case FileType.NPC_DESCRIPTION_NAME_SOUND:
        case FileType.NPC_DESCRIPTION_BRIEF_SOUND:
        case FileType.NPC_DESCRIPTION_DETAILED_SOUND:
        case FileType.PLAY_SOUND_EFFECT:
            assetTypeDir = AssetsController.CATEGORY_AUDIO_PATH;
            break;

        case FileType.EXIT_ICON:
            assetTypeDir = AssetsController.CATEGORY_CURSOR_PATH;
            break;

        case FileType.CUTSCENE_VIDEO:
            assetTypeDir = AssetsController.CATEGORY_VIDEO_PATH;
            break;

        case FileType.CUTSCENE_SLIDES:
        case FileType.CHARACTER_ANIM:
        case FileType.PLAY_ANIMATION_EFFECT:
            //TODO: copy all assets files (slides, music)
            assetTypeDir = AssetsController.CATEGORY_ANIMATION_FOLDER;
            break;

        case FileType.FRAME_IMAGE:
            assetTypeDir = AssetsController.CATEGORY_ANIMATION_FOLDER;
            break;

        case FileType.BOOK_IMAGE_PARAGRAPH:
        case FileType.ITEM_IMAGE:
        case FileType.ITEM_IMAGE_OVER:
        case FileType.SET_ITEM_IMAGE:
            assetTypeDir = AssetsController.CATEGORY_IMAGE_FOLDER;
            break;

        case FileType.ITEM_ICON:
            assetTypeDir = AssetsController.CATEGORY_ICON_FOLDER;
            break;

        case FileType.BOOK_ARROW_LEFT_NORMAL:
        case FileType.BOOK_ARROW_RIGHT_NORMAL:
        case FileType.BOOK_ARROW_LEFT_OVER:
        case FileType.BOOK_ARROW_RIGHT_OVER:
            assetTypeDir = AssetsController.CATEGORY_ARROW_BOOK_PATH;
            break;

        default:
            assetTypeDir = "";
            break;
        }

        DirectoryInfo path = new DirectoryInfo(DIR_PREFIX + "/" + assetTypeDir);

        if (!Directory.Exists(path.FullName))
        {
            Directory.CreateDirectory(path.FullName);
        }

        string nameOnly = Path.GetFileName(selectedAssetPath);

        File.Copy(selectedAssetPath, Path.Combine(path.FullName, nameOnly), true);

        if (fileType == FileType.CUTSCENE_SLIDES || fileType == FileType.CHARACTER_ANIM || fileType == FileType.PLAY_ANIMATION_EFFECT)
        {
            AssetsController.copyAllFiles(Path.GetDirectoryName(selectedAssetPath), path.FullName);
        }

        returnPath = assetTypeDir + "/" + nameOnly;
    }