/**
 * 声音管理  
 */
/**
 *  await11橙子切开的声音， await21西瓜切开的声音， await31苹果切开的声音， await41柠檬切开的声音，
 *  
 *  juice果汁弹出的声音 ,knife飞镖射出的声音
 */

module.exports = {
    b_music_effect: -1,  //表示我们游戏是否静音，0没有静音，1为静音;默认为开启  (静音的话，则背景音乐与点击啥的音效我都统一关闭)

    //播放音乐
    playBgMusic: function(num){
        var url =null;
        switch(num){
            case 0:  //游戏的背景音乐  (目前没有)
                url = cc.url.raw("resources/Music/music_home.mp3");
            break;
            case 1:  //关闭背景音乐
                url = cc.url.raw("resources/Music/music_fightBg.mp3");
                cc.audioEngine.stopMusic(url, false);
            break;
            
        }
        if(this.b_music_effect){  //不是静音时，播放
            cc.audioEngine.playMusic(url, true);  
            cc.audioEngine.setMusicVolume(1);
        }
    },

    //播放音效
    playClickEffet: function(num){
        var url =null;
        switch(num){
            case 1:  //播放橙子切开的音效
                url = cc.url.raw("resources/Music/await11.mp3");
            break;
            case 2:  //播放西瓜切开的音效
                url = cc.url.raw("resources/Music/await21.mp3");
            break;
            case 3:  //播放苹果切开的音效
                url = cc.url.raw("resources/Music/await31.mp3");
            break;
            case 4:  //播放柠檬切开的音效
                url = cc.url.raw("resources/Music/await41.mp3");
            break;
            case 5:  //播放奇异果切开音效 
                url = cc.url.raw("resources/Music/await51.mp3");
            break;
            case 6:  //播放菠萝切开音效 
                url = cc.url.raw("resources/Music/await61.mp3");
            break;
            case 7:  //播放芒果切开音效
                url = cc.url.raw("resources/Music/await71.mp3");
            break;
            case 8:  //播放荔枝切开的音效
                url = cc.url.raw("resources/Music/await81.mp3");
            break;
            case 9:  //播放香蕉切开的音效
                url = cc.url.raw("resources/Music/await91.mp3");
            break;
            case 10:  //播放樱桃切开的音效
                url = cc.url.raw("resources/Music/await101.mp3");
            break;
            case 11:  //播放飞镖射出的音效
                url = cc.url.raw("resources/Music/knife.mp3");
            break;
            case 12:   //播放倒计时音效
                url = cc.url.raw("resources/Music/cutdown.mp3"); 
            break;
            // case 12:  //播放三飞镖射出的音效
            //     url = cc.url.raw("resources/Music/knife1.mp3"); 
            // break;
            // case 13:  //播放果汁弹出的音效
            //     url = cc.url.raw("resources/Music/juice.mp3");
            // break;
            // case 14: //播放切开金水果的音效
            //     url = cc.url.raw("resources/Music/goldFruit.mp3");   
            // break;
            // case 15:  //播放弹金币的音效
            //     url = cc.url.raw("resources/Music/getGold.mp3");         
            // break;
        }
        if(this.b_music_effect){  //不是静音时，播放
            cc.audioEngine.play(url, false, 1); 
        } 
    },

    //游戏中是否要有声音 (1开启， 0关闭)
    setAudio: function(b_mute){
        this.b_music_effect = (b_mute) ? 1 : 0;
        
    },

};